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

Z3: optimizations for grad norm calculation and gradient clipping #5504

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nelyahu
Copy link
Contributor

@nelyahu nelyahu commented May 7, 2024

This PR add the below functionality:

  1. complete_grad_norm_calculation_for_cpu_offload: move total_norm to CPU, as expected device in such case is CPU..
  2. repalce get_global_norm() with torch.linalg.norm for better performance.
  3. unscale_and_clip_grads: replace clipping based on if statement to use torch.clamp for better performance.

change (3) is taken from #5547 (which was closed)

@jomayeri
Copy link
Contributor

Changing this line has been associated with several bugs #5422, #5538

@nelyahu nelyahu changed the title z3 scaled_global_grad_norm: repalce get_global_norm with torch.norm Z3: optimizations for grad norm calculation and gradient clipping May 27, 2024
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.

None yet

5 participants