torchtraining.iterations¶
-
class
torchtraining.iterations.Eval(step: Any, module: torch.nn.modules.module.Module, data: Union[torch.utils.data.dataset.Dataset, torch.utils.data.dataloader.DataLoader], log: Union[int, str] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.iterations.IterationPerform evaluation step until
datais exhausted.Provided
modulewill be passed to everystep.- Parameters
step (torchtraining.steps.Step) – Single step to run. Usually subclass of
torchtraining.steps.Step, but could be anyCallabletakingmoduleanddataarguments and returning anything.module (torch.nn.Module) – Torch module (or modules) passed to
stepduring each call.data ([torch.utils.data.Dataset | torch.utils.data.DataLoader]) – Iterable object (usually data or dataloader) yielding data passed to
step.
- logstr | int, optional
Severity level for logging object’s actions. Available levels of logging:
NONE 0
TRACE 5
DEBUG 10
INFO 20
SUCCESS 25
WARNING 30
ERROR 40
CRITICAL 50
Default:
NONE(no logging,0priority)
-
class
torchtraining.iterations.Iteration(step: Any, module: torch.nn.modules.module.Module, data: Union[torch.utils.data.dataset.Dataset, torch.utils.data.dataloader.DataLoader], train: bool, log: Union[int, str] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining._base.IterationPerform
step(trainoreval) untildatais exhausted.Provided
modulewill be passed to everystep.- Parameters
step (torchtraining.steps.Step) – Single step to run. Usually subclass of
torchtraining.steps.Step, but could be anyCallabletakingmoduleanddataarguments and returning anything.module (torch.nn.Module) – Torch module (or modules) passed to
stepduring each call.data ([torch.utils.data.Dataset | torch.utils.data.DataLoader]) – Iterable object (usually data or dataloader) yielding data passed to
step.
- train: bool
Whether
moduleshould be in training state (module.train()) with enabled gradient or in evaluation mode (module.eval()) with disabled gradient- logstr | int, optional
Severity level for logging object’s actions. Available levels of logging:
NONE 0
TRACE 5
DEBUG 10
INFO 20
SUCCESS 25
WARNING 30
ERROR 40
CRITICAL 50
Default:
NONE(no logging,0priority)
-
class
torchtraining.iterations.Train(step: Any, module: torch.nn.modules.module.Module, data: Union[torch.utils.data.dataset.Dataset, torch.utils.data.dataloader.DataLoader], log: Union[int, str] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.iterations.IterationPerform training step until
datais exhausted.Provided
modulewill be passed to everystep.- Parameters
step (torchtraining.steps.Step) – Single step to run. Usually subclass of
torchtraining.steps.Step, but could be anyCallabletakingmoduleanddataarguments and returning anything.module (torch.nn.Module) – Torch module (or modules) passed to
stepduring each call.data ([torch.utils.data.Dataset | torch.utils.data.DataLoader]) – Iterable object (usually data or dataloader) yielding data passed to
step.
- logstr | int, optional
Severity level for logging object’s actions. Available levels of logging:
NONE 0
TRACE 5
DEBUG 10
INFO 20
SUCCESS 25
WARNING 30
ERROR 40
CRITICAL 50
Default:
NONE(no logging,0priority)