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

Quantized checkpoint support in export and deploy modules #8859

Merged
merged 19 commits into from
Apr 23, 2024

Conversation

janekl
Copy link
Collaborator

@janekl janekl commented Apr 9, 2024

What does this PR do ?

Add support for testing, deploying and running quantized "qnemo" checkpoints in nemo.deploy and nemo.export modules.

Collection: NLP

Changelog

  • qnemo support
  • bump ammo version to 0.9.4
  • update code for trt-llm 0.9.0
  • Lambada evaluation setup
  • timing of evaluation (with minor improvements)
  • documentation

Usage

Building TensorRT-LLM engine and running a basic prompt:

from nemo.export import TensorRTLLM


trt_llm_exporter = TensorRTLLM(model_dir="/path/to/trt_llm_engine_folder")
trt_llm_exporter.export(
    nemo_checkpoint_path="/path/to/qnemo/ckpt.qnemo",
    model_type="llama",
    n_gpus=1,
)
output = trt_llm_exporter.forward(["Hi, how are you?", "I am good, thanks, how about you?"])

Running Lambada test locally:

python tests/export/test_nemo_export.py \
  --model_name local \
  --model_type llama \
  --checkpoint_dir /path/to/qnemo/ckpt.qnemo \
  --trt_llm_model_dir /path/to/trt_llm_engine_folder \
  --min_gpus 1 \
  --run_accuracy \
  --test_deployment True \
  --test_data_path lambada.json

Jenkins CI

To run Jenkins, a NeMo User with write access must comment jenkins on the PR.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

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

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: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
pre-commit-ci bot and others added 2 commits April 9, 2024 13:46
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
@janekl janekl mentioned this pull request Apr 10, 2024
8 tasks
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
@github-actions github-actions bot added the NLP label Apr 10, 2024
@janekl
Copy link
Collaborator Author

janekl commented Apr 10, 2024

jenkins

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
@github-actions github-actions bot added the CI label Apr 19, 2024
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>
nemo/export/tarutils.py Dismissed Show dismissed Hide dismissed
Copy link
Collaborator

@oyilmaz-nvidia oyilmaz-nvidia left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@janekl janekl merged commit 571a425 into main Apr 23, 2024
128 checks passed
@janekl janekl deleted the jlasek/qnemo_support branch April 23, 2024 07:41
alxzhang-amazon pushed a commit to alxzhang-amazon/NeMo that referenced this pull request Apr 26, 2024
* Resolve engine build command for int8_sq quantization

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix links and typos

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Add quantization docs to ToC

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Opt for using torchrun

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable exporting and running quantized qnemo checkpoints

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Report evaluation time and shorten passing results around

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix undefined model_info

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Unfold import path

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable HF tokenizer

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add copyright headers

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Update AMMO to 0.9.4

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Unpack qnemo checkpoint if it's a tarball

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Format results display

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

---------

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Harper <complex451@gmail.com>
galv pushed a commit to galv/NeMo that referenced this pull request Apr 29, 2024
* Resolve engine build command for int8_sq quantization

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix links and typos

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Add quantization docs to ToC

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Opt for using torchrun

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable exporting and running quantized qnemo checkpoints

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Report evaluation time and shorten passing results around

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix undefined model_info

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Unfold import path

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable HF tokenizer

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add copyright headers

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Update AMMO to 0.9.4

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Unpack qnemo checkpoint if it's a tarball

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Format results display

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

---------

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Harper <complex451@gmail.com>
suiyoubi pushed a commit that referenced this pull request May 2, 2024
* Resolve engine build command for int8_sq quantization

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix links and typos

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Add quantization docs to ToC

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Opt for using torchrun

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable exporting and running quantized qnemo checkpoints

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Report evaluation time and shorten passing results around

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix undefined model_info

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Unfold import path

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable HF tokenizer

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add copyright headers

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Update AMMO to 0.9.4

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Unpack qnemo checkpoint if it's a tarball

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Format results display

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

---------

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Harper <complex451@gmail.com>
Signed-off-by: Ao Tang <aot@nvidia.com>
rohitrango pushed a commit to rohitrango/NeMo that referenced this pull request Jun 25, 2024
* Resolve engine build command for int8_sq quantization

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix links and typos

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Add quantization docs to ToC

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Opt for using torchrun

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable exporting and running quantized qnemo checkpoints

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Report evaluation time and shorten passing results around

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Fix undefined model_info

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Unfold import path

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Enable HF tokenizer

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add copyright headers

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Update AMMO to 0.9.4

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Unpack qnemo checkpoint if it's a tarball

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

* Format results display

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>

---------

Signed-off-by: Jan Lasek <janek.lasek@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Harper <complex451@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants