drytorch.lib.runners
Module containing classes that run a model.
Classes
|
Base class that calls a model. |
|
Run a model on a dataset. |
|
Run a model on a dataset and log the value of an objective function. |
|
Run a model on a dataset, calculating the value of an objective function. |
|
Protocol for objects that support syncing. |
- class ModelCaller(model: ModelProtocol[Input, Output], name: str = '')[source]
Bases:
CreatedAtMixin,Generic[Input,Output]Base class that calls a model.
- model
the wrapped model.
- Type:
drytorch.core.protocols.ModelProtocol[drytorch.lib.runners.Input, drytorch.lib.runners.Output]
Initialize.
- Parameters:
model (ModelProtocol[Input, Output]) – the wrapped model.
name (str) – the name for the object for logging purposes. Defaults to class name plus eventual counter.
- class ModelRunner(model: ModelProtocol[Input, Output], name: str = '', *, loader: LoaderProtocol[tuple[Input, Target]])[source]
Bases:
ModelCaller[Input,Output],Generic[Input,Target,Output]Run a model on a dataset.
- model
the model to run.
- Type:
drytorch.core.protocols.ModelProtocol[drytorch.lib.runners.Input, drytorch.lib.runners.Output]
- loader
the loader providing inputs and targets in batches.
- Type:
drytorch.core.protocols.LoaderProtocol[tuple[drytorch.lib.runners.Input, drytorch.lib.runners.Target]]
Initialize.
- Parameters:
model (ModelProtocol[Input, Output]) – the model to run.
name (str) – the name for the object for logging purposes. Defaults to class name plus eventual counter.
loader (LoaderProtocol[tuple[Input, Target]]) – provides inputs and targets in batches.
- class ModelRunnerWithLogs(model: ModelProtocol[Input, Output], name: str = '', *, loader: LoaderProtocol[tuple[Input, Target]], objective: _Objective_co)[source]
Bases:
ModelRunnerWithObjective[Input,Target,Output,_Objective_co]Run a model on a dataset and log the value of an objective function.
- model
the model containing the weights to evaluate.
- Type:
drytorch.core.protocols.ModelProtocol[drytorch.lib.runners.Input, drytorch.lib.runners.Output]
- loader
provides inputs and targets in batches.
- Type:
drytorch.core.protocols.LoaderProtocol[tuple[drytorch.lib.runners.Input, drytorch.lib.runners.Target]]
- objective
processes the model outputs and targets.
- Type:
drytorch.lib.runners._Objective_co
Initialize.
- Parameters:
model (ModelProtocol[Input, Output]) – the model containing the weights to evaluate.
name (str) – the name for the object for logging purposes. Defaults to class name plus eventual counter.
loader (LoaderProtocol[tuple[Input, Target]]) – provides inputs and targets in batches.
objective (_Objective_co) – processes the model outputs and targets.
- class ModelRunnerWithObjective(model: ModelProtocol[Input, Output], name: str = '', *, loader: LoaderProtocol[tuple[Input, Target]], objective: _Objective_co)[source]
Bases:
ModelRunner[Input,Target,Output],MonitorProtocol,Generic[Input,Target,Output,_Objective_co]Run a model on a dataset, calculating the value of an objective function.
- model
the model containing the weights to evaluate.
- Type:
drytorch.core.protocols.ModelProtocol[drytorch.lib.runners.Input, drytorch.lib.runners.Output]
- loader
provides inputs and targets in batches.
- Type:
drytorch.core.protocols.LoaderProtocol[tuple[drytorch.lib.runners.Input, drytorch.lib.runners.Target]]
- objective
processes the model outputs and targets.
- Type:
drytorch.lib.runners._Objective_co
Initialize.
- Parameters:
model (ModelProtocol[Input, Output]) – the model containing the weights to evaluate.
name (str) – the name for the object for logging purposes. Defaults to class name plus eventual counter.
loader (LoaderProtocol[tuple[Input, Target]]) – provides inputs and targets in batches.
objective (_Objective_co) – processes the model outputs and targets.