Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSDP sharding_strategy parameter fails with KeyError when passed as string #809

Open
1 of 2 tasks
junuMoon opened this issue Dec 5, 2024 · 1 comment
Open
1 of 2 tasks

Comments

@junuMoon
Copy link

junuMoon commented Dec 5, 2024

System Info

PyTorch version: 2.1.0
Python version: 3.10
OS: Ubuntu 22.04

Information

  • The official example scripts
  • My own modified scripts

🐛 Describe the bug

When passing sharding_strategy as a command line argument to FSDP config, it fails with a KeyError because the string value is not properly converted to ShardingStrategy enum.

Running with --fsdp_config.sharding_strategy "FULL_SHARD" results in:

KeyError: 'FULL_SHARD'

Error logs

Traceback (most recent call last):
  File "finetuning.py", line 272, in main
    model = FSDP(
  ...
  File "torch/distributed/fsdp/_init_utils.py", line 652, in _init_param_handle_from_params
    SHARDING_STRATEGY_MAP[state.sharding_strategy],
KeyError: 'FULL_SHARD'

Expected behavior

The string value "FULL_SHARD" should be converted to ShardingStrategy.FULL_SHARD enum when updating the config.

@vz-2244
Copy link

vz-2244 commented Dec 21, 2024

Same issue here. Any suggestion about how to change the FSDP config from command line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants