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

[tests] add require_torch_sdpa for test that needs sdpa support #30408

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

faaany
Copy link
Contributor

@faaany faaany commented Apr 23, 2024

What does this PR do?

I got this test failed in my XPU environment. After debugging, I found that the EXPECTED_LOGITS in this test are computed with the assumption that _attn_implementation is set to sdpa. The code for setting the _attn_implementation are this line and this line. I experimented to downgrade my torch version to make _attn_implementation value to eager and it fails on CUDA. So we neeed to add the maker require_torch_sdpa to this test.

@ArthurZucker and @amyeroberts

@faaany faaany changed the title Cuda [tests] add require_torch_sdpa for test that needs sdpa support Apr 23, 2024
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!

Looks good to me! Would be great to add the bnb requirement for the other test too

@@ -393,6 +393,7 @@ def test_batched_4bit(self):
output = model.generate(**inputs, max_new_tokens=40, do_sample=False)
self.assertEqual(tokenizer.batch_decode(output, skip_special_tokens=True), EXPECTED_TEXT)

@require_torch_sdpa
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the test about should have require_bitsandbytes too 👀

@ydshieh If we have this requirement, will this test be run as part of the slow overnight tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amyeroberts I pushed a commit to add the require_bitsandbytes flag for test_batched_4bit, test_batched_small_model_logits is fine without bitsandbytes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@amyeroberts Well, I guess I made a huge mistake in #29208 where I removed

# Add bitsandbytes for mixed int8 testing
RUN python3 -m pip install --no-cache-dir bitsandbytes

because we aimed to move the quantization tests outside the main model CI job.

@younesbelkada @SunMarc I think we should add the above back to

docker/transformers-all-latest-gpu/Dockerfile

as there are some model tests using bnb

class InstructBlipModelIntegrationTest(unittest.TestCase):
    @require_bitsandbytes
    @require_accelerate
    def test_inference_vicuna_7b(self):

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes sounds great ! #30427

Copy link
Member

Choose a reason for hiding this comment

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

I see that there are around 20 models with bnb tests. So yeah, let's add bitsandbytes package in the main CI.

@amyeroberts
Copy link
Collaborator

Thanks for handling this and updating!

@amyeroberts amyeroberts merged commit 2d61823 into huggingface:main Apr 23, 2024
17 checks passed
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

5 participants