Skip to content

feat: support beam generation for vision and audio models - #1815

Open
justsml wants to merge 26 commits into
huggingface:mainfrom
justsml:t3/multimodal-generation
Open

justsml wants to merge 26 commits into
huggingface:mainfrom
justsml:t3/multimodal-generation

Conversation

@justsml

@justsml justsml commented Oct 22, 2026 •

Copy link
Copy Markdown

Adds beam generation for Llava, Idefics3/SmolVLM, Qwen2VL images, and Ultravox audio. Depends on #1539; this draft targets main until the beam-search foundation merges.

Image/audio features are prepared once per original input before beam expansion. Generation preserves each model's position and cache axes, supports caller-prepared embeddings and cache continuation, and releases internally owned tensors on success and failure. Unsupported model/modality combinations and ambiguous cached-image inputs fail explicitly.

The Qwen image-processor change belongs to #1812 and is not included here. Multi-image generation accepts correctly preprocessed patch tensors and image grids; raw multi-image processing still requires that fix. Ultravox batching requires equal audio feature counts.

Validation:

  • Full workspace suite: 2,331 passed, 47 skipped, 33 suites passed.
  • Both packages and TypeScript declarations build; docs generation and changed-file checks pass.
  • Real tiny Llava, Idefics3, and Qwen tests cover batching, ragged image groups, cache continuation, prepared embeddings, diverse search, and seeded beam sampling.
  • Earlier tests of the generation implementation passed NVIDIA CUDA fp32 with SmolVLM/Ultravox and Qwen WebGPU fp32 on RTX 4090 and Apple M2. These hardware runs predate the processor-scope cleanup; final validation of this submission is the CPU suite above.

AMD validation remains incomplete. fp16 batched/individual outputs can diverge for SmolVLM and Ultravox, and some CUDA operators fall back to CPU; this PR does not claim universal precision or backend parity.

Changes specific to this follow-up.

Related PRs:

Related issues:

justsml and others added 26 commits April 27, 2026 19:00

This branch has not been deployed

No deployments
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.

1 participant