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

Intgerate Intel® Extension for Transformers weight-only quantization into Lightning Fabric API #19125

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

yuwenzho
Copy link

@yuwenzho yuwenzho commented Dec 8, 2023

What does this PR do?

We are the team working on the development of Intel® Extension for Transformers. We would like to discuss the quantize feature in relation to our projects.

Allow us to provide an introduction to both projects firstly:

  • Intel® Extension for Transformers (ITREX) is an innovative toolkit to accelerate Transformer-based models on Intel platforms, in particular effective on 4th Intel Xeon Scalable processor Sapphire Rapids (codenamed Sapphire Rapids).

We would like to integrate ITREX into the PyTorch Lightning Fabric API. This integration could involve INT8/INT4/FP4/NF4 weight-only quantization feature.

Here is a simple use case:

from lightning.fabric.plugins import ITREXPrecision

precision = ITREXPrecision(mode="int8") # mode: Literal["int8", "int4_fullrange", "int4_clip", "nf4", "fp4_e2m1"]
fabric = Fabric(plugins=precision)
model = MyModel()
model = fabric.setup(model)

For more details of ITREX 4-bit, please refer to the medium blog of Intel-Optimized Llama.CPP

For #18770

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--19125.org.readthedocs.build/en/19125/

@github-actions github-actions bot added docs Documentation related fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package dependencies Pull requests that update a dependency file labels Dec 8, 2023
Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Merging #19125 (93f1de3) into master (b5d4ee5) will decrease coverage by 30%.
Report is 149 commits behind head on master.
The diff coverage is 48%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19125      +/-   ##
==========================================
- Coverage      83%      54%     -30%     
==========================================
  Files         445      441       -4     
  Lines       37289    37212      -77     
==========================================
- Hits        31107    19994   -11113     
- Misses       6182    17218   +11036     

@mergify mergify bot removed the has conflicts label Jan 3, 2024
@yuwenzho
Copy link
Author

yuwenzho commented Jan 8, 2024

Please review this PR.

@mergify mergify bot removed the has conflicts label Jan 10, 2024
Copy link

gitguardian bot commented Jan 16, 2024

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
- Generic High Entropy Secret 78fa3af tests/tests_app/utilities/test_login.py View secret
- Base64 Basic Authentication 78fa3af tests/tests_app/utilities/test_login.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@mergify mergify bot added the has conflicts label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file docs Documentation related fabric lightning.fabric.Fabric has conflicts pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants