MCPcopy
hub / github.com/mosaicml/composer / format_name_with_dist_and_time

Function format_name_with_dist_and_time

composer/utils/file_helpers.py:309–331  ·  view source on GitHub ↗
(
    format_str: str,
    run_name: str,
    timestamp: Timestamp,
    **extra_format_kwargs: object,
)

Source from the content-addressed store, hash-verified

307
308
309def format_name_with_dist_and_time(
310 format_str: str,
311 run_name: str,
312 timestamp: Timestamp,
313 **extra_format_kwargs: object,
314): # noqa: D103
315 formatted_str = partial_format(
316 format_str,
317 run_name=run_name,
318 epoch=int(timestamp.epoch),
319 batch=int(timestamp.batch),
320 batch_in_epoch=int(timestamp.batch_in_epoch),
321 sample=int(timestamp.sample),
322 sample_in_epoch=int(timestamp.sample_in_epoch),
323 token=int(timestamp.token),
324 token_in_epoch=int(timestamp.token_in_epoch),
325 total_wct=timestamp.total_wct.total_seconds(),
326 epoch_wct=timestamp.epoch_wct.total_seconds(),
327 batch_wct=timestamp.batch_wct.total_seconds(),
328 **_get_dist_config(strict=False),
329 **extra_format_kwargs,
330 )
331 return formatted_str
332
333
334format_name_with_dist_and_time.__doc__ = f"""\

Callers 9

formatMethod · 0.90
get_save_filenameFunction · 0.90
oom_observerMethod · 0.90
_save_checkpointMethod · 0.90
batch_endMethod · 0.90
handler_fnMethod · 0.90
save_checkpoint_to_diskFunction · 0.90

Calls 2

partial_formatFunction · 0.90
_get_dist_configFunction · 0.85

Tested by 1