Skip to content

🔮 Native VLM support for SFTTrainer#3862

Merged
qgallouedec merged 45 commits intomainfrom
native-vlm-support
Aug 13, 2025
Merged

🔮 Native VLM support for SFTTrainer#3862
qgallouedec merged 45 commits intomainfrom
native-vlm-support

Conversation

@qgallouedec
Copy link
Copy Markdown
Member

@qgallouedec qgallouedec commented Aug 7, 2025

from trl import SFTConfig, SFTTrainer
from datasets import load_dataset

trainer = SFTTrainer(
    model="Qwen/Qwen2.5-VL-3B-Instruct",
    args=SFTConfig(max_length=None),
    train_dataset=load_dataset("trl-lib/llava-instruct-mix", split="train"),
)
trainer.train()

all CI failures unrelated

@HuggingFaceDocBuilderDev
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.

Comment thread trl/trainer/sft_trainer.py Outdated
Copy link
Copy Markdown
Contributor

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

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

are we still going to use sft_vlm.py? if so, AutoModelForVision2Seq is no longer a valid class, it's actually not used at all, I think most models are migrated to AutoModelForImageTextToText

@sergiopaniego
Copy link
Copy Markdown
Member

I'd aim to remove them all if possible.
Second part is covered in #3836 😄

@qgallouedec qgallouedec changed the title 🔮 Native VLM support for SFTTrainer 🔮 [WIP] Native VLM support for SFTTrainer Aug 7, 2025
Copy link
Copy Markdown
Contributor

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

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

PR is good, also tested on multiple models

only me running on accelerate didn't work well but it might be me lol

Comment thread scripts/generate_tiny_models.py Outdated
Comment thread docs/source/sft_trainer.md Outdated
Comment thread trl/trainer/sft_trainer.py
Comment thread trl/trainer/sft_trainer.py
@qgallouedec qgallouedec merged commit 44e6c15 into main Aug 13, 2025
10 of 11 checks passed
@qgallouedec qgallouedec deleted the native-vlm-support branch August 13, 2025 03:43
LuisVasquezBSC pushed a commit to langtech-bsc/trl that referenced this pull request Aug 28, 2025
Co-authored-by: Sergio Paniego Blanco <sergiopaniegoblanco@gmail.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
LuisVasquezBSC pushed a commit to langtech-bsc/trl that referenced this pull request Aug 28, 2025
Co-authored-by: Sergio Paniego Blanco <sergiopaniegoblanco@gmail.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
SamY724 pushed a commit to SamY724/trl that referenced this pull request Sep 6, 2025
Co-authored-by: Sergio Paniego Blanco <sergiopaniegoblanco@gmail.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.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.

5 participants