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

FIX Use torch.long instead of torch.int in LoftQ for PyTorch versions <2.x #1320

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

BenjaminBossan
Copy link
Member

Resolves #1307

For PyTorch versions below 2, the usage of torch.int instead of torch.long when indexing inside of dequantize_block for LoftQ leads to an error. The fix consists of using torch.long.

I tested the change with my local GPU for both PyTorch 1.13 and 2.1 and the tests passed for both.

Note that initially, it seemed to be an issue with seq2seq models, until it was discovered to be PyTorch-related. This is why I added the seq2seq tests. Even though the tests not really necessary, I kept them in.

Solves huggingface#1307

For PyTorch < v2.x, using torch.int does not work for indexing, thus
using torch.long.
@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
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Clean, thank you !

@BenjaminBossan BenjaminBossan merged commit 4186c9b into huggingface:main Jan 8, 2024
14 checks passed
@BenjaminBossan BenjaminBossan deleted the loftq-seq2seq branch January 8, 2024 09:45
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.

An error occurs when using LoftQ. IndexError
3 participants