Compute
PyTorch + CUDA
This is the unopinionated option: the official PyTorch image, CUDA already matched to the build, a root shell over SSH, and nothing else in the way.
What you get
Section titled “What you get”Four upstream tags are in the template list. They are the official pytorch/pytorch images, unmodified apart from the platform’s SSH layer.
| Template | Image | PyTorch | CUDA |
|---|---|---|---|
| PyTorch 2.8 - Cuda 12.9 | pytorch/pytorch:2.8.0-cuda12.9-cudnn9-runtime | 2.8.0 | 12.9 |
| PyTorch | pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime | 2.5.1 | 12.4 |
| PyTorch 2.2 - Cuda 12.1 | pytorch/pytorch:2.2.0-cuda12.1-cudnn8-runtime | 2.2.0 | 12.1 |
| PyTorch 2.1 - Cuda 11.8 | pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime | 2.1.0 | 11.8 |
Pick the newest unless something pins you older — a dependency built against an older CUDA, or a repository that hasn’t caught up with a PyTorch major.
Two things to know before you start:
- There is no web UI. These templates run nothing on port 80, so
https://<your-slug>.instance.grafilab.aiwill not answer. You work over SSH, and anything you want in a browser you start yourself and expose with Web Access. - These are
runtimeimages, notdevel. They carry the CUDA runtime libraries but not the toolkit, so there is nonvcc. Packages that compile CUDA kernels at install time will fail — see Troubleshooting.
When to pick it
Section titled “When to pick it”Pick this template for scripts: a training loop you launch and leave running, an evaluation sweep, a repository with its own CLI. You get a clean environment and full control of it.
If you would rather work cell by cell in a browser, JupyterLab is the same idea with a notebook server on top. If you want to edit files in a browser IDE, use code-server.
Launch
Section titled “Launch”Deploy an instance and pick one of the PyTorch cards in step 2, Template Selection. Match the card’s VRAM to the model you plan to train or serve. The full walkthrough is in Deploy a GPU Instance.
Connect and verify CUDA
Section titled “Connect and verify CUDA”-
In the console open My Instance (
https://app.grafilab.ai/orders) and find the card for your instance. Wait until its status reads Active. -
Click Connect. The Connect with SSH dialog shows an SSH Connect command and a Password.
-
Copy the command into a terminal, press Enter, and paste the password when prompted. You land in a root shell inside the container.
First check that the driver sees the card:
nvidia-smiThen check that PyTorch does:
python -c "import torch; print(torch.__version__, torch.cuda.is_available(), torch.cuda.get_device_name(0))"You want True and the name of the card you rented. If you get False, see Troubleshooting.
Get your code and data onto the box
Section titled “Get your code and data onto the box”git clone https://github.com/<owner>/<repo>.gitcd <repo>pip install -r requirements.txtTake the host and port from the SSH Connect command in the Connect dialog:
scp -P <port> ./dataset.zip <your-slug>@<ssh-proxy-host>:/root/rsync -avP -e "ssh -p <port>" ./project/ <your-slug>@<ssh-proxy-host>:/root/project/The instance’s connection is much faster than your uplink, so pull public data directly:
wget https://example.com/dataset.tar.gzhuggingface-cli download <repo-id> --local-dir ./dataRun anything longer than a coffee break inside tmux, so the job survives a dropped SSH connection:
tmux new -s trainpython train.pyPress Ctrl-b then d to detach, and tmux attach -t train to come back. nohup python train.py > train.log 2>&1 & works too if you only need the output in a file.
Expose a service
Section titled “Expose a service”There is no service on port 80 to start with, so anything you want to reach from a browser you start yourself and map through the proxy. Bind to all interfaces, not localhost:
pip install jupyterlabjupyter lab --ip 0.0.0.0 --port 8888 --allow-rootThen open Web Access on the instance card, add a mapping with a Service Name and Port 8888, and use the proxy URL it generates. The same applies to a Gradio app or any other server you run. The procedure is in Manage Instances.
Persistence and backup
Section titled “Persistence and backup”Nothing persists past the rental
Instances have no persistent volume. Anything you write at runtime — downloaded models, installed packages, notebooks, outputs — lives in the container for the lifetime of the rental and is gone when it expires. Before Expire at, back up the folders you care about to Grafilab storage and download the archive.
Checkpoints are the thing to protect. Write them somewhere you chose deliberately, push them off the box as the run produces them — to a git remote, object storage, or a Hugging Face repository — and use Backup on the instance card before Expire at for whatever is still only on the instance.
Troubleshooting
Section titled “Troubleshooting”torch.cuda.is_available()returnsFalseon a GPU node. The node’s NVIDIA driver is older than the CUDA version your image was built against. Relaunch on a template with an older CUDA tag —2.5.1-cuda12.4or2.2.0-cuda12.1— or pick a different node.nvcc: command not found, or a package fails to build CUDA extensions. These areruntimeimages without the CUDA toolkit. Install a prebuilt wheel for the package if one exists, or create a custom template from the matching-develimage tag — see Custom templates.Connection refusedright after launch. The container is still starting. Wait until the instance card reads Active.- A DataLoader crashes with a shared-memory error. The container gets 2 GB of
/dev/shm. Lowernum_workers, or settorch.multiprocessing.set_sharing_strategy("file_system").

