{ "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "title": "Schema for cog.yaml", "description": "Defines how to build a Docker image and how to run predictions on your model inside that image.", "properties": { "build": { "$id": "#/properties/build", "type": "object", "description": "This stanza describes how to build the Docker image your model runs in.", "properties": { "cuda": { "$id": "#/properties/build/properties/cuda", "type": "string", "description": "Cog automatically picks the correct version of CUDA to install, but this lets you override it for whatever reason." }, "cudnn": { "$id": "#/properties/build/properties/cudnn", "type": "string", "description": "Cog automatically picks the correct version of cuDNN to install, but this lets you override it for whatever reason." }, "gpu": { "$id": "#/properties/build/properties/gpu", "type": "boolean", "description": "Enable GPUs for this model. When enabled, the [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) base image will be used, and Cog will automatically figure out what versions of CUDA and cuDNN to use based on the version of Python, PyTorch, and Tensorflow that you are using." }, "python_version": { "$id": "#/properties/build/properties/python_version", "type": [ "string", "number" ], "description": "The minor (`3.13`) or patch (`3.13.1`) version of Python to use." }, "python_packages": { "$id": "#/properties/build/properties/python_packages", "type": [ "array", "null" ], "description": "A list of Python packages to install, in the format `package==version`.", "additionalItems": true, "items": { "$id": "#/properties/build/properties/python_packages/items", "anyOf": [ { "$id": "#/properties/build/properties/python_packages/items/anyOf/0", "type": "string" } ] } }, "pre_install": { "$id": "#/properties/build/properties/pre_install", "type": [ "array", "null" ], "description": "A list of setup commands to run in the environment before your Python packages are installed.", "additionalItems": true, "items": { "$id": "#/properties/build/properties/pre_install/items", "anyOf": [ { "$id": "#/properties/build/properties/pre_install/items/anyOf/0", "type": "string" } ] } }, "python_requirements": { "$id": "#/properties/build/properties/python_requirements", "type": "string", "description": "A pip requirements file specifying the Python packages to install." }, "system_packages": { "$id": "#/properties/build/properties/system_packages", "type": [ "array", "null" ], "description": "A list of Ubuntu APT packages to install.", "additionalItems": true, "items": { "$id": "#/properties/build/properties/system_packages/items", "anyOf": [ { "$id": "#/properties/build/properties/system_packages/items/anyOf/0", "type": "string" } ] } }, "sdk_version": { "$id": "#/properties/build/properties/sdk_version", "type": "string", "description": "Pin the cog Python SDK version installed in the container (e.g. \"0.18.0\" or \"0.18.0a1\"). Use \"prerelease\" to always install the latest pre-release. Defaults to latest stable. Overridden by the COG_SDK_WHEEL environment variable." }, "run": { "$id": "#/properties/build/properties/run", "type": [ "array", "null" ], "description": "A list of setup commands to run in the environment after your system packages and Python packages have been installed. If you're familiar with Docker, it's like a `RUN` instruction in your `Dockerfile`.", "additionalItems": true, "items": { "$id": "#/properties/build/properties/run/items", "anyOf": [ { "$id": "#/properties/build/properties/run/items/anyOf/0", "type": "string" }, { "$id": "#/properties/build/properties/run/items/anyOf/1", "type": "object", "properties": { "command": { "type": "string" }, "mounts": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "secret" ] }, "id": { "type": "string" }, "target": { "type": "string" } }, "required": [ "type", "id", "target" ] } } }, "required": [ "command" ] } ] } } }, "required": ["python_version"], "additionalProperties": false }, "image": { "$id": "#/properties/image", "type": "string", "description": "The name given to built Docker images. If you want to push to a registry, this should also include the registry name." }, "predict": { "$id": "#/properties/predict", "type": "string", "description": "The pointer to the `Predictor` object in your code, which defines how predictions are run on your model." }, "train": { "$id": "#/properties/train", "type": "string", "description": "The pointer to the `Predictor` object in your code, which defines how predictions are run on your model." }, "concurrency": { "$id": "#/properties/concurrency", "type": "object", "description": "The concurrency settings for the model.", "required": [ "max" ], "additionalProperties": false, "properties": { "max": { "$id": "#/properties/concurrency/properties/max", "type": "integer", "description": "The maximum number of concurrent predictions." }, "default_target": { "$id": "#/properties/concurrency/properties/default_target", "type": "integer", "description": "The default target for number of concurrent predictions. This setting can be used by an autoscaler to determine when to scale a deployment of a model up or down." } } }, "environment": { "$id": "#/properties/properties/environment", "type": [ "array", "null" ], "description": "A list of environment variables to make available during builds and at runtime, in the format `NAME=value`", "additionalItems": true, "items": { "$id": "#/properties/properties/environment/items", "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*=.*$" } }, "weights": { "$id": "#/properties/weights", "type": [ "array", "null" ], "description": "A list of weight files or directories to include in the model.", "items": { "type": "object", "required": ["source"], "additionalProperties": false, "properties": { "name": { "type": "string", "description": "A unique identifier for this weight entry." }, "source": { "type": "string", "description": "Path to a weight file or directory (relative to cog.yaml)." }, "target": { "type": "string", "description": "Target path in the container (must be under /cache/). Defaults to /cache/." } } } } }, "additionalProperties": false }