-
Couldn't load subscription status.
- Fork 88
feat(transformers): add EXAONE 4 (v4.54.1) #1396
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @alien-0119, 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 significantly expands the Highlights
Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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
|
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.
Code Review
This pull request introduces the EXAONE 4 model, including its implementation, configuration, and integration with auto-model classes, along with corresponding tests. The changes largely follow the standard procedure for adding a new model. My review has identified a potential high-severity issue in the application of Rotary Position Embeddings (RoPE) for hybrid attention configurations, which could impact model correctness. Additionally, a medium-severity typo in a code example within a docstring has been noted, which could cause confusion for users.
| # We use global NoPE for hybrid attention model | ||
| if self.sliding_window is None or self.is_sliding: | ||
| query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin) |
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.
The logic for applying Rotary Position Embeddings (RoPE) appears incorrect for hybrid attention models. When self.sliding_window is not None, RoPE is not applied to full attention layers (self.is_sliding is False). This would leave these layers without positional information, likely causing incorrect model behavior. Positional embeddings are typically required for all attention layers to process token order correctly.
The condition should likely be removed to apply RoPE to all layers. Additionally, the comment on line 220 seems to have a typo and should likely be 'RoPE' instead of 'NoPE'.
# We use global RoPE for hybrid attention model
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)| >>> input_ids = ms.tensor(input_ids) | ||
|
|
||
| >>> output = model.generate(input_ids, max_new_tokens=128) | ||
| >>> tokenizer.decode(out` put[0], skip_special_tokens=False) |
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.
de4bf0a to
fe2afff
Compare
What does this PR do?
Adds # (feature)
Add EXAONE 4 model and fast ut.
Usage Example:
Performance:
Experiments were tested on Ascend Atlas 800T A2 machines with mindspore 2.7.0 pynative mode.
Before submitting
What's New. Here are thedocumentation guidelines
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@xxx