Description
Creates a model template.
Details
Model templates serve 2 purposes. First, they provide common scaffolding that is static across multiple models. Second, they expose several variables that can be injected at model creation time to customize the model.
For example, a model template can define a docker image that contains code to run a HuggingFace or SentenceTransformers model. This docker image code also accepts environment variables that can be set to swap out the model weights or model name.
Two of the most important fields required to create a model template are the model_creation_parameters_schema
and model_request_parameters_schema
fields.
The model_creation_parameters_schema
field defines the schema for parameters that can be injected at model creation time. For example, if the schema contains a model_weights_uri
field, which expects a string, when a model is created from this template, the user can provide a URI to a model weights file that can be used to swap out the model weights used by the model.
The model_request_parameters_schema
field defines the schema for parameters that can be injected by an end user at model execution time. For example, if the schema contains a model_request_parameters
field, which expects a string, when a model is executed, the user can provide a string that will be passed to the model for inference.