Skip to content

Conversation

dhruvmullick
Copy link
Contributor

@dhruvmullick dhruvmullick commented Jun 27, 2025

What does this PR do?

Addresses #3659
Will allow logging a table with eval generations when generate_during_eval is enabled for the DPO Trainer

Tested with a DPO run

Who can review?

@qgallouedec

Minimal script for testing;

from datasets import load_dataset
from trl import DPOConfig, DPOTrainer
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B-Instruct")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-0.5B-Instruct")
train_dataset = load_dataset("trl-lib/ultrafeedback_binarized", split="train[:100]")

training_args = DPOConfig(output_dir="Qwen2-0.5B-DPO", generate_during_eval=True, logging_steps=1, report_to="mlflow")

trainer = DPOTrainer(model=model, args=training_args, processing_class=tokenizer, train_dataset=train_dataset)
trainer.train()

then running by;

accelerate launch train.py

@dhruvmullick dhruvmullick marked this pull request as ready for review June 27, 2025 22:32
@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.

@shirinyamani
Copy link
Member

shirinyamani commented Jul 2, 2025

Hi @dhruvmullick thank, and sure if you need the mlflow logging! I've added minimal script on how to test it below;

@shirinyamani shirinyamani self-requested a review July 2, 2025 20:39
Copy link
Member

@shirinyamani shirinyamani left a comment

Choose a reason for hiding this comment

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

adding the scrpit to the description for future reference

@shirinyamani shirinyamani self-requested a review July 2, 2025 20:40
@shirinyamani shirinyamani merged commit 90cdf96 into huggingface:main Jul 2, 2025
9 of 10 checks passed
@dhruvmullick dhruvmullick deleted the add-mlflow-dpotrainer branch July 2, 2025 20:47
@dhruvmullick
Copy link
Contributor Author

Awesome, thanks for the review and the fixes! @shirinyamani

marcandrelarochelle pushed a commit to marcandrelarochelle/trl that referenced this pull request Jul 29, 2025
…e#3660)

Co-authored-by: Shirin Yamani <75791599+shirinyamani@users.noreply.github.com>
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.

3 participants