Skip to main content
Jig is a lightweight CLI for building Docker images from a pyproject.toml, pushing them to Together’s private container registry, and managing deployments. It’s included with the Together Python library.
See Jig in action: Check out our end-to-end examples for Image Generation with Flux2 and Video Generation with Wan 2.1.

The Deploy Workflow

Jig combines several steps into a single deploy command:
  1. Inittg beta jig init scaffolds a pyproject.toml with sensible defaults
  2. Build — Generates a Dockerfile from your config and builds the image locally
  3. Push — Pushes the image to Together’s registry at registry.together.ai
  4. Deploy — Creates or updates the deployment on Together’s infrastructure
Once deployed, monitor your containers:
For the full list of commands and flags, see the Jig CLI reference.
Jig builds images locally and pushes them to Together’s registry. ML images can be 10GB+, so building on a machine with a fast network connection saves significant time compared to pushing from a laptop over wifi.

Cache Warmup

The --warmup option lets you pre-generate inference engine compile caches — such as those created by torch.compile or TensorRT — at build time, rather than waiting for the first request in production. This can significantly reduce cold-start latency.

How It Works

  1. Build phase: Jig builds the base image normally
  2. Warmup phase: Jig runs the container with GPU access, mounting your local workspace to /app
  3. Cache capture: The container runs your Sprocket’s warmup_inputs, generating compile caches
  4. Final image: Jig builds a new image layer with the cache baked in
The cache location inside the container is controlled by WARMUP_ENV_NAME (default: TORCHINDUCTOR_CACHE_DIR) and WARMUP_DEST (default: torch_cache). Jig sets the environment variable to point to the cache directory during warmup and copies its contents into the final image.

Sprocket Integration

Define warmup_inputs on your Sprocket class to specify what inputs to run during warmup:
During a —warmup build, the predict(...) function is invoked once for each input specified in warmup_inputs. If warmup_inputs is empty or not defined, the warmup step invokes predict({}) once as a fallback. Make sure all the compile paths would be exercised by the warmup inputs. In normal build (no --warmup), an empty warmup_inputs means no warmup runs at all. Since the local workspace is mounted to /app, model weights and example inputs can live in your project directory and be referenced directly.

Requirements

  • A GPU on your build machine — warmup runs your model locally to generate caches. If you don’t have a local GPU, Together Instant Clusters provide on-demand H100s with fast connectivity to Together’s container registry.
  • warmup_inputs defined on your Sprocket with representative inputs
  • Weights and example inputs accessible in local workspace

Secrets

Secrets are encrypted environment variables injected into your container at runtime. Use them for API keys, tokens, and other sensitive values that shouldn’t be baked into the image.
A name cannot appear in both [tool.jig.deploy.environment_variables] and a secret. jig deploy fails and lists each colliding name if the same name is defined in both places. Remove the duplicate from your config or run tg beta jig secrets unset --name <name>.
Secrets are available to your container as environment variables at runtime. Do not also define the same name under [tool.jig.deploy.environment_variables]. See the Jig CLI reference for all secrets commands.

Volumes

Volumes let you mount read-only data — like model weights — into your container without baking them into the image. This keeps images small and lets you update weights independently of code. Create a volume and upload files:
Then mount it in your pyproject.toml:
See the Jig CLI reference for all volume commands.