-
Notifications
You must be signed in to change notification settings - Fork 89
feats(transformers):add seed_oss model #1441
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 @iugoood, 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 SeedOss model and its variants. The implementation appears solid and aligns with the library's existing patterns. However, I've identified a critical issue in a refactored test helper that could break other tests in the repository. Additionally, I've suggested an improvement to the test coverage for the new model and a minor style fix for better code maintainability.
| def __init__( | ||
| self, | ||
| parent, | ||
| batch_size=13, |
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 parent argument has been removed from the __init__ method, but the create_and_check_model method in this class still references self.parent. This will cause an AttributeError when create_and_check_model is called.
Please refactor create_and_check_model to not depend on self.parent, or remove the method if it's no longer used by any tests. For instance, the method could return the values to be asserted, and the calling test could perform the assertion.
| __all__ = [ | ||
| "SeedOssForCausalLM", | ||
| "SeedOssForQuestionAnswering", | ||
| "SeedOssPreTrainedModel", | ||
| "SeedOssModel", | ||
| "SeedOssForSequenceClassification", | ||
| "SeedOssForTokenClassification", | ||
| ] |
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.
For better code style and maintainability, the __all__ list should be sorted alphabetically.
| __all__ = [ | |
| "SeedOssForCausalLM", | |
| "SeedOssForQuestionAnswering", | |
| "SeedOssPreTrainedModel", | |
| "SeedOssModel", | |
| "SeedOssForSequenceClassification", | |
| "SeedOssForTokenClassification", | |
| ] | |
| __all__ = [ | |
| "SeedOssForCausalLM", | |
| "SeedOssForQuestionAnswering", | |
| "SeedOssForSequenceClassification", | |
| "SeedOssForTokenClassification", | |
| "SeedOssModel", | |
| "SeedOssPreTrainedModel", | |
| ] |
| SEEDOSS_CASES = [ | ||
| [ | ||
| "SeedOssModel", | ||
| "transformers.SeedOssModel", | ||
| "mindone.transformers.SeedOssModel", | ||
| (config,), | ||
| {}, | ||
| (), | ||
| { | ||
| "input_ids": inputs_dict["input_ids"], | ||
| "attention_mask": inputs_dict["attention_mask"], | ||
| "use_cache": False, | ||
| }, | ||
| { | ||
| "last_hidden_state": 0, | ||
| }, | ||
| ], | ||
| ] |
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 test suite for the new SeedOss model currently only includes a test case for the base SeedOssModel. To ensure comprehensive testing, it's important to also verify the correctness of the model with task-specific heads, especially SeedOssForCausalLM.
Please consider adding another test case to SEEDOSS_CASES for SeedOssForCausalLM to validate its output against the PyTorch equivalent. This will improve test coverage and help catch potential issues with the LM head implementation.
Add
1 add seed_oss model
2 add UT
Due to excessive weight causing an out-of-memory (OOM) error on the NPU, only the first 12 layers are being tested.
Usage
Performance
Experiments are tested on Ascend Atlas 800T A2 machines with mindspore 2.6.0.