Monitor¶
Here is a tutorial on Google Colab that shows how to use the monitor module
Basic¶
-
labml.monit.
section
(name, *, is_silent: bool = False, is_timed: bool = True, is_partial: bool = False, is_new_line: bool = True, is_children_silent: bool = False, total_steps: float = 1.0)[source]¶ This creates a monitored
with
block.- Parameters
name (str) – Name of the section
- Keyword Arguments
is_silent (bool, optional) – Whether not to print time taken. Defaults to
False
.is_timed (bool, optional) – Whether to measure time. Default to
True
.is_partial (bool, optional) – Whether it’s a partial excution where it gets called repeatedly. Defaults to
False
.is_new_line (bool, optional) – Whether to print a new line. Defaults to
True
.is_children_silent (bool, optional) – Whether to make child sections silent. Defaults to
True
.total_steps (float, optional) – Total number of steps. This is used to measure progress when
progress()
gets called. Defaults to1
.
-
labml.monit.
func
(name, *, is_silent: bool = False, is_timed: bool = True, is_partial: bool = False, is_new_line: bool = True, is_children_silent: bool = False, total_steps: float = 1.0)[source]¶ This is similar to
section()
but can be used as a decorator.- Parameters
name (str) – Name of the function
- Keyword Arguments
is_silent (bool, optional) – Whether not to print time taken. Defaults to
False
.is_timed (bool, optional) – Whether to measure time. Default to
True
.is_partial (bool, optional) – Whether it’s a partial excution where it gets called repeatedly. Defaults to
False
.is_new_line (bool, optional) – Whether to print a new line. Defaults to
True
.is_children_silent (bool, optional) – Whether to make child sections silent. Defaults to
True
.total_steps (float, optional) – Total number of steps. This is used to measure progress when
progress()
gets called. Defaults to1
.
Iterators¶
-
labml.monit.
iterate
(name, iterable: Union[Iterable, Sized, int], total_steps: Optional[int] = None, *, is_silent: bool = False, is_children_silent: bool = False, is_timed: bool = True, context=None)[source]¶ This creates a monitored iterator.
- Parameters
name (str) – Name of the iterator
iterable (Union[Iterable, Sized, int]) – The iterable
total_steps (int, optional) – Total number of steps. If not provided this is calculated from
iterable
.
- Keyword Arguments
is_silent (bool, optional) – Whether not to print time taken. Defaults to
False
.is_timed (bool, optional) – Whether to measure time. Default to
True
.is_children_silent (bool, optional) – Whether to make child sections silent. Defaults to
True
.context (optional) – Reference to another section that will be used for monitoring the iteration.
-
labml.monit.
enum
(name, iterable: Sized, *, is_silent: bool = False, is_children_silent: bool = False, is_timed: bool = True, context=None)[source]¶ This creates a monitored enumerator.
- Parameters
name (str) – Name of the iterator
iterable (Sized]) – The iterable
- Keyword Arguments
is_silent (bool, optional) – Whether not to print time taken. Defaults to
False
.is_timed (bool, optional) – Whether to measure time. Default to
True
.is_children_silent (bool, optional) – Whether to make child sections silent. Defaults to
True
.context (optional) – Reference to another section that will be used for monitoring the iteration.
-
labml.monit.
mix
(total_iterations, *iterators: Tuple[str, Sized], is_monit: bool = True)[source]¶ Mix a set of iterators.
This will iterate through a list of iterators while mixing among them. This is useful when you want to mix training and validation steps within an epoch. It gives a tuple of iterator name and the element as you iterate.
- Parameters
total_iterations (Union[Collection, range, int]) – The number of times to mix
iterators (Tuple[str, Sized]) – Are iterators and their names
is_monit (bool, optional) – Whether to monitor the iteration
Loop¶
-
labml.monit.
loop
(iterator_: Union[Collection, range, int], *, is_track: bool = True, is_print_iteration_time: bool = True)[source]¶ This has multiple overloads
-
labml.monit.
loop
(iterator_: range, *, is_track=True, is_print_iteration_time=True)[source]
-
labml.monit.
loop
(iterator_: int, *, is_track=True, is_print_iteration_time=True)[source]
This creates a monitored loop. This is designed for training loops. It has better monitoring than using
iterate()
orenum()
.- Parameters
iterator_ (Union[Collection, range, int]) – The iterator
- Keyword Arguments
is_track (bool, optional) – Whether track the loop time using
labml.tracker
. Default toTrue
.is_print_iteration_time (bool, optional) – Whether to print iteration time. Default to
True
.
-