Run ML workloads on cloud TPUs and GPUs#
Run any Python function on a cloud TPU or GPU with one decorator. Kinetic creates the infrastructure, builds the container image, ships your code, and returns the result.
import kinetic
@kinetic.run(accelerator="tpu-v5litepod-4")
def train_model():
import keras
model = keras.Sequential([...])
model.fit(x_train, y_train)
return model.history.history["loss"][-1]
final_loss = train_model() # runs on a 4-chip TPU v5e slice
Start here#
Read these three pages in order. They take about 30 minutes. When something does not work, see Troubleshooting, and for short answers see the FAQ.
Install Kinetic, run kinetic init, and run a Keras job on a TPU.
The vocabulary, the job lifecycle, and where your code, data, and results go.
Runnable scripts, from a first run to multi-host LLM fine-tuning.
What happens on every job#
Package. Kinetic serializes your function and archives your project source.
Data(...)arguments upload one time, keyed by content.Build. Kinetic builds a container image with the packages from your
requirements.txtorpyproject.toml, and caches the image. Later runs with the same dependencies skip this step.Schedule. Kinetic creates a Kubernetes Job on your GKE cluster, or a LeaderWorkerSet for a multi-host TPU slice. The autoscaler starts an accelerator node in the matching node pool.
Run. The pod runs your function with
KINETIC_OUTPUT_DIRset. The logs stream to your terminal.Collect. The pod uploads the return value to Cloud Storage. Kinetic downloads the value and deletes the job resources. Files that you wrote under
KINETIC_OUTPUT_DIRstay.
Explore the guides#
Get inputs into the job with kinetic.Data(...).
Keep files and make long jobs resumable with KINETIC_OUTPUT_DIR.
run_async() for jobs that run more than a few minutes. Reattach from
any machine.
One saved project, zone, cluster, and namespace per cluster. Switch with one command.
Add accelerator pools, share a cluster with a team, and clean up.
Scale to a multi-host TPU slice with the Pathways backend.