Agent skill · software engineering · replicate

build-models

Package and build custom AI models with Cog for deployment on Replicate. Use when creating a cog.yaml or predict.py, defining model inputs and outputs, loading model weights at setup time, building Docker images for ML models, serving locally with cog serve or cog predict, or porting a HuggingFace, GitHub, or ComfyUI model to run on Replicate. Trigger on phrases like "build a model", "package a model", "create a Cog model", "wrap a model", "containerize an AI model", "predict.py", "cog.yaml", "BasePredictor", or "Cog container", and when referencing cog.run, github.com/replicate/cog, or github.com/replicate/cog-examples. Covers GPU and CUDA setup, pget for fast weight downloads, async predictors with continuous batching, streaming outputs, and cold-boot optimization for image, video, audio, and LLM models. For pushing built models to Replicate, see publish-models. For running existing models, see run-models.

Why this skill is useful

Adds executable scripts and specific configurations for building and deploying AI models using Cog on Replicate, which are not commonly known.

What it needs

Requires cog, docker installed locally. About 6k tokens when loaded. Last updated 2026-06-04. 53 stars on the source repository.

What this skill does

Docs Cog reference (single file): <https://cog.run/llms.txt> cog.yaml reference: <https://cog.run/yaml> Python predictor reference: <https://cog.run/python> Examples: <https://github.com/replicate/cog-examples> Template: <https://github.com/replicate/cog-template> When to use this skill You have model code, weights, or a HuggingFace/GitHub project you want to host on Replicate. You're writing or editing a cog.yaml, predict.py, or train.py. For pushing a built model to Replicate, see publish-models. For running existing Replicate models, see run-models. Prerequisites Docker running locally. Cog installed: brew install replicate/tap/cog or sh <(curl -fsSL https://cog.run/install.sh). Optional: cog init to scaffold cog.yaml and predict.py. Project layout The canonical Replicate model layout: cog.yaml essentials A modern config for a GPU model: Notes: Pin Python to a specific minor version, and pin every line in requirements.txt. Floating versions break cold boots. Use pythonrequirements over inline pythonpackages once the list grows. cuda follows your torch wheel (e.g. 12.8 paired with torch==2.7.1+cu128). Add train: train.py:train if your model is fine-tunable. Add image: r8.im/owner/name to enable bare cog push. For async predictors with continuous batching: predict.py essentials Input rules: Every input needs a description. The description shows up in the model schema and on Replicate's web UI. Use ge/le for numeric bounds, choices=[...] for enums, regex= for strings. Use cog.Path for file inputs and outputs, never raw bytes. Use cog.Secret for any token-like input (HF tokens, API keys), never plain str. Provide a default that's inside choices for categorical inputs. Validate inputs early in predict() and raise ValueError. Streaming text output (for LLMs): Async predictor with continuous batching (paired with concurrency.max in cog.yaml): Dynamic choices from on-disk assets (e.g. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills replicate/build-models

View the source on GitHub

Browse the @skills marketplace