A unified checkpoint name.
(checkpoints_path, iteration, release=False)
| 80 | |
| 81 | |
| 82 | def get_checkpoint_name(checkpoints_path, iteration, release=False): |
| 83 | """A unified checkpoint name.""" |
| 84 | if release: |
| 85 | directory = "" |
| 86 | else: |
| 87 | directory = f"global_step{iteration}" |
| 88 | # Use both the tensor and pipeline MP rank. |
| 89 | if mpu.get_pipeline_model_parallel_world_size() == 1: |
| 90 | return os.path.join( |
| 91 | checkpoints_path, |
| 92 | directory, |
| 93 | "mp_rank_{:02d}_model_states.pt".format(mpu.get_tensor_model_parallel_rank()), |
| 94 | ) |
| 95 | return os.path.join( |
| 96 | checkpoints_path, |
| 97 | directory, |
| 98 | "mp_rank_{:02d}_{:03d}_model_states.pt".format( |
| 99 | mpu.get_tensor_model_parallel_rank(), mpu.get_pipeline_model_parallel_rank() |
| 100 | ), |
| 101 | ) |
| 102 | |
| 103 | |
| 104 | def get_checkpoint_tracker_filename(checkpoints_path): |
no outgoing calls
no test coverage detected