-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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 script to convert T5X T5 (v1.0 and v1.1) checkpoints to PyTorch #20801
Conversation
The documentation is not available anymore as the PR was closed or merged. |
ff2c4af
to
f342f24
Compare
I could use some clarification on the following: I'm missing a configuration option for T5 for the 1.0/original T5 checkpoints to have an Currently there is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for adding this @bastings
Hey @bastings, when there is no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very clean, thanks a lot for the addition.
src/transformers/models/t5/convert_t5x_checkpoint_to_pytorch.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool PR @bastings! Thanks for the addition! Do you have a set of example args I could use just to try the script out once for myself? Thanks! 🙌
src/transformers/models/t5/convert_t5x_checkpoint_to_pytorch.py
Outdated
Show resolved
Hide resolved
a3c1dd9
to
0d9d0af
Compare
ea37c40
to
c529472
Compare
c529472
to
6043de3
Compare
I added the instructions to the top docstring. Maybe it's ready? :-) |
src/transformers/models/t5/convert_t5x_checkpoint_to_pytorch.py
Outdated
Show resolved
Hide resolved
A last nit and we can merge! Thanks a lot for bearing with me 😄 |
Thanks! Committed your suggestion :) |
""" | ||
Convert T5X checkpoint to PyTorch | ||
|
||
Steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Once the quality tests are green (requires |
Oh looks like the suggestion made it fail ;) |
Ah, sorry then ahha, I guess the |
0f279bb
to
7032ed3
Compare
Fixed! :) |
…uggingface#20801) * Add script to convert T5X T5 (v1.0 and v1.1) checkpoints to PyTorch * Remove unnecessary check and update docstring * Format docstring * Fix whitespace in docstring
…uggingface#20801) * Add script to convert T5X T5 (v1.0 and v1.1) checkpoints to PyTorch * Remove unnecessary check and update docstring * Format docstring * Fix whitespace in docstring
…uggingface#20801) * Add script to convert T5X T5 (v1.0 and v1.1) checkpoints to PyTorch * Remove unnecessary check and update docstring * Format docstring * Fix whitespace in docstring
…uggingface#20801) * Add script to convert T5X T5 (v1.0 and v1.1) checkpoints to PyTorch * Remove unnecessary check and update docstring * Format docstring * Fix whitespace in docstring
…uggingface#20801) * Add script to convert T5X T5 (v1.0 and v1.1) checkpoints to PyTorch * Remove unnecessary check and update docstring * Format docstring * Fix whitespace in docstring
What does this PR do?
Adds a script that can convert Google T5X (Flax) T5 and T5-v1.1 checkpoints into PyTorch checkpoints.
This allows users to convert non-standard checkpoints that have been trained with T5X and use them with the Transformers library in PyTorch.
Usage:
gsutil
, install according to https://cloud.google.com/storage/docs/gsutil_installgsutil -m cp -r gs://t5-data/pretrained_models/t5x/t5_1_1_small $HOME/
config.json
for the downloaded checkpoint. Often one already exists, e.g. here we can use https://huggingface.co/google/t5-v1_1-small/blob/main/config.jsonpython3 convert_t5x_checkpoint_to_pytorch.py --t5x_checkpoint_path=$HOME/t5_1_1_small --config_file=config.json --pytorch_dump_path=$HOME/t5_1_1_small_pt
Before submitting
Pull Request section?
to it if that's the case. Discussed with @thomwolf .
documentation guidelines, and
here are tips on formatting docstrings.
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.
@patrickvonplaten
@sanchit-gandhi
@ArthurZucker
@younesbelkada