gensbi.utils.misc#

Attributes#

Functions#

get_colored_value(val[, thresholds])

Returns the value wrapped in color codes based on thresholds.

scale_lr(batch_size[, base_lr, reference_batch_size])

Scale learning rate based on batch size using square root scaling.

Module Contents#

gensbi.utils.misc.get_colored_value(val, thresholds=(1.1, 1.2))[source]#

Returns the value wrapped in color codes based on thresholds.

Parameters:
  • val (float) – The value to color.

  • thresholds (tuple of float) – Thresholds for coloring (red/yellow, yellow/green). Defaults to (1.1, 1.2).

Returns:

The colored string representation of the value.

Return type:

str

gensbi.utils.misc.scale_lr(batch_size, base_lr=0.0001, reference_batch_size=256)[source]#

Scale learning rate based on batch size using square root scaling.

Parameters:
  • batch_size (int) – The current batch size.

  • base_lr (float) – The base learning rate for the reference batch size.

  • reference_batch_size (int, optional) – The reference batch size. Defaults to 256.

Returns:

The adjusted learning rate.

Return type:

float

gensbi.utils.misc.GREEN = '\x1b[92m'[source]#
gensbi.utils.misc.RED = '\x1b[91m'[source]#
gensbi.utils.misc.RESET = '\x1b[0m'[source]#
gensbi.utils.misc.YELLOW = '\x1b[93m'[source]#