fix(training): support VL models in standard transformers fallback#18
Merged
fix(training): support VL models in standard transformers fallback#18
Conversation
Auto-detect vision-language models (Qwen2-VL, Qwen2.5-VL) and use the appropriate model class instead of always using AutoModelForCausalLM. Detection criteria: - "VL" in model name (case-insensitive) - "vision" in model name - vision_config attribute in model config Model class selection: - VL models: Qwen2VLForConditionalGeneration (with AutoModelForVision2Seq fallback) - Text-only models: AutoModelForCausalLM Also sets task_type to SEQ_2_SEQ_LM for VL models in LoRA config. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… assistant_only_loss - Add RuntimeError and TypeError to exception handling in _load_standard_model() to catch errors when loading Qwen2.5-VL with Qwen2VLForConditionalGeneration - Disable assistant_only_loss in standard TRL config as it's not supported for VL models yet Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
abrichr
added a commit
that referenced
this pull request
Jan 29, 2026
Includes VL model support fix (PR #18): - Auto-detect VL models and use correct model class - Handle Qwen2VLForConditionalGeneration properly - Set assistant_only_loss=False for VL models Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
_load_standard_model()to auto-detect vision-language models and use the correct model classAutoModelForCausalLM, which fails for VL models like Qwen2-VL and Qwen2.5-VLvision_configattributeQwen2VLForConditionalGenerationfor Qwen VL models (withAutoModelForVision2Seqfallback)task_typetoSEQ_2_SEQ_LMfor VL modelsTest plan
Qwen/Qwen2-VL-7B-Instructrecommended🤖 Generated with Claude Code