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

Error if device mesh specified in fsdp config #3580

Merged
merged 10 commits into from
Aug 27, 2024

Conversation

snarayan21
Copy link
Contributor

What does this PR do?

Ensures that we throw value error if device mesh is directly specified in the fsdp config. We want users to more to the more descriptive, less confusing data_parallel_shard_degree and data_parallel_replicate_degree instead. Adding this error prevents users from accidentally configuring their parallelism differently than the device mesh would indicate -- we won't allow for directly specifying device mesh at all.

Basically changes the warning / warning test removed in #3570 to error / error test.

What issue(s) does this change relate to?

Before submitting

  • Have you read the contributor guidelines?
  • Is this change a documentation change or typo fix? If so, skip the rest of this checklist.
  • Was this change discussed/approved in a GitHub issue first? It is much more likely to be merged if so.
  • Did you update any related docs and document your change?
  • Did you update any related tests and add any new tests related to your change? (see testing)
  • Did you run the tests locally to make sure they pass?
  • Did you run pre-commit on your change? (see the pre-commit section of prerequisites)

Copy link
Contributor

@dakinggg dakinggg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems fine to me, so approving. But wondering if it would be a bit easier to make FSDPConfig take in a device_mesh arg and just raise if it is specified. That way you don't have to put the error in multiple places

@snarayan21
Copy link
Contributor Author

snarayan21 commented Aug 27, 2024

@dakinggg I wanted to only error in the case where we used to throw the deprecation warning so this won't break users workflows without prior notice. For example, if someone explicitly creates an FSDPConfig object and passes that to the trainer, that wasn't marked as deprecated and we shouldn't error. We should only error for the deprecation path, which was for dict fsdp config + dict parallelism config (this covers foundry case). lmk if you disagree

taking out the error on _shard_with_fsdp, mistakenly left that in

Copy link
Contributor

@mvpatel2000 mvpatel2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only want to set device mesh in state.py, so I agree with Daniel lets just check in constructor?

@snarayan21
Copy link
Contributor Author

@mvpatel2000 made that change, modified init to still throw informative error for user

composer/utils/parallelism.py Outdated Show resolved Hide resolved
@snarayan21 snarayan21 enabled auto-merge (squash) August 27, 2024 16:14
@snarayan21 snarayan21 merged commit 4e6606e into main Aug 27, 2024
14 checks passed
@snarayan21 snarayan21 deleted the saaketh/error_device_mesh branch August 27, 2024 18:41
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

Successfully merging this pull request may close these issues.

4 participants