drytorch.core.exceptions

Module containing internal exceptions for the drytorch package.

Exceptions

AccessOutsideScopeError(*args)

Raised when an operation is attempted outside an experiment scope.

CannotStoreOutputWarning(error)

Warning raised when output cannot be stored due to an error.

CheckpointNotInitializedError(*args)

Raised when attempting to use a checkpoint without a registered model.

ComputedBeforeUpdatedWarning(calculator)

Warning raised when compute method is called before updating.

ComputedMetricsTypeError(computed_metrics_type)

Raised when computed metrics have an unexpected type.

ConvergenceError(criterion)

Raised when a module fails to converge during training.

DatasetHasNoLengthError(*args)

Raised when a dataset does not implement the __len__ method.

DeviceMismatchError(metric_name, ...)

Raised when the metrics device does not match the expected device.

DistributedDatasetNotDivisibleWarning(name, ...)

Warning raised when the dataset cannot be equally distributed.

DistributedStorageWarning(error)

Warning raised when the distributed storage is not synchronized.

DryTorchError(*args)

Base exception class for all drytorch package exceptions.

DryTorchWarning(*args)

Base warning class for all drytorch package warnings.

EpochNotFoundError(epoch, checkpoint_directory)

Raised when no saved model is found in the checkpoint directory.

ExperimentalFeatureWarning(feature)

Warning raised when an experimental feature is used.

FailedOptionalImportWarning(package_name)

Warning raised when an optional dependency fails to import.

FuncNotApplicableError(func_name, type_name)

Raised when a function cannot be applied to a specific type.

LossNotScalarError(size)

Raised when a loss value is not a scalar tensor.

MetricNotFoundError(source_name, metric_name)

Raised when a requested metric is not found in the specified source.

MissingParamError(module_names, lr_param_groups)

Raised when parameter groups are missing required parameters.

ModelDeviceMismatchError(*args)

Raised when the metrics device does not match the model device.

ModelNotFoundError(checkpoint_directory)

Raised when no saved model is found in the checkpoint directory.

ModuleAlreadyRegisteredError(model_name, ...)

Raised when trying to access a model that has already been registered.

ModuleNotDistributedWarning(*args)

Warning raised when a model is not distributed.

ModuleNotRegisteredError(model_name, ...)

Raised an actor tries to access a module that hasn't been registered.

NameAlreadyRegisteredError(name)

Raised when attempting to register a name already in use.

NamedTupleOnlyError(tuple_type)

Raised when operations require a named tuple and not a subclass.

NestedScopeError(current_exp_name, new_exp_name)

Raised when attempting to nest an experiment scope within another one.

NoActiveExperimentError([experiment_name, ...])

Raised when no experiment is currently active.

NoPreviousRunsWarning(*args)

Attempted to resume the last run, but none were found.

NotExistingRunWarning(run_id)

Attempted to resume a not existing run.

ObjectiveSyncWarning(issue, recommend)

Warning for metric synchronization configuration issues.

OptimizerNotLoadedWarning(error)

Warning raised when the optimizer has not been correctly loaded.

PastEpochWarning(selected_epoch, current_epoch)

Warning raised when training is requested for a past epoch.

RecursionWarning(*args)

Warning raised when recursive objects obstruct metadata extraction.

ResultNotAvailableError(*args)

Raised when trying to access a result before the hook has been called.

RunAlreadyCompletedWarning(*args)

Warning raised when a run is stopped after completion.

RunAlreadyRecordedError(run_id, exp_name)

Error raised when attempting to record a run multiple times.

RunAlreadyRunningWarning(*args)

Warning raised when a run is started when already running.

RunNotRecordedError(run_id)

Raised when attempting to update a run that is not registered.

RunNotStartedWarning(*args)

Warning raised when a run is stopped before being started.

TerminatedTrainingWarning(*args)

Warning raised when training is attempted after termination.

TrackerAlreadyRegisteredError(tracker_name, ...)

Raised when attempting to register an already registered tracker.

TrackerError(tracker, tracker_msg)

Exception raised by tracker objects during experiment tracking.

TrackerExceptionWarning(subscriber_name, error)

Warning raised when a tracker encounters an error and is skipped.

TrackerNotUsedError(tracker_name)

Raised when trying to access a tracker that is not registered.

exception AccessOutsideScopeError(*args: Any)[source]

Bases: DryTorchError

Raised when an operation is attempted outside an experiment scope.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception CannotStoreOutputWarning(error: BaseException)[source]

Bases: DryTorchWarning

Warning raised when output cannot be stored due to an error.

Initialize.

Parameters:

error (BaseException) – the error that prevented output storage.

Return type:

None

exception CheckpointNotInitializedError(*args: Any)[source]

Bases: DryTorchError

Raised when attempting to use a checkpoint without a registered model.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception ComputedBeforeUpdatedWarning(calculator: Any)[source]

Bases: DryTorchWarning

Warning raised when compute method is called before updating.

Initialize.

Parameters:

calculator (Any) – the calculator object that was computed before updating.

Return type:

None

exception ComputedMetricsTypeError(computed_metrics_type: type)[source]

Bases: DryTorchError

Raised when computed metrics have an unexpected type.

Initialize.

Parameters:

computed_metrics_type (type) – the actual type of the computed metrics.

Return type:

None

exception ConvergenceError(criterion: float)[source]

Bases: DryTorchError

Raised when a module fails to converge during training.

Initialize.

Parameters:

criterion (float) – the convergence criterion that was not met.

Return type:

None

exception DatasetHasNoLengthError(*args: Any)[source]

Bases: DryTorchError

Raised when a dataset does not implement the __len__ method.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception DeviceMismatchError(metric_name: str, metric_device: device, target_device: device)[source]

Bases: DryTorchError

Raised when the metrics device does not match the expected device.

Initialize.

Parameters:
  • metric_name (str) – the name of the metric.

  • metric_device (device) – the device of the output tensor.

  • target_device (device) – the device of the model.

Return type:

None

exception DistributedDatasetNotDivisibleWarning(name: str, len_dataset: int, n_processes: int)[source]

Bases: DryTorchWarning

Warning raised when the dataset cannot be equally distributed.

Initialize.

Parameters:
  • name (str) – the name of the actor experiencing the issue.

  • len_dataset (int) – the size of the dataset.

  • n_processes (int) – the number of processes used in distributed processing.

Return type:

None

exception DistributedStorageWarning(error: BaseException)[source]

Bases: DryTorchWarning

Warning raised when the distributed storage is not synchronized.

Initialize.

Parameters:

error (BaseException) – the error that occurred while synchronizing the storage.

Return type:

None

exception DryTorchError(*args: Any)[source]

Bases: Exception

Base exception class for all drytorch package exceptions.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception DryTorchWarning(*args: Any)[source]

Bases: UserWarning

Base warning class for all drytorch package warnings.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception EpochNotFoundError(epoch: int, checkpoint_directory: Path)[source]

Bases: DryTorchError

Raised when no saved model is found in the checkpoint directory.

Initialize.

Parameters:
  • epoch (int) – the epoch that was not found.

  • checkpoint_directory (Path) – the directory path where no model was found.

Return type:

None

exception ExperimentalFeatureWarning(feature: str)[source]

Bases: DryTorchWarning

Warning raised when an experimental feature is used.

Initialize.

Parameters:

feature (str) – the experimental feature that was used.

Return type:

None

exception FailedOptionalImportWarning(package_name: str)[source]

Bases: DryTorchWarning

Warning raised when an optional dependency fails to import.

Initialize.

Parameters:

package_name (str) – the name of the package that failed to import.

Return type:

None

exception FuncNotApplicableError(func_name: str, type_name: str)[source]

Bases: DryTorchError

Raised when a function cannot be applied to a specific type.

Initialize.

Parameters:
  • func_name (str) – the name of the function that cannot be applied.

  • type_name (str) – the name of the type that doesn’t support the function.

Return type:

None

exception LossNotScalarError(size: Size)[source]

Bases: DryTorchError

Raised when a loss value is not a scalar tensor.

Initialize.

Parameters:

size (Size) – the actual size of the non-scalar loss tensor.

Return type:

None

exception MetricNotFoundError(source_name: str, metric_name: str)[source]

Bases: DryTorchError

Raised when a requested metric is not found in the specified source.

Initialize.

Parameters:
  • source_name (str) – the name of the source where the metric was not found.

  • metric_name (str) – the name of the metric that was not found.

Return type:

None

exception MissingParamError(module_names: list[str], lr_param_groups: list[str])[source]

Bases: DryTorchError

Raised when parameter groups are missing required parameters.

Initialize.

Parameters:
  • module_names (list[str]) – list of module names that should have parameters.

  • lr_param_groups (list[str]) – group names in the parameter learning rate config.

Return type:

None

exception ModelDeviceMismatchError(*args: Any)[source]

Bases: DryTorchError

Raised when the metrics device does not match the model device.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception ModelNotFoundError(checkpoint_directory: Path)[source]

Bases: DryTorchError

Raised when no saved model is found in the checkpoint directory.

Initialize.

Parameters:

checkpoint_directory (Path) – the directory path where no model was found.

Return type:

None

exception ModuleAlreadyRegisteredError(model_name: str, exp_name: str, run_id: str)[source]

Bases: DryTorchError

Raised when trying to access a model that has already been registered.

Initialize.

Parameters:
  • model_name (str) – the name of the model that was not registered.

  • exp_name (str) – the name of the current experiment.

  • run_id (str) – the current run’s id.

Return type:

None

exception ModuleNotDistributedWarning(*args: Any)[source]

Bases: DryTorchWarning

Warning raised when a model is not distributed.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception ModuleNotRegisteredError(model_name: str, exp_name: str, run_id: str)[source]

Bases: DryTorchError

Raised an actor tries to access a module that hasn’t been registered.

Initialize.

Parameters:
  • model_name (str) – the name of the model that was not registered.

  • exp_name (str) – the name of the current experiment.

  • run_id (str) – the current run’s id.

Return type:

None

exception NameAlreadyRegisteredError(name: str)[source]

Bases: DryTorchError

Raised when attempting to register a name already in use.

Initialize.

Parameters:

name (str) – the name that is already registered.

Return type:

None

exception NamedTupleOnlyError(tuple_type: str)[source]

Bases: DryTorchError

Raised when operations require a named tuple and not a subclass.

Initialize.

Parameters:

tuple_type (str) – the actual type of the tuple that was provided.

Return type:

None

exception NestedScopeError(current_exp_name: str, new_exp_name: str)[source]

Bases: DryTorchError

Raised when attempting to nest an experiment scope within another one.

Initialize.

Parameters:
  • current_exp_name (str) – the name of the currently active experiment.

  • new_exp_name (str) – the name of the experiment that cannot be started.

Return type:

None

exception NoActiveExperimentError(experiment_name: str | None = None, experiment_class: type | None = None)[source]

Bases: DryTorchError

Raised when no experiment is currently active.

Initialize.

Parameters:
  • experiment_name (str | None) – specifies experiment’s name.

  • experiment_class (type | None) – specifies experiment’s name.

Return type:

None

exception NoPreviousRunsWarning(*args: Any)[source]

Bases: DryTorchWarning

Attempted to resume the last run, but none were found.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception NotExistingRunWarning(run_id: str)[source]

Bases: DryTorchWarning

Attempted to resume a not existing run.

Initialize.

Parameters:

run_id (str) – the id of the run that was not found.

Return type:

None

exception ObjectiveSyncWarning(issue: str, recommend: str)[source]

Bases: DryTorchWarning

Warning for metric synchronization configuration issues.

Initialize.

Parameters:
  • issue (str) – the issue that was encountered with the objective.

  • recommend (str) – the recommended action to fix the issue.

Return type:

None

exception OptimizerNotLoadedWarning(error: BaseException)[source]

Bases: DryTorchWarning

Warning raised when the optimizer has not been correctly loaded.

Initialize.

Parameters:

error (BaseException) – the error that occurred while loading the optimizer.

Return type:

None

exception PastEpochWarning(selected_epoch: int, current_epoch: int)[source]

Bases: DryTorchWarning

Warning raised when training is requested for a past epoch.

Initialize.

Parameters:
  • selected_epoch (int) – the epoch that training was requested until.

  • current_epoch (int) – the current epoch number.

Return type:

None

exception RecursionWarning(*args: Any)[source]

Bases: DryTorchWarning

Warning raised when recursive objects obstruct metadata extraction.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception ResultNotAvailableError(*args: Any)[source]

Bases: DryTorchError

Raised when trying to access a result before the hook has been called.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception RunAlreadyCompletedWarning(*args: Any)[source]

Bases: DryTorchWarning

Warning raised when a run is stopped after completion.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception RunAlreadyRecordedError(run_id: str, exp_name: str)[source]

Bases: DryTorchError

Error raised when attempting to record a run multiple times.

Initialize.

Parameters:
  • run_id (str) – the id of the run that is already recorded.

  • exp_name (str) – the name of the experiment where to record the run.

Return type:

None

exception RunAlreadyRunningWarning(*args: Any)[source]

Bases: DryTorchWarning

Warning raised when a run is started when already running.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception RunNotRecordedError(run_id: str)[source]

Bases: DryTorchError

Raised when attempting to update a run that is not registered.

Constructor.

Parameters:

run_id (str) – the id of the run that is not registered.

Return type:

None

exception RunNotStartedWarning(*args: Any)[source]

Bases: DryTorchWarning

Warning raised when a run is stopped before being started.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception TerminatedTrainingWarning(*args: Any)[source]

Bases: DryTorchWarning

Warning raised when training is attempted after termination.

Initialize.

Parameters:

*args (Any) – arguments to be formatted into the message template.

Return type:

None

exception TrackerAlreadyRegisteredError(tracker_name: str, exp_name: str)[source]

Bases: DryTorchError

Raised when attempting to register an already registered tracker.

Initialize.

Parameters:
  • tracker_name (str) – the name of the tracker that is already registered.

  • exp_name (str) – the name of the experiment where to register the tracker.

Return type:

None

exception TrackerError(tracker: Any, tracker_msg: str)[source]

Bases: DryTorchError

Exception raised by tracker objects during experiment tracking.

Initialize.

Parameters:
  • tracker (Any) – the tracker object that encountered the error.

  • tracker_msg (str) – the error message from the tracker.

Return type:

None

exception TrackerExceptionWarning(subscriber_name: str, error: BaseException)[source]

Bases: DryTorchWarning

Warning raised when a tracker encounters an error and is skipped.

Constructor.

Parameters:
  • subscriber_name (str) – the name of the tracker that encountered the error.

  • error (BaseException) – the error that occurred in the tracker.

Return type:

None

exception TrackerNotUsedError(tracker_name: str)[source]

Bases: DryTorchError

Raised when trying to access a tracker that is not registered.

Initialize.

Parameters:

tracker_name (str) – the name of the tracker that is not registered.

Return type:

None