Configuration
How to configure your model.
ML models often have dependencies on external libraries, data, and other resources. These models also typically have particular hardware configurations.
In this guide, we’ll cover the basics of how to configure your model to specify this information.
Configuration for models is specified in the config.yaml
file. Here are some
of the common configuration options:
Environment variables
You can specify environment variables to be set in the model serving environment
using the environment_variables
key.
Python Packages
Python packages can be specified in two ways in the config.yaml
file:
requirements
: A list of Python packages to install.requirements_file
: A requirements.txt file to install pip packages from.
For example, if you have a simple list of packages, you can specify them as follows:
Note that you can pin versions using the ==
operator.
If you need more control over the installation process and want to use
different pip options or repositories, you can specify a requirements_file
instead.
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
your config.yaml
file:
For a more concrete examples,
Resources
Another key part of configuring your model is specifying hardware resources needed.
You can use the resources
key to specify these. For a CPU model, your resources
configuration might look something like:
For a GPU model, your resources configuration might look like:
When you push your model, it will be assigned an instance type matching the specifications required.
See the Resources page for more information on options available.
Advanced configuration
There are numerous other options for configuring your model. See some of the other guides: