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

Wrong Code in the FSDP blog #1380

Open
Luosuu opened this issue May 6, 2023 · 1 comment
Open

Wrong Code in the FSDP blog #1380

Luosuu opened this issue May 6, 2023 · 1 comment

Comments

@Luosuu
Copy link

Luosuu commented May 6, 2023

📚 Documentation

In the blog introducing FSDP API

fsdp_model = FullyShardedDataParallel(
   model(),
   fsdp_auto_wrap_policy=default_auto_wrap_policy,
   cpu_offload=CPUOffload(offload_params=True),
)

it should be model instead of model() inside FullyShardedDataParallel

so it should be

fsdp_model = FullyShardedDataParallel(
   model,
   fsdp_auto_wrap_policy=default_auto_wrap_policy,
   cpu_offload=CPUOffload(offload_params=True),
)
@nairbv
Copy link

nairbv commented Nov 9, 2023

It looks a little confusing and maybe could be written more clearly, but I think that's actually correct. If it was just model, it would be trying to FSDP-wrap the DDP model. By using model(), it's FSDP wrapping a new model instance.

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