yamle.utils.trainer_utils module#
- class yamle.utils.trainer_utils.ValidationReporterMonitorCallback(reporter, epoch_offset=None)[source]#
Bases:
CallbackThis callback reports all the metrics back to the Syne-Tune Reporter.
This is happening after each validation epoch.
- Parameters:
- on_validation_epoch_end(trainer, pl_module)[source]#
This method reports the validation metric of choice to the Syne-Tune Reporter.
- Parameters:
trainer¶ (Trainer) – The PyTorch Lightning Trainer.
pl_module¶ (BaseMethod) – The PyTorch Lightning Module.
- Return type:
None
- class yamle.utils.trainer_utils.GradientNormMonitorCallback(norm=2, frequency=10)[source]#
Bases:
CallbackThis callback logs the norm of the gradients of the method.
This is happening after each training batch with a given frequency.
- Parameters:
- on_after_backward(trainer, pl_module)[source]#
This method logs the norm of the gradients of the method.
- Parameters:
trainer¶ (Trainer) – The PyTorch Lightning Trainer.
pl_module¶ (BaseMethod) – The PyTorch Lightning Module.
- Return type:
None
- class yamle.utils.trainer_utils.GradientValueClippingCallback(value=None)[source]#
Bases:
CallbackThis callback clips the value of the gradient to a min and max.
- on_after_backward(trainer, pl_module)[source]#
This method clips the value of the gradient to a min and max.
- Parameters:
trainer¶ (Trainer) – The PyTorch Lightning Trainer.
pl_module¶ (BaseMethod) – The PyTorch Lightning Module.
- Return type:
None
- class yamle.utils.trainer_utils.L1L2MonitorCallback[source]#
Bases:
CallbackThis callback logs the L1 and L2 norm of the parameters of the method.
This is happening after each training epoch.
- on_train_epoch_end(trainer, pl_module)[source]#
This method logs the L1 and L2 norm of the parameters of the method.
It logs the L1 and L2 norm of the parameters of the method. It calculates the total norm as well as per model part norm.
- Parameters:
trainer¶ (Trainer) – The PyTorch Lightning Trainer.
pl_module¶ (BaseMethod) – The PyTorch Lightning Module.
- Return type:
None
- class yamle.utils.trainer_utils.WeightHistogramMonitorCallback[source]#
Bases:
CallbackThis callback logs the histogram of the weights of the method.
This is happening after each training epoch.
- class yamle.utils.trainer_utils.RegularizedWeightsMonitorCallback[source]#
Bases:
CallbackThis callback logs the regularized weights of the method on the start of the training.
- class yamle.utils.trainer_utils.SplitParametersMonitorCallback[source]#
Bases:
CallbackThis callback logs how the parameters are split between different optimizers at the start of the training.
- class yamle.utils.trainer_utils.NoOptimizationMonitorCallback[source]#
Bases:
CallbackThis callback logs which parameters are not optimized at the start of the training.
- class yamle.utils.trainer_utils.LoggingCallback[source]#
Bases:
CallbackThis callback updates, logs and resets all the metrics.
This is happening after each training, validation or test epoch.
- on_train_batch_end(trainer, pl_module, outputs, batch, batch_idx)[source]#
This method is used to update the training metrics after each training step.
- Return type:
None
- on_validation_batch_end(trainer, pl_module, outputs, batch, batch_idx, dataloader_idx=0)[source]#
This method is used to update the validation metrics after each validation step.
- Return type:
None
- on_test_batch_end(trainer, pl_module, outputs, batch, batch_idx, dataloader_idx=0)[source]#
This method is used to update the test metrics after each test step.
- Return type:
None
- on_train_epoch_start(trainer, pl_module)[source]#
This method is used at the start of each training epoch.
- Return type:
None
- on_train_epoch_end(trainer, pl_module)[source]#
This method is used to log the training metrics at the end of each training epoch.
- Return type:
None
- on_validation_epoch_start(trainer, pl_module)[source]#
This method is used at the start of each validation epoch.
- Return type:
None
- on_validation_epoch_end(trainer, pl_module)[source]#
This method is used to log the validation metrics at the end of each validation epoch.
- Return type:
None
- class yamle.utils.trainer_utils.ValidationModelSavingCallback(task)[source]#
Bases:
CallbackThis callback saves the best model given a validation metric.
The metric is decided by the main metric given by the task. It comes from MAIN_METRIC.
- Parameters:
task¶ (str) – The task of the method.