This feature is still in beta.
- Typed configuration via Python code with IDE autocomplete, instead of a separate
yamlconfiguration file - Simpler directory structure that IDEs support for module resolution
Step 1: Initializing your project
We leverage traditionaltruss init functionality with a new flag to create the directory structure:
Step 2: Write your model
To build a model with this new framework, we require two things:- A class that inherits from
baseten.ModelBase, which will serve as the entrypoint when invoking/predict - A
predictmethod with type hints
my_model.py
Step 3: Deploy, patch, and public your model
In order to deploy the first version of your new model, you can run:push (as well as all other commands below) will require that you pass the path to the file containing the model as the final argument.
This new workflow also supports patching, so you can quickly iterate during development without building new images every time.
Model Configuration
Models can configure requirements for compute hardware (CPU count, GPU type and count, etc) and software dependencies (Python libraries or system packages) via theremote_config class variable within the model:
my_model.py
Context (access information)
You can addÂDeploymentContext object as an optional final argument to the __init__-method of a Model. This allows you to use secrets within your Model, but note that they’ll also need to be added to the assets.
We only expose secrets to the model that were explicitly requested in assets to comply with best security practices.
my_model.py
Packages
If you want to include modules in your model, you can easily create them from the root of the project:my_model.py as follows:
my_model.py
Known Limitations
- RemoteConfig does not support all the options exposed by the traditional
config.yaml. If you’re excited about this new development experience but need a specific feature ported over, please reach out to us! - This new framework does not support
preprocessorpostprocesshooks. We typically recommend inlining functionality from those functions if easy, or utilizingchainsif the needs are more complex.