Skip to content

🚨 Enable SDPA (and other attention backends) for T5 and propagate to the T5 family - #47014

Merged
vasqu merged 32 commits into
huggingface:mainfrom
jiqing-feng:sdpa
Jul 30, 2026
Merged

🚨 Enable SDPA (and other attention backends) for T5 and propagate to the T5 family#47014
vasqu merged 32 commits into
huggingface:mainfrom
jiqing-feng:sdpa

Conversation

@jiqing-feng

@jiqing-feng jiqing-feng commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

CI

What this PR does

Refactors the T5 attention stack to route through ALL_ATTENTION_FUNCTIONS,
so T5 can dispatch to sdpa / eager instead of the old eager-only path, and
propagates the change to the copied-from family.

Now _supports_sdpa = True / _supports_attention_backend = True and running
test_eager_matches_sdpa_inference:

  • t5 (reference), mt5, udop, pop2piano
  • pix2struct — also required migrating the vision-tower attention
    (Pix2StructVisionAttention), a standard dense attention that was not on the
    interface, otherwise SDPA is unusable for the full model.
  • umt5 — its attention is its own dense implementation (not # Copied from
    T5); migrated the same way.

switch_transformers (modular, inherits T5 attention) is regenerated so its
modeling matches the refactored T5, but it stays eager-only (_supports_sdpa
not set): it is not on the SDPA path, this only propagates the eager refactor.

Alignment applied to migrated modules: attention goes through
ALL_ATTENTION_FUNCTIONS (with eager_attention_forward fallback), self.scaling,
is_causal; the relative position bias is folded into the additive attention mask;
forwards use **kwargs: Unpack[TransformersKwargs] + @can_return_tuple /
@auto_docstring / @merge_with_config_defaults / @capture_outputs, dropping the
manual return_dict / output_attentions / output_hidden_states resolution.

🚨 Behavior changes

  • With sdpa, softmax no longer force-upcasts to fp32 as the old path did;
    numerics stay within the eager_matches_sdpa tolerance.
  • output_attentions removed from internal block/layer tuple returns; attentions
    are collected via capture_outputs.

test_eager_matches_sdpa_inference is not skipped for any enabled model.

longt5 stays not-SDPA-enabled

The regular LongT5Attention (copied from T5) is on the interface, but the encoder
always runs the block-sparse LongT5LocalAttention / LongT5TransientGlobalAttention.
These operate on 5D blocked tensors (batch, num_blocks, heads, block_len, 3*block_len),
while sdpa_attention_forward assumes 4D (batch, heads, seq, dim) — they cannot go
through the interface at all. LongT5EncoderModel is purely block-sparse, so the
framework refuses to switch its attention implementation:

LongT5EncoderModel does not support setting its attention implementation
dynamically, because it does not follow the functional approach based on
AttentionInterface

Forcing _supports_sdpa = True makes the encoder-only sdpa tests fail (fp16
mean relative difference: nan). Same precedent as pegasus_x (block-sparse
encoder + regular decoder), which also sets _supports_sdpa = False.

Testing

utils/check_copies.py passes; full sweep green:

tests/models/{t5,mt5,umt5,udop,pop2piano,longt5,pix2struct,switch_transformers}/test_modeling_*.py
-> 1817 passed, 1958 skipped, 18 xfailed, 6 xpassed, 16699 subtests passed, 0 failed

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@jiqing-feng jiqing-feng changed the title enable t5 sdpa 🚨 Enable SDPA (and other attention backends) for T5 and propagate to the T5 family Jul 2, 2026
@jiqing-feng
jiqing-feng marked this pull request as ready for review July 2, 2026 06:45
@Rocketknight1

Rocketknight1 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Attention dispatch so cc @ArthurZucker @Cyrilvallez

@vasqu vasqu self-assigned this Jul 2, 2026
@vasqu

vasqu commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

WIll check it out when I have time but it's a big PR so expect delays 🙏

@Cyrilvallez

Copy link
Copy Markdown
Member

This competes with #46946

@vasqu vasqu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Only checked t5 becuse everything else is dependent on that (so the same comments apply), after t5 is solid I will make a scan through all models

Comment on lines +348 to +356
causal_mask = mask[:, :, :, : key_states.shape[-2]]
if causal_mask.dtype == torch.bool:
# `sdpa` may materialize a boolean mask (True = keep). Turn it into an additive float mask so it
# can be folded into the relative position bias, just like the `eager` float mask.
causal_mask = torch.where(
causal_mask,
torch.tensor(0.0, device=causal_mask.device, dtype=position_bias.dtype),
torch.finfo(position_bias.dtype).min,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
causal_mask = mask[:, :, :, : key_states.shape[-2]]
if causal_mask.dtype == torch.bool:
# `sdpa` may materialize a boolean mask (True = keep). Turn it into an additive float mask so it
# can be folded into the relative position bias, just like the `eager` float mask.
causal_mask = torch.where(
causal_mask,
torch.tensor(0.0, device=causal_mask.device, dtype=position_bias.dtype),
torch.finfo(position_bias.dtype).min,
)
if causal_mask.dtype == torch.bool:
# `sdpa` may materialize a boolean mask (True = keep). Turn it into an additive float mask so it
# can be folded into the relative position bias, just like the `eager` float mask.
causal_mask = torch.where(
causal_mask,
torch.tensor(0.0, device=causal_mask.device, dtype=position_bias.dtype),
torch.finfo(position_bias.dtype).min,
)
  1. I don't think we need to slice anymore (might be wrong)
  2. I think we should do the bool -> float conversion at mask creation time tbh

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(1) Dropped the slice for t5/umt5 (no-op there since kv_len already matches key_states.shape[-2]); kept it on pix2struct because its text stack still builds the mask the old way and removing it breaks test_eager_matches_sdpa_inference — will remove it with the pix2struct refactor follow-up. (2) Doing the bool→float conversion in masking_utils would hit every model and other backends rely on the boolean mask (sdpa's is_causal fast path). Did you mean a T5-specific mask_function that returns the additive bias directly? Happy to do that if there's an existing pattern.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No no, I dont mean in the mask function itself but when we create in T5 so in the stack / model modules after creation, do the conversion directly there.

@jiqing-feng jiqing-feng Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With the current approach there's no bool→float conversion needed anymore — since position_bias is passed to the attention interface separately instead of being folded into the mask, we don't need an additive float mask. eager just gets the float mask and sdpa gets the bool mask, each handled natively by its backend. So there's nothing to convert after mask creation.

Comment on lines +359 to +369
# T5 uses a relative attention bias that is added to the attention scores. This is passed as the additive
# attention mask so that it works with the different attention implementations. As it is always non-`None`,
# `is_causal` is never inferred, so the causal behavior is fully encoded in the bias itself.
attention_interface: Callable = eager_attention_forward
if self.config._attn_implementation != "eager":
if self.config._attn_implementation != "sdpa":
raise ValueError(
"T5 adds a relative position bias on top of the attention scores, which is only supported by the "
f"`eager` and `sdpa` attention implementations, but got `{self.config._attn_implementation}`."
)
attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# T5 uses a relative attention bias that is added to the attention scores. This is passed as the additive
# attention mask so that it works with the different attention implementations. As it is always non-`None`,
# `is_causal` is never inferred, so the causal behavior is fully encoded in the bias itself.
attention_interface: Callable = eager_attention_forward
if self.config._attn_implementation != "eager":
if self.config._attn_implementation != "sdpa":
raise ValueError(
"T5 adds a relative position bias on top of the attention scores, which is only supported by the "
f"`eager` and `sdpa` attention implementations, but got `{self.config._attn_implementation}`."
)
attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
attention_interface: Callable = ALL_ATTENTION_FUNCTIONS.get_interface(
self.config._attn_implementation, eager_attention_forward
)

Imo

  1. This was the old format
  2. The flags will already indicate what is supported so we can just go ahead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, applied to umt5 and pix2struct too.

_no_split_modules = ["T5Block"]
_keep_in_fp32_modules = ["wo"]

_supports_attention_backend = True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
_supports_attention_backend = True

would avoid this for now, enc-dec are more complicated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed for t5, umt5 and pix2struct. We can revisit once enc-dec is settled.

Comment on lines +557 to +558
_supports_flash_attn = False
_supports_flex_attn = False

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can add a small comment here as to why == relative bias is not possible

Altho in the future we might be able to use FA4 to integrate the score mod along

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a comment: T5 folds the relative position bias into the additive mask, which flash can't take and flex would need a dedicated score_mod for. (Noted the FA4 / score_mod possibility, cc @zucchini-nlp below.)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think based on @zucchini-nlp we could actually change the strategy a bit:

  1. Do not add mask and bias directly
  2. Pass the bias and mask separately
  3. Do not convert your mask manually anymore

That would also enable flex as side effect

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — reworked exactly along those lines: mask and bias are no longer added together, position_bias is passed to the attention interface as a separate kwarg, and all the manual mask conversion is gone. eager and sdpa each handle the bias and mask natively, and flex is now enabled as a side effect. Applied across the whole T5 family.

**kwargs,
**kwargs: Unpack[TransformersKwargs],
):
use_cache = use_cache if use_cache is not None else self.config.use_cache

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
use_cache = use_cache if use_cache is not None else self.config.use_cache

already handled by decorator

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed, the decorator already handles it.

Comment on lines 691 to 715
@@ -668,8 +714,6 @@
raise ValueError("You have to initialize the model with valid token embeddings")
inputs_embeds = self.embed_tokens(input_ids)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's simplify here

  1. The gradient ckpting is handled by the decorator
  2. The input ids and embeds checks can be simplified by a lot (see other encoder-decoder models like bart)
  3. The value error on inputs embeds that embed tokens is overkill we can skip that if completely

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Simplified as suggested, same for umt5. pix2struct's text stack still uses the old decorator style, so I'll migrate it in a follow-up to keep this PR focused on the SDPA enablement.

and_mask_function=dummy_and_mask_function,
)
else:
attention_mask = create_bidirectional_mask(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

relative bias only on decoder side?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Relative bias is on both encoder and decoder. The dummy_and_mask_function is only needed on the decoder's create_causal_mask to force the mask to be materialized as a float so the bias can be folded in (otherwise sdpa may take the is_causal shortcut). The encoder uses create_bidirectional_mask which is already additive.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Based on #47014 (comment) and the model addition of inkling, we also dont need this workaround anymore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right — dropped that workaround. Now that the bias is passed separately (like inkling does), there's nothing left to work around here.


encoder_extended_attention_mask = None
if self.is_decoder and encoder_hidden_states is not None:
encoder_extended_attention_mask = create_bidirectional_mask(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cross-attention has no relative bias (has_relative_attention_bias=False), so no dummy mask function is needed here.

@@ -881,19 +892,16 @@
>>> last_hidden_states = outputs.last_hidden_state
```"""
use_cache = use_cache if use_cache is not None else self.config.use_cache

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
use_cache = use_cache if use_cache is not None else self.config.use_cache

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@@ -1049,7 +1050,6 @@
>>> # studies have shown that owning a dog is good for you.
```"""
use_cache = use_cache if use_cache is not None else self.config.use_cache

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ok last time mention

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed here too, and in T5ForQuestionAnswering for consistency. Thanks for the nudge.

@zucchini-nlp

Copy link
Copy Markdown
Member

FWIW, we might take advantage of recent updates to accommodate Inkling, and support FlexAttn with position bias. I didn't check in details, might be wrong if these two position-biases are added up in different ways

# The relative position bias flows through the attention interface as a `position_bias` (duh)
# kwarg that only the eager path consumes; other backends need a score_mod/kernel
_supports_flash_attn = False
_supports_sdpa = True
_supports_flex_attn = True
_can_compile_fullgraph = False
_supports_attention_backend = False
_keys_to_ignore_on_load_unexpected = [r"model\.mtp\..*"]

@vasqu

vasqu commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

You could only do this with flex attention using score mod afaik, but flex attention with score mod was quite slow; things might have changed by then but their mask creation is the biggest blocker to make flex attention viable.

Edit: This might be ok when triggered via FA4 but still fear the mask creation tbh

@vasqu

vasqu commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Ok yea checked, we added it to the score mod. We can do it for sure, just doubting the perf a bit

position_bias: torch.Tensor | None = None,

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@jiqing-feng

Copy link
Copy Markdown
Contributor Author

Great pointer. Given the perf concern around flex mask creation, I'd keep this PR focused on sdpa and add flex support (via score_mod) as a follow-up once we can benchmark it. Works for you both?

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@vasqu

vasqu commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

@jiqing-feng I haven't taken a look at inkling too deeply before this but I noticed it reduces a lot of friction if we follow that process, see #47014 (comment) and #47014 (comment)

The tl;dr:

  • No mask workarounds (force creation, float conversion)
  • Pass position bias separately to the mask as kwarg to the interface
  • Side effect: it also enables flex attention (even though the perfs there are likely not super nice)

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@jiqing-feng

Copy link
Copy Markdown
Contributor Author

@jiqing-feng I haven't taken a look at inkling too deeply before this but I noticed it reduces a lot of friction if we follow that process, see #47014 (comment) and #47014 (comment)

The tl;dr:

  • No mask workarounds (force creation, float conversion)
  • Pass position bias separately to the mask as kwarg to the interface
  • Side effect: it also enables flex attention (even though the perfs there are likely not super nice)

Following the inkling approach did remove a lot of friction: no more mask workarounds (no forced creation, no float conversion), and the position bias is now passed to the interface as a separate kwarg alongside the mask. Flex attention falls out as a side effect too. Reworked t5 along these lines and propagated it across the whole T5 family.

@vasqu vasqu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Smaller comments overall, only bigger thing I noticed was that fullgraph was set to false now which would be nice to solve instead 👀

Comment thread src/transformers/integrations/sdpa_attention.py
Comment thread src/transformers/models/t5/modeling_t5.py Outdated
Comment thread src/transformers/models/t5/modeling_t5.py Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

And ig the same here re output recorder. Just fmi why it wasnt refactored

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's orthogonal to the attention-backend work and a fairly heavy refactor, so I'd do it in a dedicated follow-up. It's more than the vision tower — the whole model (text decoder included) still uses the legacy output_attentions/return_dict path with no _can_record_outputs, and being a two-tower model it means reworking three forwards and registering recorders for both towers. Happy to fold it in if you'd rather.

Comment thread src/transformers/models/udop/modeling_udop.py Outdated
Comment thread src/transformers/models/udop/modeling_udop.py Outdated
Comment thread src/transformers/models/udop/modeling_udop.py Outdated
Comment thread src/transformers/models/umt5/modeling_umt5.py Outdated
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 30059557292:2
Result: success | Jobs: 16 | Tests: 174,496 | Failures: 0 | Duration: 8h 24m

@jiqing-feng

Copy link
Copy Markdown
Contributor Author

Hi @vasqu . I've fixed your last comment, please rerun the tests. Thanks!

@vasqu

vasqu commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

run-slow: blip_2, longt5, mt5, pix2struct, pop2piano, switch_transformers, t5, udop, umt5

@github-actions

Copy link
Copy Markdown
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/blip_2", "models/longt5", "models/mt5", "models/pix2struct", "models/pop2piano", "models/switch_transformers", "models/t5", "models/udop", "models/umt5"]
quantizations: []

@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

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 643875a0 workflow commit (merge commit)
PR aad66e65 branch commit (from PR)
main ebea912f base commit (on main)

Model CI Report

2 new failed tests from this PR 😭

  • longt5:
    tests/models/longt5/test_modeling_longt5.py::LongT5ModelIntegrationTests::test_summarization (❌ ⟹ ❌)

  • switch_transformers:
    tests/models/switch_transformers/test_modeling_switch_transformers.py::SwitchTransformerModelIntegrationTests::test_small_logits (✅ ⟹ ❌)

@yao-matrix

Copy link
Copy Markdown
Contributor

@jiqing-feng , pls check CI, thx

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: blip_2, longt5, mt5, pix2struct, pop2piano, switch_transformers, t5, udop, umt5

@jiqing-feng

jiqing-feng commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

This is a real bug on main that the PR fixes.

The stack loop never writes position_bias back from the layer output (t5 does position_bias = layer_outputs[1]). Only block 0 has has_relative_attention_bias=True, so blocks 1–11 fall through to position_bias = torch.zeros(...) and attention becomes uniform. Dropped in #40132. switch_transformers is the only model in the family affected (umt5 has a per-layer bias by design).

Proof: I checked out 7938e91faa^ (right before #40132) and ran the same input — its output is bit-identical to this PR's. So the PR restores the original numerics rather than changing them.

Greedy generation with google/switch-base-8:

prompt main this PR
The human walks into a bar and orders a <extra_id_0> '.' 'drink.'
The capital of France is <extra_id_0>. '..' 'Paris.'

('drink.' is what the skipped test_small_generate asserts.)

The test barely moved because it feeds torch.ones((32, 64)) — all tokens identical, so the attention distribution hardly matters. With real inputs the encoder output differs by up to 3.93 (absmax 4.66). That's why it kept passing after #40132.

I regenerated the ("cuda", 8) expectations, which now match the pre-#40132 values exactly. Note these come from an A100 — on A100 the PR actually passes the old values too, so the diff is hardware spread, not a behaviour change. (None, None) is unchanged: it predates #40132 and already encodes the correct behaviour.

longt5::test_summarization

Pre-existing, fails the same on main. Root cause is in get_expanded_tied_weights_keys:

if not getattr(self.config, "tie_word_embeddings", False):
    return {}

_tied_weights_keys mixes structural aliases with the output embedding:

{'encoder.embed_tokens.weight': 'shared.weight',   # structural, must always tie
 'decoder.embed_tokens.weight': 'shared.weight',   # structural, must always tie
 'lm_head.weight': 'shared.weight'}                # what tie_word_embeddings governs

This checkpoint has tie_word_embeddings=False, so all three are dropped and the encoder/decoder embeddings stay randomly initialised (std 1.00 vs 8.92 for shared.weight), hence the gibberish output. Introduced in #41541; affects any encoder-decoder checkpoint with tie_word_embeddings=False.

Only dropping the entries that point at get_output_embeddings() fixes it — test_summarization then passes. Since that's a core modeling_utils change unrelated to attention dispatch, I've kept it out of this PR and will open a separate one. (Fixed in #47620)

(longt5::test_inference_hidden_states also fails on main — unrelated, 0.0035 abs diff against atol=1e-4.)

@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: blip_2, longt5, mt5, pix2struct, pop2piano, switch_transformers, t5, udop, umt5

@vasqu

vasqu commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Fair enough, I was mainly concerned about the switch transformer failure, checking slow ci and then merge

@vasqu

vasqu commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

run-slow: blip_2, longt5, mt5, pix2struct, pop2piano, switch_transformers, t5, udop, umt5

@github-actions

Copy link
Copy Markdown
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/blip_2", "models/longt5", "models/mt5", "models/pix2struct", "models/pop2piano", "models/switch_transformers", "models/t5", "models/udop", "models/umt5"]
quantizations: []

@github-actions

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 83d9ebf1 workflow commit (merge commit)
PR b35db480 branch commit (from PR)
main 3d7b75a8 base commit (on main)

⚠️ Model CI failed to report results

The test failure analysis could not be completed. Please check the workflow run for details.

@vasqu

vasqu commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

I will check again tomorrow, I think we are safe but I dont want to merge with broken slow ci

@vasqu

vasqu commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

run-slow: blip_2, longt5, mt5, pix2struct, pop2piano, switch_transformers, t5, udop, umt5

@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: blip_2, longt5, mt5, pix2struct, pop2piano, switch_transformers, t5, udop, umt5

@github-actions

Copy link
Copy Markdown
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/blip_2", "models/longt5", "models/mt5", "models/pix2struct", "models/pop2piano", "models/switch_transformers", "models/t5", "models/udop", "models/umt5"]
quantizations: []

@github-actions

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN d74d3f2d workflow commit (merge commit)
PR c8352f73 branch commit (from PR)
main 6b8369fe base commit (on main)

Model CI Report

1 new failed tests from this PR 😭

  • longt5:
    tests/models/longt5/test_modeling_longt5.py::LongT5ModelIntegrationTests::test_summarization (❌ ⟹ ❌)

@vasqu
vasqu added this pull request to the merge queue Jul 30, 2026
Merged via the queue into huggingface:main with commit 560f36c Jul 30, 2026
114 of 115 checks passed
stevhliu pushed a commit to stevhliu/transformers that referenced this pull request Jul 30, 2026
…the T5 family (huggingface#47014)

* enable t5 sdpa

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix format

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix comments

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update comments

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix mask and position

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix use_cache and _supports_attention_backend

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix _can_compile_fullgraph

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix class register

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix tests

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* Update src/transformers/models/t5/modeling_t5.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/t5/modeling_t5.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/mt5/modeling_mt5.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pix2struct/modeling_pix2struct.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pop2piano/modeling_pop2piano.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pop2piano/modeling_pop2piano.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pop2piano/modeling_pop2piano.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* fix comments

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix name

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix tyests

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix test

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix tests

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix test

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

---------

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Sainava pushed a commit to Sainava/Sai-transformers that referenced this pull request Aug 3, 2026
…the T5 family (huggingface#47014)

* enable t5 sdpa

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix format

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix comments

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* update comments

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix mask and position

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix use_cache and _supports_attention_backend

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix _can_compile_fullgraph

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix class register

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix tests

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* Update src/transformers/models/t5/modeling_t5.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/t5/modeling_t5.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/mt5/modeling_mt5.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pix2struct/modeling_pix2struct.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pop2piano/modeling_pop2piano.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pop2piano/modeling_pop2piano.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Update src/transformers/models/pop2piano/modeling_pop2piano.py

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* fix comments

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix name

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix tyests

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix test

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix tests

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

* fix test

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>

---------

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
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.

7 participants