Skip to content

🚨 Add get_data_dependent_inputs: compute a forward's data-dependent inputs outside it - #50887

Open
IlyasMoutawwakil wants to merge 34 commits into
vision-getters-return-flatfrom
data-dependent-inputs
Open

IlyasMoutawwakil wants to merge 34 commits into
vision-getters-return-flatfrom
data-dependent-inputs

Conversation

@IlyasMoutawwakil

@IlyasMoutawwakil IlyasMoutawwakil commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

🤗 Transformers CI

What does this PR do?

🚨 Breaking: one public method is removed (see the Breaking table below).

Stacked on #50733 (flat get_image_embeddings / get_video_embeddings / get_audio_embeddings).

Many encoders compute part of their inputs with data-dependent operations: cu_seqlens and window indices from grid_thw, rotary positions, interpolation sizes, packing indices. These come from host syncs (.tolist(), .item()) and loops over items, so torch.compile(fullgraph=True) breaks and torch.export can't trace the encoder.

This adds get_data_dependent_inputs: a model method that returns those inputs, computed outside the forward. Passed back to the forward, they make the whole forward traceable with fullgraph=True.

inputs = processor(images=images, text=text, return_tensors="pt")
derived = model.get_data_dependent_inputs(**inputs)  # e.g. image_cu_seqlens, image_max_seqlen, image_position_ids, ...
compiled = torch.compile(model.get_image_embeddings, fullgraph=True)
image_embeds = compiled(inputs["pixel_values"], inputs["image_grid_thw"], **derived)
Aspect Behaviour
who has it towers with such inputs define it; MultimodalMixin gives the model and head a default that delegates to the base model ({} when it has none)
names a tower returns unprefixed names, the model prefixed ones (image_, video_, audio_), as its getters take them
what it reads the config and the inputs' values and shapes, never the weights, so it also works on the meta device
forwards unchanged in how they read these inputs: the existing helpers (get_vision_cu_seqlens, get_vision_position_ids, ...) take the precomputed value from kwargs or compute it, and get_data_dependent_inputs makes the same calls
generate computes them on the steps that carry the prompt's inputs, in prepare_inputs_for_generation

Models

The models that now define get_data_dependent_inputs, and what each one moves out of its forward. Their forwards read the precomputed value when it is passed and still compute it otherwise, so calling them without it works as before.

Models Precomputed
Qwen2-VL, Qwen2.5-VL (window attention), Qwen3-VL (interpolation), and through modular Qwen3.5(-MoE), Qwen3-VL-MoE, Qwen4-exp, Cohere Compass, Cosmos3 Omni, EXAONE 4.5, LFM3-VL, ... cu_seqlens, max_seqlen, rotary position_ids, window indices, interpolation taps
HunYuan-VL, Video-LLaMA 3, HyperCLOVAX Vision V2, GLM-4V family (GLM-4V, GLM-4V-MoE, GLM-4.6V, GLM-OCR, GLM-5-Next, GLM-Image), PaddleOCR-VL, Muse Glimmer / Spark, MiniCPM-V 4.6 / 4.7, Kimi K2.5 the same for their packed towers. HunYuan-VL reads its position table for all images at once and runs all merge blocks as one batch; Video-LLaMA 3's pixel unshuffle is one 4-tap gather
Pixtral, Mistral3, LightOnOCR, Mistral Large 4 each image's unpadded patches as one index, the block mask from the patch-to-image index, the patch merger's merge_index
LLaVA-NeXT, LLaVA-NeXT-Video, Granite 4 Vision, LLaVA-OneVision the patches each image was cut into and the packed features' layout (with image_newline; LLaVA-OneVision's anyres-max downscale as bilinear taps), so get_image_embeddings has no loop over images
Nemotron-H Omni (RADIO) the position table read with get_vision_interpolation_indices_and_weights (gains resize_to_longest_side), cls / register tokens and the pixel shuffle as gathers (get_vision_pixel_shuffle_index, moved to vision_utils)
Cosmos3 Edge the antialiased resize of the position table as a precomputed interpolation (get_vision_interpolation_indices_and_weights gains antialias, matching F.interpolate(antialias=True))
ERNIE 4.5-VL-MoE the resampler's temporal slicing, as one gather
Idefics2, Idefics3, SmolVLM, Molmo2 the real images' (Molmo2: the kept tokens') indices, instead of boolean-mask selection
Qwen2.5-Omni, Qwen3-Omni, MiniCPM-V 4.7 the M-RoPE position_ids on the prompt too
HY-V4-VL its merger layout, without begin and end tokens, as its merger lays it out
Emu3 image_token_index: each image's crop of the VQ token grid to its image_sizes, as a gather over the uncropped grids
Qwen2.5-Omni, Qwen3-Omni, Qwen3-ASR audio the chunking and the real-frame selection, as gathers instead of split(tolist()), pad_sequence and a boolean mask

Along the way: GLM-5-Next and Qwen4-exp's vision towers support flash attention; FunASR-Nano's adaptor owns its config, so it gets an attention implementation; RADIO declares its image modality; select_hidden_states finds its selection argument once instead of Signature.bind per call; TIPSv2's text pooling no longer upcasts bf16 to fp32; Nemotron-H Omni no longer reads the deprecated config.torch_dtype, whose warning broke the graph.

Exporters

prepare_for_export precomputes these inputs through the model's own get_data_dependent_inputs. This replaces the exporters' registry of per-encoder preparers (grid_thw towers, NaViT target_sizes, image_sizes, the Omni and Qwen3-ASR audio encoders) and its get_rope_index probe, about 245 lines.

Exports this enables, which were skipped:

Model Before Now
HunYuan-VL, HY-V4-VL skipped on every backend all torch.export tests pass
Cosmos3 Edge opted out of export tests all pass
GLM-5-Next opted out of export tests all pass, except multi-token dynamic generate with a static cache (generate.dynamic skip: the merged decode doesn't grow its indexer's padding mask)
GLM-Image skipped on every backend all pass, except static-cache generate (static-cache skip: its decode recomputes M-RoPE from the cache length)
Inkling opted out of export tests all pass, with no change needed

The first four join the exporter's chunked vision attention patch, which now also finds an o_proj and a scale.

Still failing or skipped:

Model Why
Nemotron-H Omni vision RADIO's attention keeps (1, heads, T, dim) states and num_attention_heads, which the chunked attention patch doesn't handle yet
Pixtral standalone vision the dynamo runner replays the program with the raw pixel_values and image_sizes, without the precomputed inputs it was traced with (as with the registry)

Test

test_model_forward_compile_fullgraph_with_data_dependent_inputs compiles the whole forward with fullgraph=True on these inputs and checks it matches eager. Packed encoders, those owning a module that takes cu_seqlens (get_packed_inputs_encoders), run flash attention in bf16 (atol=rtol=2e-2), whose varlen path takes the precomputed cu_seqlens; SDPA would loop over their items on the host. Models without any run in fp32 with their default attention (atol=rtol=1e-4). There is no official way yet for users to know which encoders are packed; the test reads it from the modules' signatures.

Skipped Why
Qwen4-exp its text attention's sparse indexer selects keys with nonzero
Step3p7 its experts opt out of use_experts_implementation (@no_inherit_decorator), so the eager loop over the experts hit runs
Apertus1.5 (vision, audio) images and clips are tokenized one by one at their own size, as padding would change their codes (its export tests opt out for the same reason)
GLM-Image its forward reshapes each image's features into a map for the image tokenizer, sized by its grid read on the host; the flat refactor in #50733's future work would fix it

Fixed along the way: Inkling2's vision tower kept cu_seqlens on CPU, so flash attention failed with or without compile.

Breaking

What Before After
Cosmos3 Edge resize_positional_embeddings (static method) resized the position table per image removed: the resize is a precomputed interpolation

Follow-ups

What How
packed processor outputs for the padded encoders (Idefics2/3, SmolVLM, Aria, the Whisper-style audio encoders) listed in #50733's Future work
SDPA on packed inputs call torch's varlen attention instead of looping over items, so packed encoders also trace on SDPA
Nemotron-H Omni vision export teach the chunked attention patch RADIO's layout
Pixtral standalone export have the dynamo runner pass the precomputed inputs

🤖 Generated with Claude Code

🤖 mlinter review state

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Model linter — first pass

transformers-mlinter found 3 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.

This is automated and advisory — it does not block merging.

rule count what it checks
TRF057 3 Public model, config, output and processor classes and their public methods must carry @auto_docstring.
2 item(s) outside this diff
  • src/transformers/models/hy_v4_vl/modular_hy_v4_vl.py:514 TRF057 — TRF057: HYV4VLModel.get_image_features in modeling_hy_v4_vl.py has no @auto_docstring. Declaring @can_return_tuple here drops every decorator of the parent method. Add @auto_docstring as the innermost decorator here.
  • src/transformers/models/hy_v4_vl/modular_hy_v4_vl.py:538 TRF057 — TRF057: HYV4VLModel.get_video_features in modeling_hy_v4_vl.py has no @auto_docstring. Declaring @can_return_tuple here drops every decorator of the parent method. Add @auto_docstring as the innermost decorator here.

@IlyasMoutawwakil
IlyasMoutawwakil force-pushed the data-dependent-inputs branch 2 times, most recently from 61125af to c6d7e3e Compare November 18, 2026 18:44
IlyasMoutawwakil and others added 2 commits November 18, 2026 20:20
- Pixtral, Mistral3, LightOnOCR: gather each image's patches and merge blocks with one index.
- LLaVA-NeXT(-Video): gather the patches and pack the features with one index; LLaVA-OneVision, Granite 4 Vision
  and DeepSeek-OCR2 get their own flat getter.
- RADIO / Nemotron-H Omni, HunYuan-VL / HY-V4-VL, Video-LLaMA 3, ERNIE 4.5-VL-MoE: position tables, pixel
  (un)shuffles, patch mergers and temporal slicing as gathers.
- Qwen2.5-Omni, Qwen3-Omni, Qwen3-ASR: audio chunking and frame selection as gathers.
- Index builders are pop-or-compute functions, reading a precomputed value from the forward's kwargs.
- select_hidden_states no longer binds the signature on every call.
- Fixes: TIPSv2's text pooling dtype, Nemotron-H Omni's deprecated torch_dtype read, MOSS-Transcribe-Diarize's
  get_audio_features wrapper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inputs a forward computes with data-dependent ops, computed outside it: passed back through the forward's
kwargs, they keep torch.compile(fullgraph=True) and torch.export free of host syncs. Towers return them
unprefixed, models prefixed by modality; generate computes them with the prompt's inputs. A common test compiles
each modality encoder with fullgraph=True on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IlyasMoutawwakil and others added 6 commits November 18, 2026 23:48
… data-dependent-inputs

GLM-Image's feature maps no longer carry the flat getter's split_sizes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… data-dependent-inputs

# Conflicts:
#	src/transformers/models/hunyuan_vl/modular_hunyuan_vl.py
#	src/transformers/models/llava_next_video/modeling_llava_next_video.py
#	src/transformers/models/llava_onevision/modeling_llava_onevision.py
#	src/transformers/models/muse_spark/modular_muse_spark.py
#	src/transformers/models/qwen3_5_moe/modeling_qwen3_5_moe.py
#	src/transformers/models/qwen4_exp/modeling_qwen4_exp.py
#	src/transformers/models/video_llama_3/modular_video_llama_3.py
IlyasMoutawwakil and others added 3 commits November 22, 2026 22:08
…ly where a model has it

The mixin reaches the base model's, so 40 head delegates go; models outside it keep their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge, pass them through the image getters

- Glm5Next: only the vision tower's inputs, its text model takes plain positions (it had no get_rope_index)
- HunYuan-VL: drop the packed text row of position_ids, compilable placeholder check
- Ernie: written out, super() reached the mixin's empty default in the generated file
- Cosmos3-Edge: the vision tower returns its cu_seqlens / max_seqlen
- Mistral3, Mistral-Large-4, LightOnOCR, LLaVA-NeXT(-Video), MiniCPM-V, HunYuan-VL: forward **kwargs to the image getter
- Simpler common encoder compile test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IlyasMoutawwakil and others added 9 commits November 23, 2026 17:36
…anite 4 Vision and Cosmos3 Edge traceable

- test_model_forward_compile_fullgraph_with_data_dependent_inputs replaces the per-encoder check: the whole
  forward compiles with fullgraph=True and matches eager, encoders on flash attention, text model on SDPA.
- Granite 4 Vision: LLaVA-NeXT's packing indices (with a grid_size) plus a patch index, one gather per group.
- Cosmos3 Edge: the antialiased position-table resize is a precomputed interpolation (vision_utils gains antialias).
- GLM-5-Next and Qwen4-exp vision towers support flash attention.
- FunASR-Nano: drop the head's get_data_dependent_inputs delegate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… data-dependent-inputs

# Conflicts:
#	src/transformers/modeling_multimodal_utils.py
#	src/transformers/models/moss_transcribe_diarize/modeling_moss_transcribe_diarize.py
#	src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py
#	src/transformers/models/qwen2_5_omni/modular_qwen2_5_omni.py
Under flash attention the vision encoder runs only the real patches, packed in one varlen sequence, and the
perceiver resampler runs varlen cross-attention over each image's real patches and latents. Outputs match the
padded path (padding is masked out downstream). get_data_dependent_inputs precomputes the real images' indices
and both packings, so the whole forward compiles with fullgraph=True.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
get_data_dependent_inputs returns the patches each image was cut into and its packed features as (index, weight)
taps into all patch tokens, the anyres_max bilinear downscale included, so get_image_embeddings has no per-image
loop and the whole forward compiles with fullgraph=True. Matches F.interpolate to 2e-9 in fp32.

The forward fullgraph test runs again on every model with get_data_dependent_inputs, its default included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lerance for the fullgraph forward test

Under flash attention the adapter pools only the tokens with patches to pool, each attending to its valid patches
as one varlen sequence, instead of a padded mask flash unpads with nonzero. get_data_dependent_inputs precomputes
that packing, so the whole forward compiles with fullgraph=True. Outputs match SDPA.

The fullgraph forward test compares in bf16 with atol=rtol=1e-2: compiled and eager differ by bf16 rounding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s a base model without get_data_dependent_inputs

get_data_dependent_inputs returns the real (non-padding) images' indices, which get_image_embeddings otherwise
selects with a boolean mask, so the image batch has a static size under torch.compile. SmolVLM only overrides
which images count as real (it keeps one when all are padding) instead of the whole getter.

The mixin's get_data_dependent_inputs returns {} when the base model has none (T5Gemma2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n their default attention

- is_packed_inputs_modality_encoder: an encoder is packed when one of its own modules takes `cu_seqlens`. Packed
  encoders run flash attention's varlen path (SDPA splits them per item on the host); everything else keeps its
  default attention, which takes padding masks with static shapes. The padded-flash skips are gone (FunASR keeps
  one: its adaptor's attention implementation is never set).
- Idefics2 and Molmo2 go back to their padded paths; only the real images (Idefics2) and the tokens with patches to
  pool (Molmo2) are precomputed.
- AudioFlamingo3's forward passes its kwargs to the audio getter again (Qwen3-ASR's precomputed cu_seqlens).
- RADIO declares its image modality.
- GraniteDocling, ModernVBERT, UltraVBERT regenerated from Idefics3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… encoders' sub-configs in one pass

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…M-V 4.7, HY-V4-VL's merger layout

- Qwen2.5-Omni / Qwen3-Omni thinker and MiniCPM-V 4.7: get_data_dependent_inputs returns the M-RoPE position_ids
  the forward otherwise computes with get_rope_index.
- HY-V4-VL: its getters take the precomputed inputs (accepts_precomputed_kwargs), and its vision model precomputes
  the merger layout without begin and end tokens, as its merger lays it out (the HunYuan-VL one it inherited
  indexed past the merger's output).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IlyasMoutawwakil and others added 2 commits November 24, 2026 17:34
Past the prompt the forward shifts the text positions by the cached rope_deltas, so get_data_dependent_inputs
only returns position_ids while the cache is empty (as exporters' decode captures and generate's later steps
would otherwise get prompt positions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lementation

The projector held the adaptor's encoder layers as a plain module, so no sub-model owned adaptor_config: its
attention implementation was never resolved (eager with a warning on every call, whatever was requested). It is
now a FunAsrNanoPreTrainedModel owning adaptor_config (same parameter names), so attention dispatch reaches it
at init and in set_attn_implementation, and the fullgraph forward test runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…osite models

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Model linter — first pass

transformers-mlinter found 2 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.

This is automated and advisory — it does not block merging.

rule count what it checks
TRF055 1 PreTrainedModel classes declare their config with a config: SomeConfig annotation, matched by __init__(config: SomeConfig); never config_class.
TRF057 1 Public model, config, output and processor classes and their public methods must carry @auto_docstring.

IlyasMoutawwakil and others added 3 commits November 24, 2026 17:53
…_dependent_inputs

prepare_for_export calls the model's get_data_dependent_inputs (keeping the inputs it already has) instead of
the exporters' own registry of per-encoder preparers and the get_rope_index probe, which the models' method now
covers: the grid_thw towers, NaViT target_sizes, Pixtral / LLaVA-NeXT image_sizes, the Omni and Qwen3-ASR audio
encoders, and the M-RoPE position_ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e_embeddings traces

The exporter registry used to turn image_sizes into Python ints; get_data_dependent_inputs now returns
image_token_index, which picks each image's kept tokens (and row EOLs) out of the uncropped grids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HunYuan-VL, HY-V4-VL, Cosmos3-Edge, GLM-5-Next and GLM-Image join the chunked vision attention patch (which now also
finds an `o_proj` and a `scale`), so their forwards export. Inkling exports as is. GLM-Image keeps a static-cache
generate skip (its decode recomputes M-RoPE from the cache length) and GLM-5-Next a generate.dynamic one (the merged
decode doesn't grow its indexer's padding mask).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@IlyasMoutawwakil IlyasMoutawwakil changed the title Add get_data_dependent_inputs: compute a forward's data-dependent inputs outside it 🚨 Add get_data_dependent_inputs: compute a forward's data-dependent inputs outside it Nov 24, 2026
IlyasMoutawwakil and others added 3 commits November 24, 2026 22:37
…rpolation helper, not a second helper

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ault already reaches the base model's

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BaseModelOutputWithSplitSizes, the plain-method mixin, inlined flatten_items and the review fixes. Idefics2/3 keep
the precomputed real-image index and now split per image; GLM-Image keeps its per-image maps built on GLM-4V's flat
getter; FunASR-Nano's head drops its deletion stub, as Qwen3-ASR's head no longer defines the method.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Model linter — first pass

transformers-mlinter found 2 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.

This is automated and advisory — it does not block merging.

rule count what it checks
TRF055 1 PreTrainedModel classes declare their config with a config: SomeConfig annotation, matched by __init__(config: SomeConfig); never config_class.
TRF057 1 Public model, config, output and processor classes and their public methods must carry @auto_docstring.


class FunAsrNanoMultiModalProjector(nn.Module):
"""Projects audio features into the text space and applies the checkpoint's adaptor layers."""
class FunAsrNanoMultiModalProjector(FunAsrNanoPreTrainedModel):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TRF055 — TRF055: generated modeling_fun_asr_nano.py:357: FunAsrNanoMultiModalProjector.__init__ takes config: FunAsrNanoConfig but the class overrides config: FunAsrNanoAdaptorConfig. Make them match; add or update config: FunAsrNanoConfig in the class body if that is intended.

Why this matters

PreTrainedModel derives config_class from the config annotation. An assignment or a hand-written config_class keeps or drifts from the parent's, and a mismatched __init__ builds the model from one config while it advertises another.

class Gemma4VisionModel(Gemma4PreTrainedModel):
     """The Gemma 4 Vision Encoder."""
-    config = Gemma4VisionConfig
+    config: Gemma4VisionConfig

-    def __init__(self, config):
+    def __init__(self, config: Gemma4VisionConfig):

Suppress with # trf-ignore: TRF055 if intentional.

self.config = config.adaptor_config
self.post_init()

def forward(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TRF057 — TRF057: FunAsrNanoMultiModalProjector.forward in modeling_fun_asr_nano.py has no @auto_docstring. No parent method it could inherit the decorator from declares it. Add @auto_docstring as the innermost decorator here.

Why this matters

Without it, the class and its methods ship without parameter, return and example documentation, which then has to be written by hand for each model.

+@auto_docstring
 @dataclass
 class AcmeModelOutputWithPast(ModelOutput):
     logits: torch.Tensor | None = None

+@auto_docstring
 class AcmeForConditionalGeneration(AcmePreTrainedModel):
+    @auto_docstring
     def forward(self, input_ids, pixel_values=None, **kwargs):
         ...

Suppress with # trf-ignore: TRF057 if intentional.

IlyasMoutawwakil and others added 5 commits November 24, 2026 23:51
…on at init

As set_attn_implementation already does. FunASR-Nano's adaptor layers were built from such a config and ran eager
with a warning on every call; its projector goes back to a plain module, which the modeling structure and repository
checks expect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nkling2's cu_seqlens device; skip what can't trace

- Models without packed encoders run in fp32 (atol=rtol=1e-4), packed ones in bf16 (2e-2, one rounding step), built
  in that dtype so fp32-kept modules (MoE routers) stay so. set_attn_implementation is only called with packed
  encoders, as it re-applies the top-level implementation to sub-models whose config isn't a sub-config.
- Inkling2's vision tower kept cu_seqlens on CPU, which flash attention rejects with or without compile.
- Skipped with their reasons: Step3p7 (experts opt out of use_experts_implementation), Apertus1.5 vision and audio
  (items tokenized one by one at their own size), GLM-Image (per-image feature maps sized on the host).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: apertus1p5, audioflamingo3, cohere_compass, cosmos3_edge, cosmos3_omni, deepseek_ocr2, dots3_note, emu3, ernie4_5_vl_moe, exaone4_5, fun_asr_nano, glm46v, glm4v, glm4v_moe, glm5_next, glm_image

@IlyasMoutawwakil

Copy link
Copy Markdown
Member Author

most models are the same mechanical change (the forward's helpers take the precomputed value from kwargs or compute it, get_data_dependent_inputs makes the same calls), the ones worth a look:

where why
PreTrainedModel.post_init sub-configs no sub-model owns now get the model's attention implementation at init (fixes FunASR-Nano's adaptor, which had none)
generate computes the inputs in prepare_inputs_for_generation, on the steps that carry the prompt's inputs
exporters the per-encoder preparer registry and get_rope_index probe are gone, prepare_for_export calls the model's method
Qwen2-VL family the reference: cu_seqlens, max_seqlen, rotary position_ids, window indices; everything modular inherits it
Cosmos3 Edge antialiased position-table resize is now a precomputed interpolation (matches F.interpolate(antialias=True) to ~2e-7), resize_positional_embeddings removed (breaking)
Nemotron-H Omni (RADIO) position table through get_vision_interpolation_indices_and_weights (gains resize_to_longest_side), pixel shuffle helper moved to vision_utils
HunYuan-VL reads the position table for all images at once and runs the merge blocks as one batch
LLaVA-NeXT family, Granite 4 Vision, LLaVA-OneVision packed features' layout (image_newline, anyres-max downscale as bilinear taps) precomputed, no loop over images
Pixtral, Mistral3, LightOnOCR, Mistral Large 4 block mask from the patch-to-image index, patch merger's merge_index
Emu3 encode keeps the full VQ grids, each image's crop is a gather (image_token_index)
Idefics2/3, SmolVLM, Molmo2 index gathers instead of boolean-mask selection
Qwen2.5-Omni, Qwen3-Omni, Qwen3-ASR audio chunking and real-frame selection as gathers instead of split(tolist()) / pad_sequence / mask
test test_model_forward_compile_fullgraph_with_data_dependent_inputs: packed encoders run flash in bf16, the rest fp32; Qwen4-exp, Step3p7, Apertus1.5, GLM-Image skipped

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.

2 participants