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

add Phi3 in transformers module and cache utils #825

Merged
merged 4 commits into from
Feb 10, 2025

Conversation

itruonghai
Copy link
Collaborator

@itruonghai itruonghai commented Jan 16, 2025

What does this PR do?

This PR introduces the Phi3 model into the MindONE transformers, enhancing the framework's capabilities with advanced caching utilities. Corresponding tests have been added under tests/transformers_tests/models to ensure the integrity and performance of the implementation.

Performance Metrics:

The table below summarizes the test results for Phi3 across different numeric formats and execution modes, which passed the threshold for each data type:

Mode FP32 (≤ 5e-4) FP16 (≤ 5e-3) BF16 (≤ 5e-3)
GRAPH MODE 1.33e-7 8.73e-5 0.0046
PYNATIVE MODE 1.37e-7 8.73e-5 0.0046

These results validate the functionality and efficiency of the Phi3 integration, maintaining precise computational outputs across varied data types.

Fixes # (issue)

Adds # (feature)

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

@itruonghai itruonghai requested a review from vigo999 as a code owner January 16, 2025 01:47
@@ -44,6 +44,13 @@
MT5Model,
MT5PreTrainedModel,
)
from .models.phi3 import (
Copy link
Collaborator

Choose a reason for hiding this comment

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

add st in mindone/tests/transformers_tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the performance results, running with tests/transformers_tests/models/phi3/test_modeling_phi3.py

@itruonghai itruonghai reopened this Feb 7, 2025
@SamitHuang SamitHuang added this pull request to the merge queue Feb 10, 2025
Merged via the queue into mindspore-lab:master with commit f73a600 Feb 10, 2025
3 checks passed
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.

4 participants