MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / get_checkpoint_name

Function get_checkpoint_name

codegeex/megatron/checkpointing.py:82–101  ·  view source on GitHub ↗

A unified checkpoint name.

(checkpoints_path, iteration, release=False)

Source from the content-addressed store, hash-verified

80
81
82def 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
104def get_checkpoint_tracker_filename(checkpoints_path):

Callers 3

save_checkpointFunction · 0.85
load_checkpointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected