avalanche.training.templates.BaseTemplate

class avalanche.training.templates.BaseTemplate(*, model: Module, device: str | device = 'cpu', plugins: Sequence[BasePlugin] | None = None, **kwargs)[source]

Base class for continual learning skeletons.

Training loop The training loop is organized as follows:

train
    train_exp  # for each experience

Evaluation loop The evaluation loop is organized as follows:

eval
    eval_exp  # for each experience
__init__(*, model: Module, device: str | device = 'cpu', plugins: Sequence[BasePlugin] | None = None, **kwargs)[source]

Init.

Methods

__init__(*, model[, device, plugins])

Init.

eval(experiences, **kwargs)

Evaluate the current model on a series of experiences and returns the last recorded value for each metric.

train(experiences[, eval_streams])

Training loop.

Attributes

is_eval

True if the strategy is in evaluation mode.

model

PyTorch model.

device

PyTorch device where the model will be allocated.

plugins

List of `SupervisedPlugin`s. .

experience

Current experience.

is_training

True if the strategy is in training mode.

current_eval_stream

Current evaluation stream.