Skip to content

fix encoder hook#25735

Merged
SunMarc merged 2 commits intohuggingface:mainfrom
SunMarc:fix_encoder_hook
Aug 25, 2023
Merged

fix encoder hook#25735
SunMarc merged 2 commits intohuggingface:mainfrom
SunMarc:fix_encoder_hook

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!

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