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:




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


The global rank, as returned by get_global_rank().


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


The world size, as returned by get_world_size().


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


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',
... )
  • 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.