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

Jamba: update integration tests #32250

Merged
merged 11 commits into from
Aug 22, 2024
Merged

Conversation

gante
Copy link
Member

@gante gante commented Jul 26, 2024

What does this PR do?

🟢 Fixes generate-related integration tests for jamba 🟢

I've checked them against:

  • my machine (compute capability 8);
  • our slow CI (compute capability 7) -- CI is still red, but due to a SDPA test.

⚠️ skips logits checks on older devices: there are big differences across different versions, possibly explained by custom cuda kernels. Given the relatively low usage of jamba, we don't have the bandwidth to dive.


Detective work 🕵️

  1. The tests use a dummy model, ai21labs/Jamba-tiny-random, the generation text quality doesn't matter.
  2. On my machine, checking out to the commit that added the current tests, I already get a difference. My machine has the same major compute capability as an A100 (RTX4090).
  3. We can see in the original PR that the tests were being updated as changes were made. There were a few commits after the latest version of the tests that modify the outputs, which would explain the failing tests since day 1

@gante gante added the run-slow label Jul 26, 2024
@gante gante requested a review from LysandreJik July 26, 2024 19:17
@gante
Copy link
Member Author

gante commented Jul 26, 2024

cc @ydshieh

Comment on lines +653 to +655
# This variable is used to determine which CUDA device are we using for our runners (A10 or T4)
# Depending on the hardware we get different logits / generations
cuda_compute_capability_major_version = None
Copy link
Member Author

Choose a reason for hiding this comment

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

This cuda_compute_capability_major_version pattern is copied from other models like e.g. gemma

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

@ydshieh
Copy link
Collaborator

ydshieh commented Jul 29, 2024

(thank you for trigger the tests on the runner 🙏 )

@gante gante requested review from amyeroberts and removed request for LysandreJik August 7, 2024 15:35
Copy link
Collaborator

@amyeroberts amyeroberts 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 digging into this and fixing, and for writing a detailed PR description ❤️

Agreed it's not worth digging into given jamba usage, and as the generated texts appear similar despite the logic differences

tests/models/jamba/test_modeling_jamba.py Outdated Show resolved Hide resolved
tests/models/jamba/test_modeling_jamba.py Outdated Show resolved Hide resolved
torch.testing.assert_close(logits[0, -1, :40].cpu(), EXPECTED_LOGITS_NO_GRAD_0, rtol=1e-3, atol=1e-3)
torch.testing.assert_close(logits[1, -1, :40].cpu(), EXPECTED_LOGITS_NO_GRAD_1, rtol=1e-3, atol=1e-3)
# TODO: there are significant differences in the logits across major cuda versions, which shouldn't exist
if self.cuda_compute_capability_major_version == 8:
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe better to use

self.skipTest(reason="Skipping for T4 runners because ...")

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, merged before seeing this comment!

You have a good point, in fact we should split the test in two to test (/skip) the logits separately

@gante gante merged commit f6e2586 into huggingface:main Aug 22, 2024
21 checks passed
@gante gante deleted the jamba_integration_tests branch August 22, 2024 10:46
@vasqu vasqu mentioned this pull request Aug 23, 2024
5 tasks
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Aug 30, 2024
* try test updates

* a few more changes

* a few more changes

* a few more changes

* [run slow] jamba

* skip logits checks on older gpus

* [run slow] jamba

* oops

* [run slow] jamba

* Update tests/models/jamba/test_modeling_jamba.py

Co-authored-by: amyeroberts <[email protected]>

* Update tests/models/jamba/test_modeling_jamba.py

Co-authored-by: amyeroberts <[email protected]>

---------

Co-authored-by: amyeroberts <[email protected]>
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Aug 30, 2024
* try test updates

* a few more changes

* a few more changes

* a few more changes

* [run slow] jamba

* skip logits checks on older gpus

* [run slow] jamba

* oops

* [run slow] jamba

* Update tests/models/jamba/test_modeling_jamba.py

Co-authored-by: amyeroberts <[email protected]>

* Update tests/models/jamba/test_modeling_jamba.py

Co-authored-by: amyeroberts <[email protected]>

---------

Co-authored-by: amyeroberts <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants