Skip to content

Commit 82a3d84

Browse files
author
Boxiang Wang
committed
Fix safety issue
Signed-off-by: Boxiang Wang <boxiangw@oci-hsg-cs-001-vscode-01.cm.cluster>
1 parent af95c29 commit 82a3d84

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nemo/lightning/pytorch/strategies/megatron_strategy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,10 @@ def _save_fsdp_dtensor_common_state(self, state_dict, ckpt_dir):
11151115
torch.save(state_dict, os.path.join(ckpt_dir, "common.pt"))
11161116

11171117
def _load_fsdp_dtensor_common_state(self, ckpt_dir):
1118-
return torch.load(os.path.join(ckpt_dir, "common.pt"), weights_only=False)
1118+
# Note: set to weights_only=True for safety reason
1119+
# It should be switching to safetensor but NeMo is deprecated.
1120+
# Please use Megatron-Bridge for better checkpointing support.
1121+
return torch.load(os.path.join(ckpt_dir, "common.pt"))
11191122

11201123
def _load_fsdp_dtensor_checkpoint(self, path, sharded_state_dict, strict):
11211124
from torch.distributed.checkpoint import default_planner

0 commit comments

Comments
 (0)