The full file
The yaml binds your class to the platform: which file, which class, what arguments, what hardware. No engine field means custom mode.
inference.yaml
model:
module: "my_serve" # scripts/my_serve.py — dotted path for subfolders
class_name: "YourPredictor" # the class to instantiate
init_args: # → YourPredictor(**init_args)
num_classes: 3
path: "model/weights.pt" # optional — see Weights below
cluster:
num_workers: 1
device: "auto" # your __init__ picks cuda > cpu
gpus_per_worker: 1
cpus_per_worker: 8
min_vram_gb_per_worker: 6 # free VRAM each selected worker must have
max_ongoing_requests: 8 # per-replica concurrency cap
requirements:
- "transformers>=4.56,<5" # your extras — see the note belowField reference
note
The base image already ships torch, fastapi, httpx, and pillow. Don't re-pin those; list only what your model genuinely adds (the SAM example adds
transformers and numpy). Every extra line slows boot.Weights: two patterns
Pull from the Hub. Skip model.path and download inside __init__ (from_pretrained(...)). Simplest, and right for public checkpoints.
Ship your own file. Upload a weights file with the bundle, set model.path, and implement load_weights(path). The platform mounts the file and hands you the local path after __init__. Right for fine-tunes and private checkpoints.
Submit mechanics for both (including the weights upload): Submit inference via SDK.