Skip to content

Commit

Permalink
update ckpt conversion flow to use the new sharded ckpt path structure (
Browse files Browse the repository at this point in the history
  • Loading branch information
5cp authored Nov 21, 2023
1 parent 1a1d801 commit 99f080f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions optimum/neuron/distributed/checkpointing.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ def consolidate_tensor_parallel_checkpoints(checkpoint_dir: Union[str, Path]) ->

state_dicts = []

for sharded_checkpoint in checkpoint_dir.glob("tp_rank_*"):
for sharded_checkpoint in sorted(checkpoint_dir.glob("tp_rank_*/checkpoint.pt")):
if not sharded_checkpoint.is_file():
continue
state_dicts.append(torch.load(sharded_checkpoint))

state_dicts = sorted(state_dicts, key=lambda d: d["tp_rank"])

parameter_names = state_dicts[0]["model"].keys()
sharded_metadatas = {
name: [
Expand Down

0 comments on commit 99f080f

Please sign in to comment.