-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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 device issue in OpenLlamaModelTest::test_model_parallelism
#24195
Conversation
@@ -736,12 +736,16 @@ def forward( | |||
|
|||
hidden_states = outputs[0] | |||
if self.config.shared_input_output_embedding: | |||
logits = torch.einsum("blh,vh->blv", hidden_states, self.model.embed_tokens.weight) | |||
logits = torch.einsum( | |||
"blh,vh->blv", hidden_states.to(self.model.embed_tokens.weight.device), self.model.embed_tokens.weight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send hidden_states
(lighter) to embedding's (heavy) device.
else: | ||
logits = self.lm_head(hidden_states) | ||
|
||
loss = None | ||
if labels is not None: | ||
# move labels to correct device to enable model parallelism | ||
labels = labels.to(logits.device) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just copied from other modeling files.
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes!
…gingface#24195) fix Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
What does this PR do?
See the comments in the changes.
Currently, CI has a failure