FormattedCheckpointFiles¶
- class torchtune.training.FormattedCheckpointFiles(filename_format: str, max_filename: str)[source]¶
This class gives a more concise way to represent a list of filenames of the format
file_{i}_of_{n_files}.pth
.- Parameters:
- build_checkpoint_filenames()[source]¶
Builds a list of checkpoint filenames from the filename format and max filename.
- Returns:
List of checkpoint filenames.
- Return type:
List[str]
Example
>>> # Example usage >>> f = FormattedCheckpointFiles(filename_format="file_{}_of_{}.safetensors", max_filename="00003") >>> f.build_checkpoint_filenames() >>> ['file_00001_of_00003.safetensors', 'file_00002_of_00003.safetensors', 'file_00003_of_00003.safetensors']