Skip to content

Conversation

@alvarobartt
Copy link
Member

@alvarobartt alvarobartt commented Dec 22, 2025

What does this PR do?

This PR imports the T5Tokenizer from transformers instead of the former MT5Tokenizer, given that MT5Tokenizer is / was just a "re-export" of T5Tokenizer as per https://github.com/huggingface/transformers/blob/v4.57.3/src/transformers/models/mt5/tokenization_mt5.py, on latest available stable Transformers i.e., v4.57.3.

Note

Diffusers will still work fine with Transformers < v5.0.0rc0 despite the aforementioned change, but this way it also enables Transformers v5.0.0rc0 onwards.

Before submitting

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.

@sayakpaul @yiyixuxu

Given that the `MT5Tokenizer` in `transformers` is just a "re-export" of
`T5Tokenizer` as per
https://github.com/huggingface/transformers/blob/v4.57.3/src/transformers/models/mt5/tokenization_mt5.py
)on latest available stable Transformers i.e., v4.57.3), this commit
updates the imports to point to `T5Tokenizer` instead, so that those
still work with Transformers v5.0.0rc0 onwards.
@sayakpaul
Copy link
Member

Thanks for the PR but we will have to a library-wide thingy to make sure we're 5.0.0-xx compatible. @DN6 @yiyixuxu thoughts?

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

@alvarobartt
Copy link
Member Author

Thanks for the PR but we will have to a library-wide thingy to make sure we're 5.0.0-xx compatible. @DN6 @yiyixuxu thoughts?

Agree @sayakpaul! I think this PR just unlocks some things as e.g. AutoPipelineForText2Image, but would be great to see if there's anything else that needs a patch prior Transformers v5.0.0 stable landing.

@yiyixuxu yiyixuxu merged commit 52766e6 into main Dec 23, 2025
30 of 32 checks passed
surajyadav-research pushed a commit to surajyadav-research/diffusers that referenced this pull request Jan 4, 2026
…v5.0+) (huggingface#12877)

Use `T5Tokenizer` instead of `MT5Tokenizer`

Given that the `MT5Tokenizer` in `transformers` is just a "re-export" of
`T5Tokenizer` as per
https://github.com/huggingface/transformers/blob/v4.57.3/src/transformers/models/mt5/tokenization_mt5.py
)on latest available stable Transformers i.e., v4.57.3), this commit
updates the imports to point to `T5Tokenizer` instead, so that those
still work with Transformers v5.0.0rc0 onwards.
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.

5 participants