torchtune icon indicating copy to clipboard operation
torchtune copied to clipboard

add a "division by zero" check in chunked loss handling in kd_losses.py

Open insop opened this issue 10 months ago • 2 comments

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

insop avatar Jan 09 '25 04:01 insop

:link: Helpful Links

:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2239

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 (image): :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.

pytorch-bot[bot] avatar Jan 09 '25 04:01 pytorch-bot[bot]

@felipemello1 , @joecummings , PTAL

insop avatar Jan 09 '25 04:01 insop

Thank you @ebsmothers , updated the change.

insop avatar Jan 11 '25 01:01 insop