ML models depend on external libraries, data files, and specific hardware configurations. This guide shows you how to configure your model’s dependencies and resources. TheDocumentation Index
Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
Use this file to discover all available pages before exploring further.
config.yaml file defines your model’s configuration. Common options include:
Environment variables
To set environment variables in the model serving environment, use theenvironment_variables key:
config.yaml
Python packages
Specify Python packages inconfig.yaml using either requirements (an inline list) or requirements_file (a path to a file). These two options are mutually exclusive.
Inline list
List packages directly inconfig.yaml:
config.yaml
==:
config.yaml
Requirements file
Pointrequirements_file at a dependency file. Truss supports three formats:
- requirements.txt
- pyproject.toml
- uv.lock
Use a standard pip requirements file for full control over pip options and repositories.
config.yaml
Dependency constraints
Truss uses aconstraints.txt file to enforce version bounds on base server dependencies. If you specify a package that overlaps with base dependencies (for example, numpy or fastapi), your version is respected but must fall within the bounds defined in constraints.txt. If you specify a version outside these bounds, the build will fail with an unsatisfiable error. This applies to both requirements (inline list) and requirements_file.
Chains
Chains supports the same three formats viaDockerImage.requirements_file. Use make_abs_path_here to resolve the path relative to the source file:
pyproject.toml and uv.lock work the same way:
pip_requirements_file is deprecated. Use requirements_file instead. You can’t combine pip_requirements with pyproject.toml or uv.lock files — manage all dependencies in your pyproject.toml.System packages
Truss also has support for installing apt-installable Debian packages. To add system packages to your model serving environment, add the following to yourconfig.yaml file:
config.yaml
config.yaml
Resources
Specify hardware resources in theresources section.
Option 1: Specify individual resource fields
For a CPU model:
config.yaml
config.yaml
config.yaml
instance_type lets you select an exact SKU. When specified, other resource fields are ignored.
See the Resources page for more information on
options available.