Skip to main content

mb.get_models(...)

Retrieves multiple models from the registry.

info

Calls to get_models are automatically cached. Additional calls to fetch the same models from get_models will be instant.

Parameters

  • prefix: Optional[str] A search prefix to use when looking for models to fetch. Similar to mb.models(prefix=...).
  • names: Optional[List[str]] A list of model names to fetch from the registry.
  • files: Optional[Dict[str, str]] A dict of model names to fetch from the registry, and their corresponding local files paths for storage.
  • branch: Optional[s] The branch to use when fetching models from the registry. By default, the current branch is used.

Returns

Dict[str, Any] - A dict of model names to model instances, when using prefix= or names=. Or None when using files=.

Examples

Get several models by name

models = mb.get_models(names=["model1", "model2"])

Get several models by prefix

models = mb.get_models(prefix="project_foo/")

Download several models to files

mb.get_models(files={"model1": "path/to/model1.pkl", "model2": "path/to/model2.gguf"})

See also