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

MPS: isin_mps_friendly can support 0D tensors #34538

Merged
merged 5 commits into from
Nov 4, 2024
Merged

Conversation

gante
Copy link
Member

@gante gante commented Oct 31, 2024

What does this PR do?

Fixes #33786

Applies the fix in isin_mps_friendly as suggested by @Swastik-Swarup-Dash here

@gante gante requested a review from ArthurZucker October 31, 2024 15:23
@gante gante changed the title apply fix MPS: isin_mps_friendly can support 0D tensors Oct 31, 2024
@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.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Do we need a patch for this? 🤗

@gante
Copy link
Member Author

gante commented Oct 31, 2024

Do we need a patch for this? 🤗

I don't think so, it's quite niche 🤔 If we make a patch, yes, let's include it :D

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Thanks 🤗

Comment on lines +325 to +327
test_elements = torch.tensor(test_elements)
if test_elements.ndim == 0:
test_elements = test_elements.unsqueeze(0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we ought to open the issue on pytorch / link the tracker !

Copy link
Member Author

Choose a reason for hiding this comment

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

On torch >=2.4 this is fixed, i.e. torch.isin is supported with mps

(in other words, this fix only affects older versions of torch) 🤗

@gante gante merged commit 34927b0 into huggingface:main Nov 4, 2024
26 checks passed
@gante gante deleted the is_in_fix branch November 4, 2024 16:18
@Swastik-Swarup-Dash
Copy link

Thanks @gante for using my approach.

ArthurZucker pushed a commit that referenced this pull request Nov 5, 2024
* apply fix

* tested

* make fixup
ArthurZucker pushed a commit that referenced this pull request Nov 5, 2024
* apply fix

* tested

* make fixup
2015aroras pushed a commit to 2015aroras/transformers that referenced this pull request Nov 15, 2024
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
BernardZach pushed a commit to innovationcore/transformers that referenced this pull request Dec 6, 2024
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.

mps failure with tts: IndexError: tuple index out of range in pytorch_utils.py
4 participants