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.

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: int | None)[source]

Set the current step for tracking

Parameters:

global_step (int) – Global step

labml.tracker.add_global_step(increment_global_step: int = 1)[source]

Increment the current step for tracking

Parameters:

increment_global_step (int, optional) – By how much to increment the global step. Defaults to 1 if not provided.

labml.tracker.get_global_step() int[source]

Returns current step

Setup

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.

Namespaces

labml.tracker.namespace(name: str)[source]

Set a namespace for tracking

Helpers

labml.tracker.reset()[source]

Reset indicators, for a new experiment

labml.tracker.new_line()[source]

Prints a new line.

Equivalent to logger.log, but handles distributed training where only the rank=0 process is tracking data.