-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Update to using Model Optimizer (formerly AMMO) in PTQ workflow #9178
Conversation
1a7fa1f
to
ad3dc28
Compare
@@ -197,7 +202,7 @@ def forward_loop(): | |||
print(f"Calibrating batch {i}") | |||
model.predict_step(batch, i) | |||
|
|||
model = atq.quantize(model, self.atq_config, forward_loop) | |||
model = mtq.quantize(model, self.quant_cfg, forward_loop) |
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.
Please note that def forward_loop(model): ...
is recommended over def forward_loop(): ...
and the latter one will be deprecated soon
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.
changed
.github/workflows/cicd-main.yml
Outdated
# AMMO installation | ||
pip install nvidia-ammo~=0.9.0 --extra-index-url https://pypi.nvidia.com --no-cache-dir | ||
# ModelOpt installation | ||
pip install nvidia-modelopt[all]~=0.11.0 --extra-index-url https://pypi.nvidia.com --no-cache-dir |
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.
I believe you dont need onnx or deployment dependencies here
pip install nvidia-modelopt[all]~=0.11.0 --extra-index-url https://pypi.nvidia.com --no-cache-dir | |
pip install nvidia-modelopt[torch]~=0.11.0 --extra-index-url https://pypi.nvidia.com --no-cache-dir |
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.
done
4f4080e
to
d54836b
Compare
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.
megatron_gpt_quantization
may be a more appropriate and consistent name
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.
Maybe.. WDYT @ericharper ?
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.
Background is that the script is supposed to support multiple models -- gpt, llama, gemma etc. by specifying decoder_type param -- so I decided to rename it megatron_llama_quantization.py -> megatron_quantization.py.
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.
Let's postpone final decision after merge as this name also is tied to the one used in NeMo-Launcher
Can we look to merge this PR soon? @janekl @kevalmorabia97 |
@pablo-garay no objection from my side. I don't have permissions to approve but this LGTM |
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: janekl <janekl@users.noreply.github.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: janekl <janekl@users.noreply.github.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
07faf83
to
4813f10
Compare
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
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.
LGTM.
* Update PTQ to use nvidia-modelopt Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Restore PTQ tests Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Update docs Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Comment on apply_rope_fusion Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Support for calibration PP > 1 Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Apply isort and black reformatting Signed-off-by: janekl <janekl@users.noreply.github.com> * Fix cicd-main.yml indent Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Set data/tensor parallel groups Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Install only torch dependecies Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Follow up on recent modelopt changes Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Model support matrix Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Apply isort and black reformatting Signed-off-by: janekl <janekl@users.noreply.github.com> * Rename PTQ script as it should be model-agnostic Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Remove unused import Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Update setup instructions Signed-off-by: Jan Lasek <janek.lasek@gmail.com> --------- Signed-off-by: Jan Lasek <janek.lasek@gmail.com> Signed-off-by: janekl <janekl@users.noreply.github.com> Co-authored-by: janekl <janekl@users.noreply.github.com>
…IA#9178) * Update PTQ to use nvidia-modelopt Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Restore PTQ tests Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Update docs Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Comment on apply_rope_fusion Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Support for calibration PP > 1 Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Apply isort and black reformatting Signed-off-by: janekl <janekl@users.noreply.github.com> * Fix cicd-main.yml indent Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Set data/tensor parallel groups Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Install only torch dependecies Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Follow up on recent modelopt changes Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Model support matrix Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Apply isort and black reformatting Signed-off-by: janekl <janekl@users.noreply.github.com> * Rename PTQ script as it should be model-agnostic Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Remove unused import Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Update setup instructions Signed-off-by: Jan Lasek <janek.lasek@gmail.com> --------- Signed-off-by: Jan Lasek <janek.lasek@gmail.com> Signed-off-by: janekl <janekl@users.noreply.github.com> Co-authored-by: janekl <janekl@users.noreply.github.com> Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>
…IA#9178) * Update PTQ to use nvidia-modelopt Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Restore PTQ tests Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Update docs Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Comment on apply_rope_fusion Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Support for calibration PP > 1 Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Apply isort and black reformatting Signed-off-by: janekl <janekl@users.noreply.github.com> * Fix cicd-main.yml indent Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Set data/tensor parallel groups Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Install only torch dependecies Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Follow up on recent modelopt changes Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Model support matrix Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Apply isort and black reformatting Signed-off-by: janekl <janekl@users.noreply.github.com> * Rename PTQ script as it should be model-agnostic Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Remove unused import Signed-off-by: Jan Lasek <janek.lasek@gmail.com> * Update setup instructions Signed-off-by: Jan Lasek <janek.lasek@gmail.com> --------- Signed-off-by: Jan Lasek <janek.lasek@gmail.com> Signed-off-by: janekl <janekl@users.noreply.github.com> Co-authored-by: janekl <janekl@users.noreply.github.com>
What does this PR do ?
Summary:
apply_rope_fusion = True
by defaultCollection: NLP
Changelog
Usage
# Add a code snippet demonstrating how to use this
GitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information