Skip to content

Avoid build crashes when torch.version.xpu doesn't exist and fix Llama4 processor tests #37346

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

Merged
merged 5 commits into from
Apr 7, 2025

Conversation

Rocketknight1
Copy link
Member

Quick update to #37126 which breaks on my local machine because torch.version.xpu doesn't exist. I'm not sure which versions that exists for and which doesn't, but we can just use getattr() to avoid crashes in those cases either way.

@Rocketknight1
Copy link
Member Author

In future we may want to refactor this to use is_torch_xpu_available() or some other check, but this should fix things for now cc @yao-matrix

@Rocketknight1 Rocketknight1 marked this pull request as ready for review April 7, 2025 14:39
@github-actions github-actions bot requested a review from ArthurZucker April 7, 2025 14:39
Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

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

Thank you for fixing.

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

@Rocketknight1 Rocketknight1 changed the title Avoid build crashes when torch.version.xpu doesn't exist Avoid build crashes when torch.version.xpu doesn't exist and fix Llama4 processor tests Apr 7, 2025
@Rocketknight1
Copy link
Member Author

Adding the Llama4 processor test fixes to this PR because they're making the CI red, so I can't merge without them. cc @ydshieh @ArthurZucker @zucchini-nlp

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Thanks! The test_image_chat_template_accepts_processing_kwargs thing will be fixed by #37275, so we can skip for a while, not big deal :)

@Rocketknight1
Copy link
Member Author

One more error here, this time in test_image_processing. Doesn't seem to be related to the changes I made, cc @zucchini-nlp @qubvel can you see the problem? Are we saving a broken imageprocessor somehow?

@zucchini-nlp
Copy link
Member

@Rocketknight1 seems to be that we try to load slow processor while fast was saved. I am not sure if we support loading this way, can check real quick

@Rocketknight1
Copy link
Member Author

@zucchini-nlp just going to add another skip for now to make the CI clear!

@zucchini-nlp
Copy link
Member

zucchini-nlp commented Apr 7, 2025

Oh wait, slow processor doesn't even exist. Makes sense to skip, should not be tested, thanks! We'll make this test more generalizable, in subsequent PRs :)

@Rocketknight1
Copy link
Member Author

Tests green, merging to clear the CI!

@Rocketknight1 Rocketknight1 merged commit f789f96 into main Apr 7, 2025
21 checks passed
@Rocketknight1 Rocketknight1 deleted the xpu_not_always_present branch April 7, 2025 16:05
vasqu pushed a commit to vasqu/transformers that referenced this pull request Apr 7, 2025
…a4 processor tests (huggingface#37346)

* Avoid build crashes when torch.version.xpu doesn't exist

* Trigger tests

* Fix image token and skip inappropriate test

* Remove ignore_errors=True

* Add another skip
@yao-matrix
Copy link
Contributor

yao-matrix commented Apr 8, 2025

thx, get_attr is safer, will follow up on a more safter way to check.

cyr0930 pushed a commit to cyr0930/transformers that referenced this pull request Apr 18, 2025
…a4 processor tests (huggingface#37346)

* Avoid build crashes when torch.version.xpu doesn't exist

* Trigger tests

* Fix image token and skip inappropriate test

* Remove ignore_errors=True

* Add another skip
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request May 14, 2025
…a4 processor tests (huggingface#37346)

* Avoid build crashes when torch.version.xpu doesn't exist

* Trigger tests

* Fix image token and skip inappropriate test

* Remove ignore_errors=True

* Add another skip
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.

5 participants