Skip to content

Add native PyTorch training loop with gradient clippingAdd native PyTorch training loop with gradient clipping (fixes #585)#626

Open
yashdivya5 wants to merge 1 commit into
huggingface:mainfrom
yashdivya5:fix/gradient-clipping-585
Open

Add native PyTorch training loop with gradient clippingAdd native PyTorch training loop with gradient clipping (fixes #585)#626
yashdivya5 wants to merge 1 commit into
huggingface:mainfrom
yashdivya5:fix/gradient-clipping-585

Conversation

@yashdivya5

Copy link
Copy Markdown

Fixes #585

The existing training.ipynb only demonstrates fine-tuning with the Trainer API.
This PR adds a native PyTorch training loop section that includes gradient clipping
via torch.nn.utils.clip_grad_norm_() to prevent exploding gradients.

Changes:

  • Added "Native PyTorch Training Loop with Gradient Clipping" section
  • Includes explanation of why gradient clipping is needed
  • max_norm=1.0 used as standard default with a tip on tuning it

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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.

Update Native PyTorch Fine-Tuning to Include gradient clipping

1 participant