Skip to content

Commit

Permalink
fix empty state_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
DesmonDay committed Nov 6, 2024
1 parent 2f0b407 commit 16857c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions paddlenlp/trainer/unified_checkpoint/async_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ def _file_save_async_or_sync(
state_dict[k] = state_dict.pop(k).cpu().numpy()
safe_save_file(state_dict, path, metadata={"format": "np"})
else:
if len(state_dict.keys()) == 0:
saved_signal_path = os.path.join(signal_path, f".{state_dict_type}.done.{self.global_rank}")
paddle.save(self.global_rank, saved_signal_path)
return

if state_dict_type == "model_weight":
if self._shm_model_weight is None:
self._meta_dict_model, buffer_size = create_meta_dict(state_dict)
Expand Down

0 comments on commit 16857c1

Please sign in to comment.