Skip to content

Conversation

gante
Copy link
Member

@gante gante commented Sep 12, 2025

What does this PR do?

Aria tests were decorated with @slow in #38615 because they were slow. The tests were slow because the test model was quite large.

This PR:

  • reduces the size of the test aria model and removes @slow (non-slow test runtime reduced by 66% on my machine, ~1min -> ~20 secs)
  • fixes things that broke on aria tests while they were disabled
  • deletes skips that we no longer need 🔫

Copy link
Contributor

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

run-slow: aria, idefics3, smolvlm

class TransformersKwargs(TypedDict, total=False):
"""
Keyword arguments to be passed to the loss function
Keyword arguments to be passed to the forward pass of a `PreTrainedModel`.
Copy link
Member Author

Choose a reason for hiding this comment

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

note: this class is not complete, e.g. it doesn't contain output_vision_hidden_states. we may want to create variants of this class for documentation purposes 🤔

Comment on lines +1084 to +1098
try:
outputs = func(self, *args, **kwargs)
except TypeError as original_exception:
# If we get a TypeError, it's possible that the model is not receiving the recordable kwargs correctly.
# Get a TypeError even after removing the recordable kwargs -> re-raise the original exception
# Otherwise -> we're probably missing `**kwargs` in the decorated function
kwargs_without_recordable = {k: v for k, v in kwargs.items() if k not in recordable_keys}
try:
outputs = func(self, *args, **kwargs_without_recordable)
except TypeError:
raise original_exception
raise TypeError(
"Missing `**kwargs` in the signature of the `@check_model_inputs`-decorated function "
f"({func.__qualname__})"
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Took me a few minutes to detect that these lines were failing AND that the correct solution was simply to add **kwargs -> added an informative exception so that external contributors can quickly fix related problems 🤗

@HuggingFaceDocBuilderDev

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.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Thanks LGTM 🤗

@gante gante merged commit 4cb41ad into huggingface:main Sep 12, 2025
23 checks passed
@gante gante deleted the revive_aria_tests branch September 12, 2025 14:14
self,
pixel_values,
patch_attention_mask: Optional[torch.BoolTensor] = None,
**kwargs: Unpack[TransformersKwargs],
Copy link
Member

Choose a reason for hiding this comment

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

oh wow, I wonder how none of the tests caught it. Ideally i think we have to pass them over to vision attention for FA2. But that definitely might open a can of worms, I'll take note of it for now

Copy link
Member Author

Choose a reason for hiding this comment

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

I confess I am not familiar with the full consequences of adding this line -- I saw that SiglipVisionTransformer had them and it made CI green, so it should be fine :D

ErfanBaghaei pushed a commit to ErfanBaghaei/transformers that referenced this pull request Sep 25, 2025
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/transformers that referenced this pull request Oct 2, 2025
yuchenxie4645 pushed a commit to yuchenxie4645/transformers that referenced this pull request Oct 4, 2025
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.

4 participants