Skip to content

Comments

[Liger] liger DPO support#2568

Merged
kashif merged 38 commits intomainfrom
liger-dpo
Jun 12, 2025
Merged

[Liger] liger DPO support#2568
kashif merged 38 commits intomainfrom
liger-dpo

Conversation

@kashif
Copy link
Collaborator

@kashif kashif commented Jan 14, 2025

What does this PR do?

Add support for Liger-kernel losses for the DPO Kernel

Needs: linkedin/Liger-Kernel#521

Peft support: #3065

@HuggingFaceDocBuilderDev

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
Copy link
Member

liger loss isn't compatible with ref precomputing right? If so we could add a warning or an error.

@VProv
Copy link

VProv commented Mar 26, 2025

@VProv VProv mentioned this pull request Mar 26, 2025
5 tasks
@kashif
Copy link
Collaborator Author

kashif commented Mar 26, 2025

@VProv, at the moment, I was having issues getting the same outputs/metrics with and without liger in the trainer.

@VProv
Copy link

VProv commented Mar 26, 2025

@VProv, at the moment, I was having issues getting the same outputs/metrics with and without liger in the trainer.

What setup are you using?

@vaibhavjindal
Copy link
Contributor

Hi, I am working on fixing the output/metrics issue.
Added a PR in liger-kernel: linkedin/Liger-Kernel#676

@vaibhavjindal
Copy link
Contributor

@kashif @qgallouedec can you please review the following PR which fixes the output/metrics issue? Thanks :)
#3346

@kashif
Copy link
Collaborator Author

kashif commented May 5, 2025

thanks @hanbyul-kim for the report

@vaibhavjindal
Copy link
Contributor

@kashif just wanted to circle back and see if we can merge this now? We wanted to try it out internally at Linkedin.

import wandb


def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decoder_start_token_id: int) -> torch.Tensor:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pad_token_id isn't used?



def shift_tokens_right(input_ids: torch.Tensor, decoder_start_token_id: int) -> torch.Tensor:
"""Shift input ids one token to the right, and pad with pad_token_id"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this docstring ain't accurate I think

@kashif kashif merged commit 53c4a7c into main Jun 12, 2025
11 checks passed
@kashif kashif deleted the liger-dpo branch June 12, 2025 10:25
LuisVasquezBSC pushed a commit to langtech-bsc/trl that referenced this pull request Aug 28, 2025
Co-authored-by: Quentin Gallouédec <quentin.gallouedec@huggingface.co>
Co-authored-by: Vaibhav Jindal <32337828+vaibhavjindal@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <gallouedec.quentin@gmail.com>
LuisVasquezBSC pushed a commit to langtech-bsc/trl that referenced this pull request Aug 28, 2025
Co-authored-by: Quentin Gallouédec <quentin.gallouedec@huggingface.co>
Co-authored-by: Vaibhav Jindal <32337828+vaibhavjindal@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <gallouedec.quentin@gmail.com>
SamY724 pushed a commit to SamY724/trl that referenced this pull request Sep 6, 2025
Co-authored-by: Quentin Gallouédec <quentin.gallouedec@huggingface.co>
Co-authored-by: Vaibhav Jindal <32337828+vaibhavjindal@users.noreply.github.com>
Co-authored-by: Quentin Gallouédec <gallouedec.quentin@gmail.com>
@qgallouedec qgallouedec mentioned this pull request Jan 16, 2026
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.

7 participants