Tracker¶
Here is a tutorial on Google Colab that shows how to use the tracker module
Track¶
- labml.tracker.save()[source]¶
- labml.tracker.save(global_step: int)
- labml.tracker.save(values: Dict[str, any])
- labml.tracker.save(name: str, value: any)
- labml.tracker.save(**kwargs: any)
- labml.tracker.save(global_step: int, values: Dict[str, any])
- labml.tracker.save(global_step: int, name: str, value: any)
- labml.tracker.save(global_step: int, **kwargs: any)
This has multiple overloads
- labml.tracker.save()[source]
- labml.tracker.save(global_step: int)[source]
- labml.tracker.save(values: Dict[str, any])[source]
- labml.tracker.save(name: str, value: any)[source]
- labml.tracker.save(**kwargs: any)[source]
- labml.tracker.save(global_step: int, values: Dict[str, any])[source]
- labml.tracker.save(global_step: int, name: str, value: any)[source]
- labml.tracker.save(global_step: int, **kwargs: any)[source]
This saves the tracking information in all the writers such as labml.ai monitoring app, TensorBoard and Weights and Biases.
- Parameters
global_step (int) – The current step
values (Dict[str, any]) – A dictionary of key-value pairs to track
name (str) – The name of the value to be tracked
value (any) – The value to be tracked
kwargs – Key-value pairs to track
- labml.tracker.add(values: Dict[str, any])[source]¶
- labml.tracker.add(name: str, value: any)
- labml.tracker.add(**kwargs: any)
This has multiple overloads
- labml.tracker.add(values: Dict[str, any])[source]
- labml.tracker.add(name: str, value: any)[source]
- labml.tracker.add(**kwargs: any)[source]
This add tracking information to a temporary queue. These will be saved when
labml.tracker.save()
is called.You should use
labml.tracker.add()
to improve performance since saving tracking information consumes time. Although saving takes negligible amount of time it can add up if called very frequently.- Parameters
values (Dict[str, any]) – A dictionary of key-value pairs to track
name (str) – The name of the value to be tracked
value (any) – The value to be tracked
kwargs – Key-value pairs to track
Step¶
- labml.tracker.set_global_step(global_step: Optional[int])[source]¶
Set the current step for tracking
- Parameters
global_step (int) – Global step
Setup¶
- labml.tracker.set_queue(name: str, queue_size: int = 10, is_print: bool = False)[source]¶
Set indicator type to be a queue. This will maintain a queue of size
queue_size
to store the tracked values. A histogram of the queue contents and stats like mean will be logged.This is useful when we want to track statistics like moving average.
- Parameters
name (str) – Name of the indicator
queue_size (int, optional) – Size of the queue. Defaults to
10
.is_print – (bool, optional): Whether the indicator should be printed in console. Defaults to
False
.
- labml.tracker.set_histogram(name: str, is_print: bool = False)[source]¶
Set indicator type to be a histogram. It will log the tracked values as a histogram.
- Parameters
name (str) – Name of the indicator
is_print – (bool, optional): Whether the indicator should be printed in console. Defaults to
False
.
- labml.tracker.set_scalar(name: str, is_print: bool = False)[source]¶
Set indicator type to be a scalar. It will log a scalar of the tracked values. If there are multiple values it will log the mean.
- Parameters
name (str) – Name of the indicator
is_print – (bool, optional): Whether the indicator should be printed in console. Defaults to
False
.
- labml.tracker.set_indexed_scalar(name: str)[source]¶
Set indicator type to be an indexed scalar. It will log pairs of values (index, value).
- Parameters
name (str) – Name of the indicator
Warning
Artificact setup functions
labml.tracker.set_image()
,
labml.tracker.set_text()
,
labml.tracker.set_tensor()
, and
labml.tracker.set_indexed_text()
are still experimental.
- labml.tracker.set_image(name: str, is_print: bool = False, density: Optional[float] = None)[source]¶
Set indicator type to be an image.
- Parameters
name (str) – Name of the indicator
is_print – (bool, optional): Whether to show the image with
matplotlib
. Defaults toFalse
.density – (float, optional): This controls how often to log images.
- labml.tracker.set_text(name: str, is_print: bool = False)[source]¶
Set indicator type to be text (a string).
- Parameters
name (str) – Name of the indicator
is_print – (bool, optional): Whether to show the image with
matplotlib
. Defaults toFalse
.
- labml.tracker.set_tensor(name: str, is_once: bool = False)[source]¶
Set indicator type to be a tensor.
- Parameters
name (str) – Name of the indicator
is_once – (bool, optional): Whether this is tracked once only
- labml.tracker.set_indexed_text(name: str, title: Optional[str] = None, is_print: bool = False)[source]¶
Set indicator type to be an indexed text. It will log (index, text) pairs.
- Parameters
name (str) – Name of the indicator
title (str) – Title to display
is_print – (bool, optional): Whether to show the image with
matplotlib
. Defaults toFalse
.