Skip to content

Use trl's guarded is_liger_kernel_available in DPOTrainer#6247

Merged
qgallouedec merged 2 commits into
mainfrom
align-dpo-liger-import
Jul 2, 2026
Merged

Use trl's guarded is_liger_kernel_available in DPOTrainer#6247
qgallouedec merged 2 commits into
mainfrom
align-dpo-liger-import

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Jul 2, 2026

Copy link
Copy Markdown
Member

Part of the effort to align DPOTrainer and KTOTrainer (experimental). #4786

DPOTrainer imported is_liger_kernel_available from transformers.utils, which only checks that liger is installed. Switched it to trl.import_utils.is_liger_kernel_available, which additionally enforces the minimum supported version (liger ≥ 0.8.0, LIGER_KERNEL_MIN_VERSION).

This matches KTOTrainer and GRPOTrainer, which already use the guarded version.

No behavior change beyond rejecting liger installs older than the supported minimum.


Note

Low Risk
Import-only alignment with existing TRL trainers; behavior changes only for liger versions below 0.8.0, which were previously allowed but may be unsupported.

Overview
DPOTrainer now imports is_liger_kernel_available from trl.import_utils instead of transformers.utils, matching KTOTrainer and GRPOTrainer.

TRL’s helper still requires liger_kernel to be installed, and additionally treats versions below 0.8.0 (LIGER_KERNEL_MIN_VERSION) as unavailable. That affects the conditional import of LigerFusedLinearDPOLoss and the use_liger_kernel=True guard in __init__: environments with an older liger install will no longer enable the fused Liger DPO path.

Reviewed by Cursor Bugbot for commit f952b95. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

bot-ci-comment Bot commented Jul 2, 2026

Copy link
Copy Markdown

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.

@qgallouedec qgallouedec merged commit e7ffa91 into main Jul 2, 2026
12 of 13 checks passed
@qgallouedec qgallouedec deleted the align-dpo-liger-import branch July 2, 2026 22:20
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.

2 participants