View on Github
Implementing the Model class
With weight caching, you don’t have to change anything about how the Model class
is implemented to take advantage of the weight caching.
model/model.py
Setting up the config.yaml
Theconfig.yaml file is where you need to include the changes to
actually cache the weights at build time.
config.yaml
Configuring the model_cache
To cache model weights, set themodel_cache key.
The repo_id field allows you to specify a Huggingface
repo to pull down and cache at build-time, and the ignore_patterns
field allows you to specify files to ignore. If this is specified, then
this repo won’t have to be pulled during runtime.
Check out the guide for more info.
config.yaml
config.yaml
Deploy the model
Deploy the model like you would other Trusses, with:The build step will take longer than with the normal
Llama Truss, since bundling the model weights is now happening during the build.
The deploy step & scale-ups will happen much faster with this approach.