Repository navigation
Conversation
Compute the default mean over the pointwise KL terms so its scale stays independent of the planned change to PyTorch’s KL reduction. Related to NVIDIA#1926, item 2. Signed-off-by: oj9o <imouza@msn.com>
Exercise the loss at a non-unit temperature and treat the PyTorch KL mean warning as an error in this regression. Signed-off-by: oj9o <imouza@msn.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Hi, I'd rather keep it passed through to Pytorch and use its default behavior rather than trying to preserve an outdated definition. But thank you! |
What does this PR do?
Type of change: Bug fix.
The default reduction in
LogitsDistillationLossaverages KL divergence over every element. PyTorch warns that itsmeanreduction will change to batch averaging. For logits shaped[batch, classes], that would multiply the loss and the student gradient by the number of classes.This change requests the pointwise KL terms and takes their mean explicitly for the default reduction. It preserves the existing training objective and leaves the other reductions on their current paths. Related to #1926, item 2.
Testing
git diff --checkpassed on the changed files.tests/unit/torch/distill/test_distill.pyfile could not collect locally because OmegaConf was unavailable in the test environment.Before your PR is ready for review
Additional information
OpenAI Codex assisted with the investigation, implementation, test design, and local validation.
Summary by CodeRabbit