Align Liger loss naming across core trainers#6243
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
This was referenced Jul 2, 2026
kashif
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Align Liger loss naming across core trainers.
This PR standardizes the naming of the Liger loss attribute in both the DPO and GRPO trainers, changing it from
liger_loss_fnorliger_grpo_lossto a consistentliger_loss. It also updates all references in the code and associated tests to use the new attribute name. This change improves code readability and maintainability by ensuring a single, clear attribute name is used throughout.Changes
Attribute renaming and code consistency
liger_grpo_lossandliger_loss_fntoliger_lossin bothtrl/trainer/grpo_trainer.pyandtrl/trainer/dpo_trainer.py, and updated all internal references accordingly.self.liger_lossinstead of the previous attribute names in both trainers.Test updates
tests/test_grpo_trainer.pyto useliger_lossinstead ofliger_grpo_loss.Note
Low Risk
Rename-only refactor across trainers and tests with no logic changes; any external code that referenced the old attribute names would break at import/runtime.
Overview
Standardizes how DPO and GRPO trainers expose the fused Liger loss module by using a single
liger_lossattribute instead ofliger_loss_fn(DPO) andliger_grpo_loss(GRPO).Initialization and forward paths in
dpo_trainer.pyandgrpo_trainer.pynow assign and callself.liger_losswith the sameLigerFusedLinear*instances as before. GRPO tests that mock or assert on the Liger module were updated to usetrainer.liger_loss.This is a naming-only change; loss computation and trainer behavior are unchanged.
Reviewed by Cursor Bugbot for commit 16d0d51. Bugbot is set up for automated code reviews on this repo. Configure here.