Skip to content

Commit 78503c3

Browse files
committed
Add native LLaVA-OneVision-1.5 model support
Port OV1.5 to the current Transformers model and configuration APIs, reusing shared Qwen components through modular generation. Register native Auto classes and legacy checkpoint conversions, and add model documentation and generation, training and frame-isolation tests. Visual export integration is provided in the following commit.
1 parent 1a55add commit 78503c3

16 files changed

Lines changed: 1957 additions & 0 deletions

‎docs/source/en/_toctree.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,8 @@
14471447
title: LLaVa-NeXT-Video
14481448
- local: model_doc/llava_onevision
14491449
title: LLaVA-Onevision
1450+
- local: model_doc/llava_onevision1_5
1451+
title: LLaVA-OneVision-1.5
14501452
- local: model_doc/lxmert
14511453
title: LXMERT
14521454
- local: model_doc/matcha
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
2+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
3+
the License. You may obtain a copy of the License at
4+
http://www.apache.org/licenses/LICENSE-2.0
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
6+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
7+
specific language governing permissions and limitations under the License.
8+
⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
9+
rendered properly in your Markdown viewer.
10+
-->
11+
*This model was contributed to Hugging Face Transformers on 2026-10-22.*
12+
13+
# LLaVA-OneVision-1.5
14+
15+
LLaVA-OneVision-1.5 was introduced in [LLaVA-OneVision-1.5: Fully Open Framework for Democratized Multimodal Training](https://huggingface.co/papers/2509.23661).
16+
It combines a native resolution vision encoder with a Qwen3 language backbone. The vision encoder adds a learned class token to each image, applies full attention, removes the class token, and merges spatial patches into visual features for the language model. The language backbone uses ordinary one dimensional rotary positions for the combined image and text sequence.
17+
18+
The implementation reuses the Qwen2.5-VL processor and supports the converted [4B checkpoint](https://huggingface.co/Deep-VLM/LLaVA-OneVision-1.5-4B-Instruct-hf). Use left padding for batched generation.
19+
20+
## Abstract
21+
22+
The [paper's abstract](https://arxiv.org/abs/2509.23661) describes an open framework for training vision-language models from scratch at a reduced cost. Its release includes a concept-balanced collection of 85 million pretraining examples, a curated instruction dataset containing 22 million examples, and a training system that uses offline parallel packing. The authors report a training budget of $16,000. In their evaluation, the 8B model exceeds Qwen2.5-VL-7B on 18 out of 27 benchmarks, while the 4B model exceeds Qwen2.5-VL-3B on all 27. The report also describes a lightweight reinforcement learning stage that improves multimodal reasoning through chain-of-thought responses.
23+
24+
## Usage
25+
26+
```python
27+
from transformers import AutoProcessor, LlavaOnevision15ForConditionalGeneration
28+
29+
model_id = "Deep-VLM/LLaVA-OneVision-1.5-4B-Instruct-hf"
30+
processor = AutoProcessor.from_pretrained(model_id)
31+
model = LlavaOnevision15ForConditionalGeneration.from_pretrained(model_id, device_map="auto")
32+
messages = [{"role": "user", "content": [
33+
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"},
34+
{"type": "text", "text": "Describe the image."},
35+
]}]
36+
inputs = processor.apply_chat_template(
37+
messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt"
38+
).to(model.device)
39+
output = model.generate(**inputs, max_new_tokens=64)
40+
processor.batch_decode(output[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)
41+
```
42+
43+
## LlavaOnevision15Config
44+
45+
[[autodoc]] LlavaOnevision15Config
46+
47+
## LlavaOnevision15VisionConfig
48+
49+
[[autodoc]] LlavaOnevision15VisionConfig
50+
51+
## LlavaOnevision15VisionModel
52+
53+
[[autodoc]] LlavaOnevision15VisionModel
54+
- forward
55+
56+
## LlavaOnevision15Model
57+
58+
[[autodoc]] LlavaOnevision15Model
59+
- forward
60+
61+
## LlavaOnevision15ForConditionalGeneration
62+
63+
[[autodoc]] LlavaOnevision15ForConditionalGeneration
64+
- forward

‎src/transformers/conversion_mapping.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ def _build_checkpoint_conversion_mapping():
183183
WeightRenaming(r"\.mlp\.up_proj\.", ".mlp.fc1."),
184184
WeightRenaming(r"\.mlp\.down_proj\.", ".mlp.fc2."),
185185
],
186+
"llava_onevision1_5": [
187+
WeightRenaming(r"merger\.mlp\.0\.", "merger.fc1."),
188+
WeightRenaming(r"merger\.mlp\.2\.", "merger.fc2."),
189+
WeightRenaming(r"^visual\.", "model.visual."),
190+
WeightRenaming(r"^model\.(?!language_model\.|visual\.)", "model.language_model."),
191+
],
186192
"inkling_mm_model": [
187193
WeightRenaming(source_patterns=r"model\.llm\.layers", target_patterns=r"model.language_model.layers"),
188194
WeightRenaming(

‎src/transformers/models/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
from .llava_next import *
276276
from .llava_next_video import *
277277
from .llava_onevision import *
278+
from .llava_onevision1_5 import *
278279
from .longcat_flash import *
279280
from .longformer import *
280281
from .longt5 import *

‎src/transformers/models/auto/auto_mappings.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@
382382
("llava_next", "LlavaNextConfig"),
383383
("llava_next_video", "LlavaNextVideoConfig"),
384384
("llava_onevision", "LlavaOnevisionConfig"),
385+
("llava_onevision1_5", "LlavaOnevision15Config"),
386+
("llava_onevision1_5_vision", "LlavaOnevision15VisionConfig"),
385387
("longcat_flash", "LongcatFlashConfig"),
386388
("longformer", "LongformerConfig"),
387389
("longt5", "LongT5Config"),
@@ -931,6 +933,7 @@
931933
("lasr_encoder", "lasr"),
932934
("llama4_text", "llama4"),
933935
("llama4_vision_model", "llama4"),
936+
("llava_onevision1_5_vision", "llava_onevision1_5"),
934937
("lw_detr_vit", "lw_detr"),
935938
("maskformer-swin", "maskformer"),
936939
("megatron-bert", "megatron_bert"),

‎src/transformers/models/auto/image_processing_auto.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
("layoutxlm", {"torchvision": "LayoutLMv2ImageProcessor", "pil": "LayoutLMv2ImageProcessorPil"}),
114114
("lighton_ocr", {"torchvision": "PixtralImageProcessor", "pil": "PixtralImageProcessorPil"}),
115115
("llava_next_video", {"torchvision": "LlavaNextImageProcessor", "pil": "LlavaNextImageProcessorPil"}),
116+
("llava_onevision1_5", {"torchvision": "Qwen2VLImageProcessor", "pil": "Qwen2VLImageProcessorPil"}),
116117
("lw_detr", {"torchvision": "DeformableDetrImageProcessor", "pil": "DeformableDetrImageProcessorPil"}),
117118
("metaclip_2", {"torchvision": "CLIPImageProcessor", "pil": "CLIPImageProcessorPil"}),
118119
("mgp-str", {"torchvision": "ViTImageProcessor", "pil": "ViTImageProcessorPil"}),

‎src/transformers/models/auto/modeling_auto.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ class _BaseModelWithGenerate(PreTrainedModel, GenerationMixin):
318318
("llava_next", "LlavaNextModel"),
319319
("llava_next_video", "LlavaNextVideoModel"),
320320
("llava_onevision", "LlavaOnevisionModel"),
321+
("llava_onevision1_5", "LlavaOnevision15Model"),
322+
("llava_onevision1_5_vision", "LlavaOnevision15VisionModel"),
321323
("longcat_flash", "LongcatFlashModel"),
322324
("longformer", "LongformerModel"),
323325
("longt5", "LongT5Model"),
@@ -1183,6 +1185,7 @@ class _BaseModelWithGenerate(PreTrainedModel, GenerationMixin):
11831185
("llava_next", "LlavaNextForConditionalGeneration"),
11841186
("llava_next_video", "LlavaNextVideoForConditionalGeneration"),
11851187
("llava_onevision", "LlavaOnevisionForConditionalGeneration"),
1188+
("llava_onevision1_5", "LlavaOnevision15ForConditionalGeneration"),
11861189
("minicpmv4_6", "MiniCPMV4_6ForConditionalGeneration"),
11871190
("minicpmv4_7", "MiniCPMV4_7ForConditionalGeneration"),
11881191
("minimax_m3_vl", "MiniMaxM3SparseForConditionalGeneration"),

‎src/transformers/models/auto/processing_auto.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
("inkling_mm_model", "InklingProcessor"),
6969
("lasr_ctc", "LasrProcessor"),
7070
("lasr_encoder", "LasrProcessor"),
71+
("llava_onevision1_5", "Qwen2_5_VLProcessor"),
7172
("metaclip_2", "CLIPProcessor"),
7273
("mistral3", "PixtralProcessor"),
7374
("mm-grounding-dino", "GroundingDinoProcessor"),

‎src/transformers/models/auto/tokenization_auto.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
("led", "LEDTokenizer" if is_tokenizers_available() else None),
188188
("lighton_ocr", "Qwen2TokenizerFast" if is_tokenizers_available() else None),
189189
("lilt", "RobertaTokenizer" if is_tokenizers_available() else None),
190+
("llava_onevision1_5", "Qwen2Tokenizer" if is_tokenizers_available() else None),
190191
("longformer", "RobertaTokenizer" if is_tokenizers_available() else None),
191192
("luke", "LukeTokenizer"),
192193
("lxmert", "LxmertTokenizer" if is_tokenizers_available() else None),

‎src/transformers/models/auto/video_processing_auto.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
("exaone4_5", {"torchvision": "Qwen2VLVideoProcessor"}),
6161
("hyperclovax_vision_v2", {"torchvision": "Qwen2VLVideoProcessor"}),
6262
("instructblip", {"torchvision": "InstructBlipVideoVideoProcessor"}),
63+
("llava_onevision1_5", {"torchvision": "Qwen2VLVideoProcessor"}),
6364
("minicpmv4_7", {"torchvision": "MiniCPMV4_6VideoProcessor"}),
6465
("muse_spark", {"torchvision": "MuseGlimmerVideoProcessor"}),
6566
("pe_audio_video", {"torchvision": "PeVideoVideoProcessor"}),

0 commit comments

Comments
 (0)