Skip to content

[NLLB-MoE] Fix NLLB MoE 4bit inference#27012

Merged
younesbelkada merged 2 commits intohuggingface:mainfrom
younesbelkada:fix-nllb-moe
Oct 23, 2023
Merged

[NLLB-MoE] Fix NLLB MoE 4bit inference#27012
younesbelkada merged 2 commits intohuggingface:mainfrom
younesbelkada:fix-nllb-moe

Conversation

@younesbelkada
Copy link
Contributor

What does this PR do?

Fixes: #26898

The hidden states gets silenty casted in unint8 leading to the error described in #26898

The check and self.fc2.weight.dtype != torch.int8 is not sufficient in order to cover 4bit models, for these models the weights are in uint8, hence adding an extra condition to cover 4bit models fixes the inference issue

cc @ArthurZucker

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 23, 2023

The documentation is not available anymore as the PR was closed or merged.

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.

Interesting! Thanks for the fix

@younesbelkada younesbelkada merged commit 244a53e into huggingface:main Oct 23, 2023
@younesbelkada younesbelkada deleted the fix-nllb-moe branch October 23, 2023 12:54
@CAH9487
Copy link

CAH9487 commented Oct 23, 2023

Thanks!

EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 19, 2023
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.

can't forward 4bit nllb-moe-54b (RuntimeError: result type Float can't be cast to the desired output type Byte)

4 participants