Cog on Turion (GPUs & Blackwell)
Turion runs standard Cog images, but the GPU generation and the Cog runtime have a few sharp edges worth knowing before you build. This page is the checklist.
Your own Cog image runs on your own fleet, on whatever GPUs its nodes
have; the shared turion pool runs only Turion’s own runtimes, such as
Civitai imports. A model cannot choose a GPU class within its fleet.
If your nodes are Blackwell (an RTX PRO 6000, compute capability sm_120, like the shared pool),
your CUDA wheels must carry sm_120 kernels.
Blackwell needs cu128 torch
Section titled “Blackwell needs cu128 torch”Most published Cog images predate Blackwell. They import fine, then fail at predict time with:
CUDA error: no kernel image is available for execution on the deviceThat means CUDA reached the GPU but PyTorch had no kernels compiled for sm_120. The fix is a
PyTorch built on CUDA 12.8: any torch >= 2.7 from the cu128 wheel index. Install it in
cog.yaml’s run: steps, not python_packages (see the PEP 668 note below):
build: gpu: true cuda: "12.4" # cog base CUDA; the cu128 wheel bundles its own CUDA runtime python_version: "3.11" run: # 1. torch from the cu128 index → carries the Blackwell (sm_120) kernels - uv run pip install --break-system-packages --no-cache-dir torch==2.8.0 --index-url https://download.pytorch.org/whl/cu128 # 2. your other deps afterwards; they see torch already installed and keep it - uv run pip install --break-system-packages --no-cache-dir openai-whisperpredict: "predict.py:Predictor"Order matters: install cu128 torch first, then everything else, so a dependency does not pull in a CPU-only or older-CUDA torch.
To verify a built image before pushing:
docker run --rm my-model:latest python -c "import torch; print(torch.__version__)"# → 2.8.0+cu128Why --break-system-packages in run:?
Section titled “Why --break-system-packages in run:?”Cog’s uv-based runtime installs python_packages with uv run pip install, which hits PEP 668
(“externally-managed-environment”) on uv’s managed Python and aborts the build. Installing your
dependencies in run: steps with --break-system-packages avoids this and lets you choose the
wheel index per package.
The cuDNN shadow problem
Section titled “The cuDNN shadow problem”Cog’s CUDA base image ships an older system cuDNN that shadows the newer cuDNN bundled in the cu128 torch wheel. Model load works, but cuDNN is loaded lazily at predict time and resolves to the system copy, crashing with:
libcudnn_graph.so.9: undefined symbol: cudnnGetLibConfigFix: a run: step that removes the system cuDNN and registers torch’s bundled copy with the
loader:
run: # … torch + deps first (as above), then: - set -e; rm -f /usr/lib/x86_64-linux-gnu/libcudnn*.so* /usr/local/cuda*/lib64/libcudnn*.so*; D=$(dirname "$(find / -path '*/nvidia/cudnn/lib/libcudnn_graph.so.9' 2>/dev/null | head -1)"); test -n "$D"; echo "$D" > /etc/ld.so.conf.d/zzz-torch-cudnn.conf; ldconfig; echo "registered torch cuDNN at $D"If it persists, build with cog build --use-cuda-base-image false: no system CUDA at all, since
the cu128 torch wheel is self-contained.
Output must be a JSON object
Section titled “Output must be a JSON object”On Turion, predict() must return a JSON object (a dict). The usual way is a cog.BaseModel
output class:
from cog import BasePredictor, BaseModel, Input, Path
class Output(BaseModel): text: str language: str
class Predictor(BasePredictor): def predict(self, audio: Path = Input(description="Audio file")) -> Output: ... return Output(text=text, language=lang)The exception is iterator outputs. A predict() that returns Iterator[…] or
ConcatenateIterator[…] streams its chunks, and its stored output is
the assembled value: a joined string for ConcatenateIterator, a list otherwise.
For other models, a bare str, number or list is not supported. Wrap single values in a field
(Output(text=…)).
The health-check contract
Section titled “The health-check contract”Turion, and turion cog predict, drive your container through
Cog’s HTTP /health-check:
| Status | Meaning |
|---|---|
STARTING | setup() is still running; no predictions yet |
READY | predictions are sent to the container |
SETUP_FAILED | setup() raised; the prediction fails with the setup error |
setup() has 60 seconds to reach READY. A container that is still STARTING after that fails
the prediction with model_load_timeout, which is not billed. On your own nodes the limit is the
agent’s HEALTHCHECK_TIMEOUT_S; see Join a node.
- Do all loading in
setup(), not lazily inpredict(). Each prediction is limited topredict_timeout_s(default 300 seconds). - Let
setup()raise on missing weights or assets: a clearSETUP_FAILEDis easier to debug than a hang.turion prediction logs <id>shows the container output, including setup, when a prediction fails right after starting.
Large weights
Section titled “Large weights”For multi-GB weights you have two options:
- Bake them into the image. Simple and reproducible, but every push and pull moves the
weights, and a cold node pulls them before
setup()starts. Lazy pull helps; see Cold starts. - Download them in
setup(). On nodes with a weight cache the download lands on the node’s disk and later containers reuse it; see Cold starts. The first download on a node still has to fit in the 60-second setup limit above, so this suits weights that download in well under a minute.
Either way, weights do not belong in prediction inputs; see Files & outputs.