Skip to content
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

feat(transformers): add GEMMA2 #821

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

townwish4git
Copy link
Contributor

What does this PR do?

-Gemma2 report-

Add Gemma2 to MindONE transformers, for MindONE diffusers text-encoder

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Did you make sure to update the documentation with your changes? E.g. record bug fixes or new features in What's New. Here are the
    documentation guidelines
  • Did you build and run the code without any errors?
  • Did you report the running environment (NPU type/MS version) and performance in the doc? (better record it for data loading, model inference, or training tasks)
  • Did you write any new necessary tests?

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

@townwish4git townwish4git requested a review from vigo999 as a code owner January 13, 2025 09:48
Comment on lines 1 to 5
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/gemma2/modular_gemma2.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
# the file from the modular. If any change should be done, please apply the change to the
# modular_gemma2.py file directly. One of our CI enforces this.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may remove this comment?


if past_key_value is not None:
raise NotImplementedError(
"Gemma2 is only used as diffusers text-encoder and will not be called sequently, it need no cache."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need -> needs

position_ids: Optional[ms.Tensor] = None,
past_key_value: Optional[Cache] = None,
output_attentions: bool = False,
use_cache: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May add docstring to claim use_cache is not supported

@townwish4git
Copy link
Contributor Author

townwish4git commented Jan 17, 2025

参考检视意见,已:

  • 删除modeling_gemma2.py文件开头的自动生成警告;
  • 'need' -> 'needs' in comments
  • raise NotImplementedError以表明不支持KV Cache
  • 新增Gemma2模型UT
  • 更新验证环境transformers版本v4.41.2 -> v4.47.1(≥4.42),在mindone/tests/transformers_tests范围内未引入新的失败用例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants