format_name_with_dist#

composer.utils.format_name_with_dist(format_str, run_name, **extra_format_kwargs)[source]#

Format format_str with the run_name, distributed variables, and extra_format_kwargs.

The following format variables are available:

Variable

Description

{run_name}

The name of the training run. See Logger.run_name.

{rank}

The global rank, as returned by get_global_rank().

{local_rank}

The local rank of the process, as returned by get_local_rank().

{world_size}

The world size, as returned by get_world_size().

{local_world_size}

The local world size, as returned by get_local_world_size().

{node_rank}

The node rank, as returned by get_node_rank().

For example, assume that the rank is 0. Then:

>>> from composer.utils import format_name_with_dist
>>> format_str = '{run_name}/rank{rank}.{extension}'
>>> format_name_with_dist(
...     format_str,
...     run_name='awesome_training_run',
...     extension='json',
... )
'awesome_training_run/rank0.json'
Parameters
  • format_str (str) โ€“ The format string for the checkpoint filename.

  • run_name (str) โ€“ The value for the {run_name} format variable.

  • extra_format_kwargs (object) โ€“ Any additional format() kwargs.