Skip to content

Refactor LongT5 to use @capture_outputs and @can_return_tuple decorators for unified output handling (Fixes #43979)#44161

Open
cogniera wants to merge 1 commit intohuggingface:mainfrom
cogniera:refactor/longt5-output-tracing
Open

Refactor LongT5 to use @capture_outputs and @can_return_tuple decorators for unified output handling (Fixes #43979)#44161
cogniera wants to merge 1 commit intohuggingface:mainfrom
cogniera:refactor/longt5-output-tracing

Conversation

@cogniera
Copy link
Copy Markdown

@cogniera cogniera commented Feb 19, 2026

What does this PR do?

This PR refactors the LongT5 model to use the @capture_outputs and @can_return_tuple decorators for standardized output handling across the model stack.

The refactor removes manual handling of:

output_attentions

output_hidden_states

return_dict

manual tuple construction

explicit attention/hidden state collection loops

and aligns LongT5 with the modern decorator-based tracing pattern now used across the library.

Fixes (issue)
#43979

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@github-actions
Copy link
Copy Markdown
Contributor

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

run-slow: longt5

@cogniera
Copy link
Copy Markdown
Author

@molbap hi i am new to contributing , I can't really figure out what I did wrong I followed the steps in the repo and the checks are still failing could you please guide me

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