Bug: `FSDPLoadPlanner` passes `strict` as the first positional argument to `DefaultLoadPlanner`
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 86/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- distributed-systems
Research direction
Start in bytecheckpoint/planner/fsdp/fsdp_planner.py and inspect FSDPLoadPlanner.init alongside the signature in bytecheckpoint/planner/default_planner.py. Reproduce the FSDPLoadPlanner(False) case and verify that strict follows the requested value while the flattening defaults remain unchanged.
Written by the indexing model from the issue text.
Description
Bug: FSDPLoadPlanner passes strict as the first positional argument to DefaultLoadPlanner
Description
There appears to be an argument-passing bug in FSDPLoadPlanner.__init__.
In:
# bytecheckpoint/planner/fsdp/fsdp_planner.py
class FSDPLoadPlanner(DefaultLoadPlanner):
def __init__(self, strict: bool):
super().__init__(strict)
strict is passed positionally to DefaultLoadPlanner.__init__.
However, the signature of DefaultLoadPlanner.__init__ is:
# bytecheckpoint/planner/default_planner.py
def __init__(
self,
flatten_state_dict: bool = True,
flatten_sharded_tensors: bool = True,
strict: bool = True,
) -> None:
Therefore:
FSDPLoadPlanner(False)
is effectively interpreted as:
DefaultLoadPlanner(
flatten_state_dict=False,
flatten_sharded_tensors=True,
strict=True,
)
instead of the expected:
DefaultLoadPlanner(
flatten_state_dict=True,
flatten_sharded_tensors=True,
strict=False,
)
Impact
This causes two unexpected behaviors:
strict=Falsedoes not actually disable strict loading.flatten_state_dictis unintentionally disabled.
For example:
planner = FSDPLoadPlanner(False)
print(planner.strict)
print(planner.flatten_state_dict)
Current behavior:
True
False
Expected behavior:
False
True
In our case, this causes optimizer checkpoint loading to fail because the planner still behaves as strict=True, with errors triggered by unmatched state-dict keys such as the top-level state entry.
Suggested Fix
Pass strict explicitly as a keyword argument:
class FSDPLoadPlanner(DefaultLoadPlanner):
def __init__(self, strict: bool):
super().__init__(strict=strict)
This preserves the default values of:
flatten_state_dict=True
flatten_sharded_tensors=True
while correctly forwarding the requested strict value.
Please let me know if you would like me to submit a PR for this fix.
- Dominant language
- Python
- Stars
- 290
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ByteDance-Seed/ByteCheckpoint
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
megatron-LM support? Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
ByteDance-Seed/ByteCheckpoint#4 · 2 comments · 3 reactions ·
All issues in ByteDance-Seed/ByteCheckpoint
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100