Repository navigation
feat(vlm): add LLaVA-OneVision image and video support - #3651
Merged
Merged
Conversation
Normalize Hugging Face weight names and load the SigLIP tower, GELU projector, image separator and Qwen2 decoder. Use the packed AnyRes dimensions to expand image placeholders and pool sampled video frames before scattering media into the prompt. Cover weight layouts, activation defaults, feature values, pooled clip boundaries, and interleaved media markers. Refs #2395
# Conflicts: # src/models/batched_decode_coverage_tests.rs
# Conflicts: # src/models/detection_tests.rs
Record the exercised CLI and server media paths and the decided-token regression produced by disabling AnyRes downsampling on small text.
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.
Changes
Verification
The 0.5B OV checkpoint ran on gfx1151 through the CLI and a local HTTP server. The focused suite passed all 31 tests, including the opt-in EOS regression against a real LLaVA 1.5 7B checkpoint. All 14 batched decode registry checks passed. The CLI exposed
llava_onevisionin its architecture listing. Formatting, environment documentation, compatibility manifest and MLX test guard checks passed.On a 1536×1152 image, the Rust and mlx-vlm 0.8.1 runs expanded identical prompt token IDs and agreed on all 32 teacher-forced top tokens, including all nine positions with a reference gap of at least two. Removing the image downsample alone made the feature scatter fail with 9,558 rows for 7,309 placeholders. Removing the corresponding prompt cap as well produced 9,570 prompt tokens in the control versus 7,321 in the baseline, and changed one of 32 top tokens on that photograph.
On a 2304×2304 image containing seven rows of five-digit groups in 13 px DejaVu Sans Mono, the processor selected 37 tiles. With default downsampling the Rust trace matched the mlx-vlm expanded prompt and disagreed on 1/125 top tokens and 0/15 decided positions. Raising the cap to 100 patches disabled downsampling, increased the prompt length from 7,394 to 27,158, and produced 67/125 disagreements including 2/15 decided positions. Both Rust runs used the same weights, image, transcription prompt and teacher-forced targets.
Generation samples
Single image
CLI output
HTTP output (48 completion tokens)
Two images
CLI output
HTTP output (47 completion tokens)
Three-frame video
CLI output
HTTP output (30 completion tokens)
Real-checkpoint runs used the 0.5B OV weights and the ROCm backend. The low-optimization server test binary used a 32 MiB Rust worker stack.
Closes #2395