torchtune
torchtune copied to clipboard
add a "division by zero" check in chunked loss handling in kd_losses.py
Context
What is the purpose of this PR? Is it to
- [ ] add a new feature
- [ ] fix a bug
- [ ] update tests and/or documentation
- [x] other (add a "division by zero" check in chunked loss handling in kd_losses.py)
Please link to any issues this PR addresses.
Changelog
What are the changes made in this PR?
- add a "division by zero" check in chunked loss handling in kd_losses.py (Issue https://github.com/pytorch/torchtune/issues/2225)
Test plan
Please make sure to do each of the following if applicable to your PR. If you're unsure about any one of these just ask and we will happily help. We also have a contributing page for some guidance on contributing.
- [x] run pre-commit hooks and linters (make sure you've first installed via
pre-commit install) - [x] add unit tests for any new functionality
- [ ] update docstrings for any new or updated methods or classes
- [x] run unit tests via
pytest tests - [x] run
pytest -v tests/torchtune/modules/loss/test_kd_losses.py - [ ] run recipe tests via
pytest tests -m integration_test - [ ] manually run any new or modified recipes with sufficient proof of correctness
- [ ] include relevant commands and any other artifacts in this summary (pastes of loss curves, eval results, etc.)
UX
If your function changed a public API, please add a dummy example of what the user experience will look like when calling it. Here is a docstring example and a tutorial example
- [x] I did not change any public API
- [ ] I have added an example to docs or docstrings
:link: Helpful Links
:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2239
- :page_facing_up: Preview Python docs built from this PR
Note: Links to docs will display an error until the docs builds have been completed.
:white_check_mark: No Failures
As of commit f5befaff0dcf921f2b04e63122acbd382fc8fe81 with merge base c1522489cbcbcaf1f06a350c8ed1b0739d19bab3 ():
:green_heart: Looks good so far! There are no failures yet. :green_heart:
This comment was automatically generated by Dr. CI and updates every 15 minutes.
@felipemello1 , @joecummings , PTAL
Thank you @ebsmothers , updated the change.