get_model
Retrieves one model from the model registry.
info
Calls to get_model are automatically cached. Additional calls to fetch the same model from get_model will be instant.
Parameters
mb.get_model(name=, ...)
- name:- strThe name of the model to fetch from the registry.
- file:- Optional[str]The file path to store the model.
- branch:- Optional[str]The branch to use when fetching the model.
Returns
Any - The model that was stored in the registry, or None if file= was specified. If the model doesn't exist an exception is raised.
Examples
Get one model
To fetch the model named example_model and load it into the variable model:
model = mb.get_model("example_model")
Get one model in the "finance" directory
Models can be stored in subdirectories. Specify the model's full path when using get_model:
model = mb.get_model("finance/example_model")
Get a model and store it as a local file
Fetch a file-based model from the registry and store it in the file my_model.gguf:
mb.get_model("my_model", file="my_model.gguf")