Repository navigation
GPTJForCausalLM Support - #7839
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @wenchen76, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request adds comprehensive support for the GPT-J causal language model to the sglang framework. It provides the full model architecture definition and includes the necessary logic to load pre-trained GPT-J weights, making the model ready for inference within the system.
Highlights
- New Model Support: This pull request introduces a complete implementation of the GPT-J model architecture, including its attention, MLP, and block structures, specifically adapted for the
sglanginference runtime. This enables the framework to support GPT-J models for causal language modeling tasks. - HuggingFace Compatibility: A
load_weightsmethod has been added to theGPTJForCausalLMclass. This method is designed to facilitate seamless loading of pre-trained GPT-J model weights from HuggingFace, handling specific parameter mappings (e.g., QKV projections) and quantization scales. - Modular Architecture Implementation: The GPT-J model is implemented using a modular design, breaking down the architecture into
GPTJAttention,GPTJMLP,GPTJBlock, andGPTJModelclasses. These components leverage existingsglang.srt.layersfor parallel linear layers, attention mechanisms (RadixAttention), and rotary embeddings, ensuring integration with the framework's optimized operations.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request adds support for the GPT-J model architecture. The implementation correctly follows the parallel attention and MLP structure from the Hugging Face Transformers library and reuses existing components for tensor parallelism and quantization. The code is well-structured. I've identified one minor issue in the weight loading logic where there's some leftover code from another model, which should be removed for clarity.
|
Hi @b8zhong @lifuhuang, would you mind taking a look at this PR? Any comments or suggestions would be greatly appreciated. Thank you! |
6ceb002 to
989f9e7
Compare
b8zhong
left a comment
There was a problem hiding this comment.
@wenchen76 Hi, sorry for the delay. It looks good.
Can you add it to the supported model documentation? I'll try to get someone to review ASAP.
Hi @b8zhong, thank you! I'll add it shortly |
|
Hi @b8zhong, just updated the supported model documentation, thanks! |
|
Hi @b8zhong, just checking in — any updates on reviewing this PR? Thank you! |
Co-authored-by: b8zhong <[email protected]>
Co-authored-by: b8zhong <[email protected]>
Co-authored-by: b8zhong <[email protected]>
Motivation
Model Support Issue: #7429
This PR adds support for GPT-J
Modifications
Evaluation (MMLU)
Checklist