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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF: rework XLA generate tests #16866

Merged
merged 5 commits into from
Apr 22, 2022
Merged

TF: rework XLA generate tests #16866

merged 5 commits into from
Apr 22, 2022

Conversation

gante
Copy link
Member

@gante gante commented Apr 20, 2022

What does this PR do?

In the light of recent findings (#16838), this PR reworks existing XLA generate tests. The following key changes were made:

  1. Added a @unittest.skipIf on XLA generate tests, to skip when no GPU is present;
  2. Rework XLA sample tests -- due to the minor numerical differences that arise when we use XLA (and that we can't control), the sampling step will gather different samples even when we use the same seed. The only thing we can properly test is whether a) we can seed them and b) the results are sensible;
  3. Adds at least one XLA test where the batch size is > 1 and the inputs have different lengths, so we can confirm that masking works (GPT-2 is not working 馃挃 , added a TODO);
  4. Removes redundant tests (we had tests outside the integration tests that were testing the same thing).

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 20, 2022

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

Comment on lines +483 to +486
expected_output_string = [
"Heute ist ein sch枚ner Tag.",
"Ich habe vier Katzen, drei Hunde, zwei V枚gel und ein Pferd.",
]
Copy link
Member

Choose a reason for hiding this comment

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

Are we guaranteed that the logits are stable enough that we'll always sample this exact output? A flaky test can be really annoying!

Copy link
Member Author

Choose a reason for hiding this comment

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

We haven't had problems with similar tests, so I'm assuming we won't have problems :D

Copy link
Member

Choose a reason for hiding this comment

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

...fair point!

Copy link
Member

@Rocketknight1 Rocketknight1 left a comment

Choose a reason for hiding this comment

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

Overall, this looks great! The fact that we can't really test sample outputs is annoying, but I see why we can't really get around that problem.

@gante
Copy link
Member Author

gante commented Apr 22, 2022

@patrickvonplaten reintroduced the fast tests, will merge as soon as CI gets to green

@gante gante merged commit 6d90d76 into huggingface:main Apr 22, 2022
@gante gante deleted the gpu_xla_tests branch April 22, 2022 11:38
elusenji pushed a commit to elusenji/transformers that referenced this pull request Jun 12, 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

4 participants