-
Couldn't load subscription status.
- Fork 88
feat(transformers): add ModernBERT Decoder (v4.54.1) #1397
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?
feat(transformers): add ModernBERT Decoder (v4.54.1) #1397
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 enhances 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 ModernBERT Decoder, which is a valuable addition. However, there are a few critical issues that need to be addressed before merging. Firstly, there are some copy-paste errors in the auto-model configuration files that incorrectly map modernbert-decoder to MobileBert components. Secondly, a change to the ModernBertRotaryEmbedding constructor signature breaks the existing ModernBertModel as the call site was not updated. Please address these issues to ensure the new model integrates correctly and doesn't introduce regressions.
|
|
||
| class ModernBertRotaryEmbedding(nn.Cell): | ||
| def __init__(self, config: ModernBertConfig, dim: int, base: float): | ||
| def __init__(self, config: ModernBertConfig): |
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.
While removing the unused dim and base parameters from this __init__ method is a good cleanup, the call to this constructor within ModernBertAttention in this same file has not been updated. This will cause a TypeError when instantiating ModernBertModel.
Please update the call site at mindone/transformers/models/modernbert/modeling_modernbert.py:317 to match the new signature:
self.rotary_emb = ModernBertRotaryEmbedding(config=config)| ("mobilevitv2", "MobileViTV2Config"), | ||
| ("mobilenet_v1", "MobileNetV1Config"), | ||
| ("mobilenet_v2", "MobileNetV2Config"), | ||
| ("modernbert-decoder", "MobileBertDecoderConfig"), |
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.
| ("mobilevitv2", "MobileViTV2"), | ||
| ("mobilenet_v1", "MobileNetV1"), | ||
| ("mobilenet_v2", "MobileNetV2"), | ||
| ("modernbert-decoder", "MobileBERTDecoder"), |
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.
895e1cc to
fd40c29
Compare
fd40c29 to
f8cff8e
Compare
What does this PR do?
Adds # (feature)
Add ModernBERT Decoder 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