Skip to content

stub_loader

StubLoaderManager

Bases: ModelManager

Source code in inference/core/managers/stub_loader.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
class StubLoaderManager(ModelManager):
    def add_model(self, model_id: str, api_key: str, model_id_alias=None) -> None:
        """Adds a new model to the manager.

        Args:
            model_id (str): The identifier of the model.
            model (Model): The model instance.
        """
        if model_id in self._models:
            return
        model_class = self.model_registry.get_model(
            model_id_alias if model_id_alias is not None else model_id, api_key
        )
        model = model_class(model_id=model_id, api_key=api_key, load_weights=False)
        self._models[model_id] = model

add_model(model_id, api_key, model_id_alias=None)

Adds a new model to the manager.

Parameters:

Name Type Description Default
model_id str

The identifier of the model.

required
model Model

The model instance.

required
Source code in inference/core/managers/stub_loader.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def add_model(self, model_id: str, api_key: str, model_id_alias=None) -> None:
    """Adds a new model to the manager.

    Args:
        model_id (str): The identifier of the model.
        model (Model): The model instance.
    """
    if model_id in self._models:
        return
    model_class = self.model_registry.get_model(
        model_id_alias if model_id_alias is not None else model_id, api_key
    )
    model = model_class(model_id=model_id, api_key=api_key, load_weights=False)
    self._models[model_id] = model