Deploying your model with Cortex is a fast and simple process, however, there are a few parameters to keep track of and you may not want to type them out every time you deploy. To make this process easier, Cortex supports the use of config files. Config files are YAML files that contain all of the parameters that you would normally pass to the CLI.
Using config files also makes it easier to keep track of your Cerebrium deployments, share them and use versioning tools such as git.
Using Config Files
To deploy your model with a config file, you can use the
cortex deploy command with the
--config-file flag to specify the path to your config file.
cerebrium deploy --config-file your_config_file.yaml
Your config file can be named anything you want and can be placed anywhere on your local machine. However, remember to use the
cerebrium deploy command in the same directory as your main.py as you would normally.
You can alternatively use the
cerebrium init-cortex-project command to generate your config file and setup a Cortex project in your desired directory. See here for more info.
Config File Format and Parameters
The parameters for your config file are the same as those which you would use for a normal
cerebrium deploy command. They’re tabulated below for your convenience:
|Name of the deployment||string|
|API key for the deployment||string||not included for safety|
|Hardware to use for the deployment||string||GPU|
|Log level for the deployment||string||INFO|
|Files to include in the deployment||string||’[./*, main.py, requirements.txt, pkglist.txt, conda_pkglist.txt]’|
|Files to exclude from the deployment||string||’[./., ./__]’|
|Whether to disable the animation in the logs.||boolean||false|
|The Python version you would like to run||float||3.9|
|The minimum number of replicas to run.||int||0|
|The maximum number of replicas to scale to.||int||*plan limit|
Config File Example
%YAML 1.2 --- name: an-optional-name api_key: an-optional-api-key hardware: GPU exclude: "[./.*, ./__*]" include: "[./*, main.py, requirements.txt, pkglist.txt, conda_pkglist.txt]" log_level: INFO disable_animation: false python_version: 3.9 min_replicas: 0 max_replicas: 30