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

TF: GPT-J compatible with XLA generation #17986

Merged
merged 3 commits into from Jul 6, 2022
Merged

Conversation

gante
Copy link
Member

@gante gante commented Jul 1, 2022

What does this PR do?

This PR modifies TF GPT-J so as to be compatible with XLA generation. It borrows the new code from FLAX -- in essence, instead of computing the embedded positions (sincos) at each call, given the size of the sequence (which could be obtained from the size of the past), now pre-computes the embedded positions and gathers them given the position_ids.

⚠️ The integration tests are disabled with @tooslow, due to the size of the model. I've reworked the tests BEFORE touching GPT-J code, to test all needed features correctly. All but the XLA test were passing before GPT-J was changed, and all tests pass after the changes. We still have two XLA tests being run in CI frequently (test_xla_generate_fast and test_xla_generate_slow), as well as a couple of generic generate tests -- they just don't use the trained model weights.

@gante
Copy link
Member Author

gante commented Jul 1, 2022

Related issue: #17935

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jul 1, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@gante gante merged commit 360719a into huggingface:main Jul 6, 2022
@gante gante deleted the xla_gptj branch July 6, 2022 14:02
viclzhu pushed a commit to viclzhu/transformers that referenced this pull request Jul 18, 2022
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.

None yet

3 participants