models#

Module attributes and functions#

models.get_all_models_legacy()[source]#

Returns the list of all the available models in the models folder that follow the model naming convention (see Models).

Return type:

List[dict]

models.get_model(args, backbone, loss, transform, dataset)[source]#

Return the class of the selected continual model among those that are available. If an error was detected while loading the available datasets, it raises the appropriate error message.

Parameters:
  • args (Namespace) – the arguments which contains the –model attribute

  • backbone (nn.Module) – the backbone of the model

  • loss – the loss function

  • transform – the transform function

  • dataset – the instance of the dataset

Return type:

ContinualModel

Exceptions:

AssertError: if the model is not available Exception: if an error is detected in the model

Returns:

the continual model instance

Return type:

ContinualModel

models.get_model_class(args)[source]#

Return the class of the selected continual model among those that are available. If an error was detected while loading the available datasets, it raises the appropriate error message.

Parameters:

args (Namespace) – the arguments which contains the –model attribute

Return type:

ContinualModel

Exceptions:

AssertError: if the model is not available Exception: if an error is detected in the model

Returns:

the continual model class

Return type:

ContinualModel

models.get_model_names()[source]#

Return the available continual model names and classes.

Returns:

A dictionary containing the names of the available continual models and their classes.

Return type:

Dict[str, ContinualModel]

models.register_model(name)[source]#

Decorator to register a ContinualModel. The decorator should be used on a class that inherits from ContinualModel. The registered model can be accessed using the get_model function and can include additional keyword arguments to be set during parsing.

Differently from the register_dataset and register_backbone functions, this decorator does not infer the arguments from the signature of the class. Instead, to define model-specific arguments, you should define the get_parser function in the model class, which should return a parser with the additional arguments.

Parameters:

name (str) – the name of the model

Return type:

Callable