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

Modularize zero step function and make it customizable #7233

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

karakusc
Copy link
Contributor

Refactor and (slightly) generalize step function of the zero redundancy optimizer, by breaking it into the following three high-level steps:

  1. _reduce_gradients
  2. _clip_grad_norm
  3. _update_parameters
    This makes it easier to sub-class and override specific behaviors of the zero optimizer in different contexts.

In addition, we introduce an additional optional parameter sharding_scheme, which allows us to customize steps 1 and 3 above, if needed.

@JackCaoG JackCaoG requested a review from jeffhataws June 10, 2024 22:22
Comment on lines 331 to 337
¦ return [
¦ ¦ {
¦ ¦ ¦ "scale_factor": 1.0,
¦ ¦ ¦ "sharding_group": self.sharding_groups,
¦ ¦ ¦ "group_size": self.local_world_size,
¦ ¦ },
¦ ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

you seems to copy some formatter metadata in the pr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, removed

@jeffhataws jeffhataws requested a review from hgt312 June 10, 2024 22:48
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.

3 participants