torchpack.callbacks package¶
Submodules¶
torchpack.callbacks.callback module¶
torchpack.callbacks.checkpoint module¶
-
class
torchpack.callbacks.checkpoint.Saver(*, max_to_keep: int = 4, save_dir: Optional[str] = None)[source]¶ Bases:
torchpack.callbacks.callback.CallbackSave the checkpoint once triggered.
-
master_only= True¶
-
-
class
torchpack.callbacks.checkpoint.MinSaver(scalar: str, *, name: Optional[str] = None, save_dir: Optional[str] = None)[source]¶ Bases:
torchpack.callbacks.checkpoint.BestSaverSave the checkpoint with minimum value of some scalar in trainer.summary.
-
extreme= 'min'¶
-
torchpack.callbacks.inference module¶
torchpack.callbacks.metainfo module¶
torchpack.callbacks.metrics module¶
-
class
torchpack.callbacks.metrics.TopKCategoricalAccuracy(k: int, *, output_tensor: str = 'outputs', target_tensor: str = 'targets', name: str = 'accuracy')[source]¶ Bases:
torchpack.callbacks.callback.Callback
-
class
torchpack.callbacks.metrics.CategoricalAccuracy(*, output_tensor: str = 'outputs', target_tensor: str = 'targets', name: str = 'accuracy')[source]¶
torchpack.callbacks.progress module¶
torchpack.callbacks.trackers module¶
-
class
torchpack.callbacks.trackers.GPUUtilizationTracker(*, devices: Optional[List[int]] = None)[source]¶ Bases:
torchpack.callbacks.callback.CallbackTrack the average GPU utilization within an epoch. It will start a process to track GPU utilization through NVML every second within the epoch (the time of trigger_epoch is not included). This callback creates a process, therefore it is not safe to be used with MPI.
-
master_only= True¶
-
torchpack.callbacks.triggers module¶
-
class
torchpack.callbacks.triggers.EnableCallbackIf(callback: torchpack.callbacks.callback.Callback, predicate: Callable[[torchpack.callbacks.callback.Callback], bool])[source]¶ Bases:
torchpack.callbacks.callback.ProxyCallbackEnable the callback only if some condition holds.
-
class
torchpack.callbacks.triggers.PeriodicTrigger(callback: torchpack.callbacks.callback.Callback, *, every_k_epochs: Optional[int] = None, every_k_steps: Optional[int] = None)[source]¶ Bases:
torchpack.callbacks.callback.ProxyCallbackTrigger the callback every k steps or every k epochs.
-
class
torchpack.callbacks.triggers.PeriodicCallback(callback: torchpack.callbacks.callback.Callback, *, every_k_epochs: Optional[int] = None, every_k_steps: Optional[int] = None)[source]¶ Bases:
torchpack.callbacks.triggers.EnableCallbackIfEnable the callback every k steps or every k epochs. Note that this can only make a callback less frequent.
torchpack.callbacks.writers module¶
-
class
torchpack.callbacks.writers.SummaryWriter[source]¶ Bases:
torchpack.callbacks.callback.CallbackBase class for all summary writers.
-
master_only= True¶
-
-
class
torchpack.callbacks.writers.ConsoleWriter(scalars: Union[str, List[str]] = '*')[source]¶ Bases:
torchpack.callbacks.writers.SummaryWriterWrite scalar summaries to console (and logger).
-
class
torchpack.callbacks.writers.TFEventWriter(*, save_dir: Optional[str] = None)[source]¶ Bases:
torchpack.callbacks.writers.SummaryWriterWrite summaries to TensorFlow event file.
-
class
torchpack.callbacks.writers.JSONLWriter(save_dir: Optional[str] = None)[source]¶ Bases:
torchpack.callbacks.writers.SummaryWriterWrite scalar summaries to JSONL file.