torchtraining.callbacks.tensorboard module¶
Special type of callbacks focused on tensorboard integration.
Note
IMPORTANT: Users need tensorboard package installed for this
module to exist.
You can install it via pip install torchtraining[tensorboard]
(additional libraries for Image, Images, Video, Figure)
will also be installed)
or install tensorboard directly via pip install -U tensorboard
or a-like command (in this case not all functions may be available,
see PyTorch’s torch.utils.tensorboard.SummaryWriter docs for
exact packages needed for each functionality).
Example:
# Assume iteration was defined and loss is 0th element of step
iteration = (
tt.iterations.Iteration(...)
** tt.Select(loss=0)
** tt.device.CPU()
** tt.accumulators.Mean()
** tt.callbacks.tensorboard.Scalar(writer, "Network/Loss")
)
-
class
torchtraining.callbacks.tensorboard.Audio(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog audio to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_audiofor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_audiocall.**kwargs – Keyword variable length arguments passed to
add_audiocall.
-
class
torchtraining.callbacks.tensorboard.Figure(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog figure to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_figurefor more details.Can be used similarly to
torchtraining.callbacks.LoggerNote that this requires the
matplotlibpackage.- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_figurecall.**kwargs – Keyword variable length arguments passed to
add_figurecall.
-
class
torchtraining.callbacks.tensorboard.Histogram(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog histogram to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_histogramfor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_histogramcall.**kwargs – Keyword variable length arguments passed to
add_histogramcall.
-
class
torchtraining.callbacks.tensorboard.Image(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog image to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_imagefor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_imagecall.**kwargs – Keyword variable length arguments passed to
add_imagecall.
-
class
torchtraining.callbacks.tensorboard.Images(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog images to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_imagesfor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_imagescall.**kwargs – Keyword variable length arguments passed to
add_imagescall.
-
class
torchtraining.callbacks.tensorboard.Mesh(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog mesh to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_meshfor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_meshcall.**kwargs – Keyword variable length arguments passed to
add_meshcall.
-
class
torchtraining.callbacks.tensorboard.PRCurve(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog prcurve to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_prcurvefor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_prcurvecall.**kwargs – Keyword variable length arguments passed to
add_prcurvecall.
-
class
torchtraining.callbacks.tensorboard.Scalar(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog scalar to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_scalarfor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_scalarcall.**kwargs – Keyword variable length arguments passed to
add_scalarcall.
-
class
torchtraining.callbacks.tensorboard.Scalars(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog scalars to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_scalarsfor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_scalarscall.**kwargs – Keyword variable length arguments passed to
add_scalarscall.
-
class
torchtraining.callbacks.tensorboard.Text(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog text to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_textfor more details.Can be used similarly to
torchtraining.callbacks.Logger- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_textcall.**kwargs – Keyword variable length arguments passed to
add_textcall.
-
class
torchtraining.callbacks.tensorboard.Video(writer, name: str, flush: int = None, log: Union[str, int] = 'NONE', *args, **kwargs)[source]¶ Bases:
torchtraining.callbacks.tensorboard._TensorboardLog video to Tensorboard’s summary.
User should specify single
writerinstance to alltorchtraining.callbacks.tensorboardobjects used for training.See
torch.utils.tensorboard.writer.add_videofor more details.Can be used similarly to
torchtraining.callbacks.LoggerNote that this requires the
moviepypackage.- Parameters
writer (torch.utils.tensorboard.SummaryWriter) – Writer responsible for logging values.
name (str) – Name (tag) under which values will be logged into Tensorboard. Can be “/” separated to group values together, e.g. “Classifier/Loss” and “Classifier/Accuracy”
flush (int) – Flushes the event file to disk after
flushsteps. Call this method to make sure that all pending events have been written to disk.log (str | 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)*args – Variable length arguments passed to
add_videocall.**kwargs – Keyword variable length arguments passed to
add_videocall.