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 encoder hook #25735

Merged
merged 2 commits into from Aug 25, 2023
Merged

fix encoder hook #25735

merged 2 commits into from Aug 25, 2023

Conversation

SunMarc
Copy link
Member

@SunMarc SunMarc commented Aug 24, 2023

What does this PR do ?

Fixes #23385. This PR makes sure that we indeed have a hook with io_same_device=True on the encoder which was not the case previously. If we don't have that, the generation will fail as the output of the encoder won't be on the same device as unfinished_sequences = torch.ones(input_ids.shape[0], dtype=torch.long, device=input_ids.device) and this will lead to an error here: next_tokens = next_tokens * unfinished_sequences + pad_token_id * (1 - unfinished_sequences).

@SunMarc SunMarc requested a review from sgugger August 24, 2023 15:49
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 24, 2023

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

Copy link
Collaborator

@sgugger sgugger 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 the fix!

@SunMarc SunMarc merged commit 35c570c into huggingface:main Aug 25, 2023
21 checks passed
@SunMarc SunMarc deleted the fix_encoder_hook branch August 25, 2023 13:36
parambharat pushed a commit to parambharat/transformers that referenced this pull request Sep 26, 2023
* fix encoder hook

* style
blbadger pushed a commit to blbadger/transformers that referenced this pull request Nov 8, 2023
* fix encoder hook

* style
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 18, 2023
* fix encoder hook

* style
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.

NLLB-MoE 54B multi-GPU inference throws "Expected all tensors to be on the same device" error
3 participants