Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add T5 GGUF loading support #33389

Merged
merged 11 commits into from
Oct 24, 2024
Merged

Add T5 GGUF loading support #33389

merged 11 commits into from
Oct 24, 2024

Conversation

junejae
Copy link
Contributor

@junejae junejae commented Sep 9, 2024

What does this PR do?

Add T5 GGUF loading support

Due to the nature of T5's architecture, I decided to replicate gguf's conversion logic, so the final code gets messy.
I tried to avoid any logical conflicts between t5's and existing model architectures, but feel free to edit codes if you find any mistakes that I haven't noticed out.

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.

@SunMarc @LysandreJik @ArthurZucker , could you please review this PR?

@bonlime
Copy link

bonlime commented Sep 11, 2024

Does your code allow loading T5 Encoder XXL (the one used in Flux)?
Example files here:
https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/tree/main

@junejae
Copy link
Contributor Author

junejae commented Sep 11, 2024

@bonlime Yes, it works with AutoModelForTextEncoding class. I've tested with T5 encoder of the exact repo you linked, but I didn't commit the independent test code block for T5 encoder since the code could be dirty with embedding vector style example output.

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Thanks for your work @junejae and sorry for the delay ! Just a few nits. There are a few merge conflits, can you fix them also ?

tests/quantization/ggml/test_ggml.py Show resolved Hide resolved
src/transformers/modeling_gguf_pytorch_utils.py Outdated Show resolved Hide resolved
@junejae junejae requested a review from SunMarc October 3, 2024 11:37
@junejae
Copy link
Contributor Author

junejae commented Oct 3, 2024

@SunMarc
I've resolved conflicts and added more tests. Could you please review it again?

@SunMarc
Copy link
Member

SunMarc commented Oct 3, 2024

Make sure to fix the CI also !

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

@junejae junejae requested a review from SunMarc October 23, 2024 02:52
Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Nice, thanks a lot !

@SunMarc SunMarc requested a review from LysandreJik October 23, 2024 12:24
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Boom, awesome! Thanks @junejae

@SunMarc SunMarc merged commit dd267fc into huggingface:main Oct 24, 2024
23 of 25 checks passed
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* add: GGUFT5Converter

* add: tensormapping for t5

* add: test code for t5

* fix: Remove whitespace from blank line

* add: t5 fp16 tests

* fix: whitespace formatting

* fix: minor formatting

* fix: testing every weights
BernardZach pushed a commit to innovationcore/transformers that referenced this pull request Dec 6, 2024
* add: GGUFT5Converter

* add: tensormapping for t5

* add: test code for t5

* fix: Remove whitespace from blank line

* add: t5 fp16 tests

* fix: whitespace formatting

* fix: minor formatting

* fix: testing every weights
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