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

Do not update past_key_values in place #652

Merged
merged 18 commits into from
Oct 12, 2023
Merged

Conversation

irenedea
Copy link
Contributor

@irenedea irenedea commented Oct 7, 2023

Fixes the forward pass in MPTModel to update not past_key_values in place and instead use a new list, presents. 🎁 Naming is inspired by gpt2.

This addresses the following error:

 RuntimeError: attn_bias (shape: torch.Size([1, 4, 1, 2])) is expected to broadcast to shape: torch.Size([1, 4, 1, 3]).

which occurs during multi-gpu generation for mpt models when one rank hits EOS before the others.

tests/test_hf_mpt_gen.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@dakinggg dakinggg left a comment

Choose a reason for hiding this comment

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

LGTM apart from my comment on the test. Also wait for @vchiley to look please.

Copy link
Contributor

@vchiley vchiley left a comment

Choose a reason for hiding this comment

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

nit: presents implies the current x, not the past...
the tensor its referring to is the past and presents.
no clue why gpt2 names it like this.
this is a nit because its just a naming convention comment.

otherwise lgtm

llmfoundry/models/mpt/modeling_mpt.py Show resolved Hide resolved
@dakinggg
Copy link
Collaborator

@irenedea is this ready to merge?

Copy link
Collaborator

@dakinggg dakinggg left a comment

Choose a reason for hiding this comment

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

one nit

@irenedea irenedea enabled auto-merge (squash) October 12, 2023 21:47
@irenedea irenedea merged commit 3c7421c into mosaicml:main Oct 12, 2023
12 checks passed
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.

None yet

3 participants