-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[BugFix] Implement RoPE for GPT-J #941
Conversation
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.
LGTM! Left a small comment about an alternative coding style. Feel free to choose the one that you think is better.
@@ -253,8 +253,10 @@ def __init__( | |||
max_position: int = 8192, | |||
base: int = 10000, | |||
num_kv_heads: Optional[int] = None, | |||
is_neox_style: bool = True, |
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.
Nit: Do you think this will be more clear?
is_neox_style: bool = True, | |
style: str = "neox", # Options: ["neox", "gptj"] |
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.
To my knowledge, there are only two types of RoPE in terms of how they rotate the query and key vectors (To my understanding, the rope scaling stuffs use the GPT-NeoX RoPE). I think we can change the interface after we find more RoPEs to support.
Fixes #747 and fixes #590
This PR fixes a bug in the GPT-J model implementation. The GPT-J model uses a rotary embedding that is slightly different from the GPT-NeoX style rotary embedding (which is commonly used for LLaMA and recent models). The difference isn't considered in the vLLM's current implementation. The PR resolves this by adding a RoPE kernel for GPT-J. After this fix, I've checked that the outputs of GPT-J when using FP32 and argmax sampling match the HF's outputs.
NOTE: The PR should be merged after #938