8000 [DCP][state_dict] Remove the check of FSDP has root · pytorch/pytorch@0a21915 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a21915

Browse files
committed
[DCP][state_dict] Remove the check of FSDP has root
Root may not exist due to FSDP lazy initialization. [ghstack-poisoned]
1 parent ade614a commit 0a21915

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

torch/distributed/checkpoint/state_dict.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,9 @@ def _verify_state_dict(
279279
optim_state_dict: OptimizerStateType,
280280
info: _StateDictInfo,
281281
) -> None:
282-
# FSDP root must exist otherwise FSDP state_dict will be incorrect.
283-
has_fsdp_root = False
284282
for module in info.fsdp_modules:
285283
fsdp_state = _get_module_fsdp_state_if_fully_sharded_module(module)
286284
assert fsdp_state is not None, "Expected a fsdp_state with a fsdp module."
287-
if fsdp_state._is_root:
288-
has_fsdp_root = True
289-
break
290-
if info.fsdp_modules and not has_fsdp_root:
291-
raise RuntimeError("The model has FSDP modules but no FSDP root module exists.")
292285

293286
# Verify if the model_state_dict and optim_state_dict are valid. This API
294287
# should give the users an explicit error message to debug or report.

0 commit comments

Comments
 (0)
0