NeMo-Export-Deploy 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. nemo_export_deploy-0.1.0/LICENSE +201 -0
  2. nemo_export_deploy-0.1.0/NeMo_Export_Deploy.egg-info/PKG-INFO +472 -0
  3. nemo_export_deploy-0.1.0/NeMo_Export_Deploy.egg-info/SOURCES.txt +65 -0
  4. nemo_export_deploy-0.1.0/NeMo_Export_Deploy.egg-info/dependency_links.txt +1 -0
  5. nemo_export_deploy-0.1.0/NeMo_Export_Deploy.egg-info/requires.txt +59 -0
  6. nemo_export_deploy-0.1.0/NeMo_Export_Deploy.egg-info/top_level.txt +3 -0
  7. nemo_export_deploy-0.1.0/PKG-INFO +472 -0
  8. nemo_export_deploy-0.1.0/README.md +417 -0
  9. nemo_export_deploy-0.1.0/nemo_deploy/__init__.py +26 -0
  10. nemo_export_deploy-0.1.0/nemo_deploy/deploy_base.py +71 -0
  11. nemo_export_deploy-0.1.0/nemo_deploy/deploy_pytriton.py +173 -0
  12. nemo_export_deploy-0.1.0/nemo_deploy/deploy_ray.py +140 -0
  13. nemo_export_deploy-0.1.0/nemo_deploy/multimodal/__init__.py +16 -0
  14. nemo_export_deploy-0.1.0/nemo_deploy/multimodal/query_multimodal.py +184 -0
  15. nemo_export_deploy-0.1.0/nemo_deploy/nlp/__init__.py +23 -0
  16. nemo_export_deploy-0.1.0/nemo_deploy/nlp/hf_deployable.py +466 -0
  17. nemo_export_deploy-0.1.0/nemo_deploy/nlp/hf_deployable_ray.py +375 -0
  18. nemo_export_deploy-0.1.0/nemo_deploy/nlp/inference/inference_base.py +491 -0
  19. nemo_export_deploy-0.1.0/nemo_deploy/nlp/inference/tron_utils.py +485 -0
  20. nemo_export_deploy-0.1.0/nemo_deploy/nlp/megatronllm_deployable.py +538 -0
  21. nemo_export_deploy-0.1.0/nemo_deploy/nlp/megatronllm_deployable_ray.py +374 -0
  22. nemo_export_deploy-0.1.0/nemo_deploy/nlp/query_llm.py +518 -0
  23. nemo_export_deploy-0.1.0/nemo_deploy/nlp/trtllm_api_deployable.py +194 -0
  24. nemo_export_deploy-0.1.0/nemo_deploy/package_info.py +33 -0
  25. nemo_export_deploy-0.1.0/nemo_deploy/ray_utils.py +47 -0
  26. nemo_export_deploy-0.1.0/nemo_deploy/service/__init__.py +16 -0
  27. nemo_export_deploy-0.1.0/nemo_deploy/service/fastapi_interface_to_pytriton.py +319 -0
  28. nemo_export_deploy-0.1.0/nemo_deploy/service/rest_model_api.py +140 -0
  29. nemo_export_deploy-0.1.0/nemo_deploy/triton_deployable.py +32 -0
  30. nemo_export_deploy-0.1.0/nemo_deploy/utils.py +227 -0
  31. nemo_export_deploy-0.1.0/nemo_export/__init__.py +28 -0
  32. nemo_export_deploy-0.1.0/nemo_export/multimodal/__init__.py +13 -0
  33. nemo_export_deploy-0.1.0/nemo_export/multimodal/build.py +679 -0
  34. nemo_export_deploy-0.1.0/nemo_export/multimodal/run.py +989 -0
  35. nemo_export_deploy-0.1.0/nemo_export/onnx_llm_exporter.py +543 -0
  36. nemo_export_deploy-0.1.0/nemo_export/package_info.py +33 -0
  37. nemo_export_deploy-0.1.0/nemo_export/sentencepiece_tokenizer.py +286 -0
  38. nemo_export_deploy-0.1.0/nemo_export/tarutils.py +236 -0
  39. nemo_export_deploy-0.1.0/nemo_export/tensorrt_llm.py +1134 -0
  40. nemo_export_deploy-0.1.0/nemo_export/tensorrt_llm_deployable_ray.py +293 -0
  41. nemo_export_deploy-0.1.0/nemo_export/tensorrt_mm_exporter.py +377 -0
  42. nemo_export_deploy-0.1.0/nemo_export/tiktoken_tokenizer.py +120 -0
  43. nemo_export_deploy-0.1.0/nemo_export/trt_llm/__init__.py +13 -0
  44. nemo_export_deploy-0.1.0/nemo_export/trt_llm/nemo_ckpt_loader/__init__.py +13 -0
  45. nemo_export_deploy-0.1.0/nemo_export/trt_llm/nemo_ckpt_loader/nemo_file.py +433 -0
  46. nemo_export_deploy-0.1.0/nemo_export/trt_llm/qnemo/__init__.py +17 -0
  47. nemo_export_deploy-0.1.0/nemo_export/trt_llm/qnemo/qnemo_to_tensorrt_llm.py +128 -0
  48. nemo_export_deploy-0.1.0/nemo_export/trt_llm/qnemo/utils.py +32 -0
  49. nemo_export_deploy-0.1.0/nemo_export/trt_llm/tensorrt_llm_run.py +565 -0
  50. nemo_export_deploy-0.1.0/nemo_export/trt_llm/utils.py +69 -0
  51. nemo_export_deploy-0.1.0/nemo_export/utils/__init__.py +45 -0
  52. nemo_export_deploy-0.1.0/nemo_export/utils/_mock_import.py +78 -0
  53. nemo_export_deploy-0.1.0/nemo_export/utils/constants.py +16 -0
  54. nemo_export_deploy-0.1.0/nemo_export/utils/lora_converter.py +236 -0
  55. nemo_export_deploy-0.1.0/nemo_export/utils/model_loader.py +213 -0
  56. nemo_export_deploy-0.1.0/nemo_export/utils/utils.py +167 -0
  57. nemo_export_deploy-0.1.0/nemo_export/vllm/__init__.py +13 -0
  58. nemo_export_deploy-0.1.0/nemo_export/vllm/model_config.py +279 -0
  59. nemo_export_deploy-0.1.0/nemo_export/vllm/model_converters.py +480 -0
  60. nemo_export_deploy-0.1.0/nemo_export/vllm/model_loader.py +111 -0
  61. nemo_export_deploy-0.1.0/nemo_export/vllm_exporter.py +583 -0
  62. nemo_export_deploy-0.1.0/nemo_export/vllm_hf_exporter.py +154 -0
  63. nemo_export_deploy-0.1.0/nemo_export_deploy_common/__init__.py +19 -0
  64. nemo_export_deploy-0.1.0/nemo_export_deploy_common/import_utils.py +450 -0
  65. nemo_export_deploy-0.1.0/nemo_export_deploy_common/package_info.py +45 -0
  66. nemo_export_deploy-0.1.0/pyproject.toml +194 -0
  67. nemo_export_deploy-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,472 @@
1
+ Metadata-Version: 2.4
2
+ Name: NeMo-Export-Deploy
3
+ Version: 0.1.0
4
+ Summary: NeMo Export and Deploy - a library to export and deploy LLMs and MMs
5
+ License: Apache 2.0
6
+ Requires-Python: <3.13,>=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: megatron-core<0.14.0,>=0.13.0a0
10
+ Requires-Dist: nvidia-modelopt[torch]<0.32.0,>=0.29.0a0; sys_platform != "darwin"
11
+ Requires-Dist: nvidia-resiliency-ext<0.4.0,>=0.3.0a0; sys_platform != "darwin"
12
+ Requires-Dist: accelerate
13
+ Requires-Dist: fastapi
14
+ Requires-Dist: pydantic-settings
15
+ Requires-Dist: ray
16
+ Requires-Dist: ray[serve]
17
+ Requires-Dist: uvicorn
18
+ Requires-Dist: tensorstore
19
+ Requires-Dist: zarr<3.0.0,>=2.18.2
20
+ Requires-Dist: cloudpickle
21
+ Requires-Dist: fiddle
22
+ Requires-Dist: hydra-core<=1.3.2,>1.3
23
+ Requires-Dist: lightning
24
+ Requires-Dist: omegaconf>=2.3.0
25
+ Requires-Dist: peft
26
+ Requires-Dist: torch
27
+ Requires-Dist: torchvision
28
+ Requires-Dist: torchmetrics>=0.11.0
29
+ Requires-Dist: wandb
30
+ Requires-Dist: webdataset>=0.2.86
31
+ Requires-Dist: nvidia-pytriton; platform_system != "Darwin"
32
+ Requires-Dist: flashinfer-python==0.2.5
33
+ Requires-Dist: Pillow; platform_system != "Darwin" and platform_machine != "aarch64"
34
+ Requires-Dist: decord; platform_system != "Darwin" and platform_machine != "aarch64"
35
+ Requires-Dist: pyparsing>2.0.2
36
+ Requires-Dist: sentencepiece
37
+ Requires-Dist: tiktoken
38
+ Requires-Dist: einops
39
+ Requires-Dist: ijson
40
+ Requires-Dist: pyarrow<21.0.0
41
+ Provides-Extra: inframework
42
+ Provides-Extra: vllm
43
+ Requires-Dist: vllm==0.9.1; extra == "vllm"
44
+ Requires-Dist: pandas; extra == "vllm"
45
+ Requires-Dist: timm; extra == "vllm"
46
+ Requires-Dist: transformers~=4.53.0; extra == "vllm"
47
+ Requires-Dist: nvidia-modelopt[torch]<0.32.0,>=0.31.0a0; sys_platform != "darwin" and extra == "vllm"
48
+ Provides-Extra: trtllm
49
+ Requires-Dist: transformers~=4.51.0; extra == "trtllm"
50
+ Requires-Dist: tensorrt-llm~=0.20.0; extra == "trtllm"
51
+ Requires-Dist: nvidia-modelopt[torch]<0.30.0,>=0.29.0a0; sys_platform != "darwin" and extra == "trtllm"
52
+ Provides-Extra: te
53
+ Requires-Dist: transformer-engine[pytorch]==2.5.0; extra == "te"
54
+ Dynamic: license-file
55
+
56
+ <div align="center">
57
+
58
+ # NeMo Export-Deploy
59
+
60
+ </div>
61
+
62
+ <div align="center">
63
+
64
+ <!-- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -->
65
+ [![codecov](https://codecov.io/github/NVIDIA-NeMo/Export-Deploy/graph/badge.svg?token=4NMKZVOW2Z)](https://codecov.io/github/NVIDIA-NeMo/Export-Deploy)
66
+ [![CI/CD](https://img.shields.io/github/actions/workflow/status/NVIDIA-NeMo/Export-Deploy/cicd-main.yml?branch=main)](https://github.com/NVIDIA-NeMo/Export-Deploy/actions/workflows/cicd-main.yml)
67
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/release/python-3100/)
68
+ [![GitHub Stars](https://img.shields.io/github/stars/NVIDIA-NeMo/Export-Deploy.svg?style=social&label=Star)](https://github.com/NVIDIA-NeMo/Export-Deploy/stargazers/)
69
+
70
+ <!-- **Library with tooling and APIs for exporting and deploying NeMo and Hugging Face models with support of backends like TensorRT, TensorRT-LLM and vLLM through NVIDIA Triton Inference Server.** -->
71
+
72
+ [![📖 Documentation](https://img.shields.io/badge/docs-nvidia-informational?logo=book)](https://docs.nvidia.com/nemo/Export-Deploy/latest/index.html)
73
+ [![🔧 Installation](https://img.shields.io/badge/install-guide-blue?logo=terminal)](https://github.com/NVIDIA-NeMo/Export-Deploy/#-install)
74
+ [![🚀 Quick start](https://img.shields.io/badge/quick%20start-guide-success?logo=rocket)](https://github.com/NVIDIA-NeMo/Export-Deploy/#-get-started-quickly)
75
+ [![🤝 Contributing](https://img.shields.io/badge/contributing-guide-yellow?logo=github)](https://github.com/NVIDIA-NeMo/Export-Deploy/blob/main/CONTRIBUTING.md)
76
+
77
+ </div>
78
+
79
+ NeMo Framework is NVIDIA's GPU accelerated, end-to-end training framework for large language models (LLMs), multi-modal models and speech models. It enables seamless scaling of training (both pretraining and post-training) workloads from single GPU to thousand-node clusters for both 🤗Hugging Face/PyTorch and Megatron models. It includes a suite of libraries and recipe collections to help users train models from end to end. The **Export-Deploy library ("NeMo Export-Deploy")** provides tools and APIs for exporting and deploying NeMo and 🤗Hugging Face models to production environments. It supports various deployment paths including TensorRT, TensorRT-LLM, and vLLM deployment through NVIDIA Triton Inference Server.
80
+
81
+ ![image](docs/NeMo_Repo_Overview_ExportDeploy.png)
82
+
83
+ ## 🚀 Key Features
84
+
85
+ - Support for Large Language Models (LLMs) and Multimodal Models
86
+ - Export NeMo and Hugging Face models to optimized inference formats including TensorRT-LLM and vLLM
87
+ - Deploy NeMo and Hugging Face models using Ray Serve or NVIDIA Triton Inference Server
88
+ - Export quantized NeMo models (FP8, etc)
89
+ - Multi-GPU and distributed inference capabilities
90
+ - Multi-instance deployment options
91
+
92
+ ## Feature Support Matrix
93
+
94
+ ### Model Export Capabilities
95
+
96
+ | Model / Checkpoint | TensorRT-LLM | vLLM | ONNX | TensorRT |
97
+ |-------------------------------------------------------------------------------------------------|:----------------------------------------------:|:---------:|:--------------------------:|:----------------------:|
98
+ | [NeMo Framework - LLMs](https://docs.nvidia.com/nemo-framework/user-guide/latest/overview.html) | bf16, fp8, int8 (PTQ, QAT), fp4 (Coming Soon) | bf16 | N/A | N/A |
99
+ | [NeMo Framework - Multimodal Models](https://docs.nvidia.com/nemo-framework/user-guide/latest/overview.html) | bf16 | N/A | N/A | N/A |
100
+ | [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) | Coming Soon | Coming Soon | N/A | N/A |
101
+ | [Hugging Face](https://huggingface.co/docs/transformers/en/index) | bf16 | bf16 | N/A | N/A |
102
+ | [NIM Embedding](https://docs.nvidia.com/nim/nemo-retriever/text-embedding/latest/overview.html) | N/A | N/A | bf16, fp8, int8 (PTQ) | bf16, fp8, int8 (PTQ) |
103
+ | [NIM Reranking](https://docs.nvidia.com/nim/nemo-retriever/text-reranking/latest/overview.html) | N/A | N/A | Coming Soon | Coming Soon |
104
+
105
+ The support matrix above outlines the export capabilities for each model or checkpoint, including the supported precision options across various inference-optimized libraries. The export module enables exporting models that have been quantized using post-training quantization (PTQ) with the [TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer) library, as shown above. Models trained with low precision or quantization-aware training are also supported, as indicated in the table.
106
+
107
+ The inference-optimized libraries listed above also support on-the-fly quantization during model export, with configurable parameters available in the export APIs. However, please note that the precision options shown in the table above indicate support for exporting models that have already been quantized, rather than the ability to quantize models during export.
108
+
109
+ Please note that not all large language models (LLMs) and multimodal models (MMs) are currently supported. For the most complete and up-to-date information, please refer to the [LLM documentation](https://docs.nvidia.com/nemo/export-deploy/latest/llm/index.html) and [MM documentation](https://docs.nvidia.com/nemo/export-deploy/latest/mm/index.html).
110
+
111
+ ### Model Deployment Capabilities
112
+
113
+ | Model / Checkpoint | RayServe | PyTriton |
114
+ |-------------------------------------------------------------------------------------------|------------------------------------------|-------------------------|
115
+ | [NeMo Framework - LLMs](https://docs.nvidia.com/nemo-framework/user-guide/latest/overview.html) | Single-Node Multi-GPU,<br>Multi-instance | Single-Node Multi-GPU |
116
+ | [NeMo Framework - Multimodal Models](https://docs.nvidia.com/nemo-framework/user-guide/latest/overview.html) | Coming Soon | Coming Soon |
117
+ | [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) | Coming Soon | Coming Soon |
118
+ | [Hugging Face](https://huggingface.co/docs/transformers/en/index) | Single-Node Multi-GPU,<br>Multi-instance | Single-Node Multi-GPU |
119
+ | [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM) | Single-Node Multi-GPU,<br>Multi-instance | Multi-Node Multi-GPU |
120
+ | [vLLM](https://github.com/vllm-project/vllm) | N/A | Single-Node Multi-GPU |
121
+
122
+ The support matrix above outlines the available deployment options for each model or checkpoint, highlighting multi-node and multi-GPU support where applicable. For comprehensive details, please refer to the [documentation](https://docs.nvidia.com/nemo/export-deploy/latest/index.html).
123
+
124
+ ## 🔧 Install
125
+
126
+ For quick exploration of NeMo Export-Deploy, we recommend installing our pip package:
127
+
128
+ ```bash
129
+ pip install nemo-export-deploy
130
+ ```
131
+
132
+ This installation comes without extra dependencies like [TransformerEngine](https://github.com/NVIDIA/TransformerEngine/), [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM) or [vLLM](https://github.com/vllm-project/vllm). The installation serves for navigating around and for exploring the project.
133
+
134
+ For a feature-complete install, please refer to the following sections.
135
+
136
+ ### Use NeMo-FW Container
137
+
138
+ Best experience, highest performance and full feature support is guaranteed by the [NeMo Framework container](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/nemo/tags). Please fetch the most recent `$TAG` and run the following command to start a container:
139
+
140
+ ```bash
141
+ docker run --rm -it -w /workdir -v $(pwd):/workdir \
142
+ --entrypoint bash \
143
+ --gpus all \
144
+ nvcr.io/nvidia/nemo:${TAG}
145
+ ```
146
+
147
+ #### Install TRT-LLM (or vLLM)
148
+
149
+ Starting with version 25.07, the NeMo FW container no longer includes TRT-LLM and vLLM pre-installed. Please run the following command inside the container:
150
+
151
+ For TRT-LLM:
152
+
153
+ ```bash
154
+ cd /opt/Export-Deploy
155
+ uv sync --link-mode symlink --locked --extra trtllm $(cat /opt/uv_args.txt)
156
+ ```
157
+
158
+ For vLLM:
159
+
160
+ ```bash
161
+ cd /opt/Export-Deploy
162
+ uv sync --link-mode symlink --locked --extra vllm $(cat /opt/uv_args.txt)
163
+ ```
164
+
165
+ ### Build with Dockerfile
166
+
167
+ For containerized development, use our Dockerfile for building your own container. There are three flavors: `INFERENCE_FRAMEWORK=inframework`, `INFERENCE_FRAMEWORK=trtllm` and `INFERENCE_FRAMEWORK=vllm`:
168
+
169
+ ```bash
170
+ docker build \
171
+ -f docker/Dockerfile.ci \
172
+ -t nemo-export-deploy \
173
+ --build-arg INFERENCE_FRAMEWORK=$INFERENCE_FRAMEWORK \
174
+ .
175
+ ```
176
+
177
+ Start your container:
178
+
179
+ ```bash
180
+ docker run --rm -it -w /workdir -v $(pwd):/workdir \
181
+ --entrypoint bash \
182
+ --gpus all \
183
+ nemo-export-deploy
184
+ ```
185
+
186
+ ### Install from Source
187
+
188
+ For complete feature coverage, we recommend to install [TransformerEngine](https://github.com/NVIDIA/TransformerEngine/?tab=readme-ov-file#pip-installation) and additionally either [TensorRT-LLM](https://nvidia.github.io/TensorRT-LLM/0.20.0/installation/linux.html) or [vLLM](https://docs.vllm.ai/en/latest/getting_started/installation/gpu.html#pre-built-wheels).
189
+
190
+ #### Recommended Requirements
191
+
192
+ - Python 3.12
193
+ - PyTorch 2.7
194
+ - CUDA 12.8
195
+ - Ubuntu 24.04
196
+
197
+ #### Install TransformerEngine + InFramework
198
+
199
+ For highly optimized TransformerEngine path with PyTriton backend, please make sure to install the following prerequisites first:
200
+
201
+ ```bash
202
+ pip install torch==2.7.0 setuptools pybind11 wheel_stub # Required for TE
203
+ ```
204
+
205
+ Now proceed with the main installation:
206
+
207
+ ```bash
208
+ git clone https://github.com/NVIDIA-NeMo/Export-Deploy
209
+ cd Export-Deploy/
210
+ pip install --no-build-isolation .[te]
211
+ ```
212
+
213
+ #### Install TransformerEngine + TRT-LLM
214
+
215
+ For highly optimized TransformerEngine path with TRT-LLM backend, please make sure to install the following prerequisites first:
216
+
217
+ ```bash
218
+ sudo apt-get -y install libopenmpi-dev # Required for TRT-LLM
219
+ pip install torch==2.7.0 setuptools pybind11 wheel_stub # Required for TE
220
+ ```
221
+
222
+ Now proceed with the main installation:
223
+
224
+ ```bash
225
+ pip install --no-build-isolation .[te,trtllm]
226
+ ```
227
+
228
+ #### Install TransformerEngine + vLLM
229
+
230
+ For highly optimized TransformerEngine path with vLLM backend, please make sure to install the following prerequisites first:
231
+
232
+ ```bash
233
+ pip install torch==2.7.0 setuptools pybind11 wheel_stub # Required for TE
234
+ ```
235
+
236
+ Now proceed with the main installation:
237
+
238
+ ```bash
239
+ pip install --no-build-isolation .[te,vllm]
240
+ ```
241
+
242
+ ## 🚀 Get Started Quickly
243
+
244
+ The following steps are based on a self-built [container](#build-with-dockerfile).
245
+
246
+ ### Generate a NeMo Checkpoint
247
+
248
+ In order to run examples with NeMo models, a NeMo checkpoint is required. Please follow the steps below to generate a NeMo checkpoint.
249
+
250
+ 1. To access the Llama models, please visit the [Llama 3.2 Hugging Face page](https://huggingface.co/meta-llama/Llama-3.2-1B).
251
+
252
+ 2. Pull down and run the NeMo Framework Docker container image using the command shown below:
253
+
254
+ ```shell
255
+ docker run --gpus all -it --rm -p 8000:8000 \
256
+ --entrypoint bash \
257
+ --workdir /opt/Export-Deploy \
258
+ --shm-size=4g \
259
+ --gpus all \
260
+ -v ${PWD}:/opt/Export-Deploy \
261
+ nemo-export-deploy
262
+ ```
263
+
264
+ 3. Run the following command in the terminal and enter your Hugging Face access token to log in to Hugging Face:
265
+
266
+ ```shell
267
+ huggingface-cli login
268
+ ```
269
+
270
+ 4. Run the following Python code to generate the NeMo 2.0 checkpoint:
271
+
272
+ ```shell
273
+ python scripts/export/export_hf_to_nemo2.py \
274
+ --hf_model meta-llama/Llama-3.2-1B \
275
+ --output_path /opt/checkpoints/hf_llama32_1B_nemo2 \
276
+ --config Llama32Config1B
277
+ ```
278
+
279
+ ## 🚀 Export and Deploy Examples
280
+
281
+ The following examples demonstrate how to export and deploy Large Language Models (LLMs) using NeMo Export-Deploy. These examples cover both Hugging Face and NeMo model formats, showing how to export them to TensorRT-LLM and deploy using NVIDIA Triton Inference Server for high-performance inference.
282
+
283
+ ### Export and Deploy Hugging Face Models to TensorRT-LLM and Triton Inference Server
284
+
285
+ Please note that Llama models require special access permissions from Meta. To use Llama models, you must first accept Meta's license agreement and obtain access credentials. For instructions on obtaining access, please refer to the [section on generating NeMo checkpoints](#generate-a-nemo-checkpoint) below.
286
+
287
+ ```python
288
+ from nemo_export.tensorrt_llm import TensorRTLLM
289
+ from nemo_deploy import DeployPyTriton
290
+
291
+ # Export model to TensorRT-LLM
292
+ exporter = TensorRTLLM(model_dir="/tmp/hf_llama32_1B_hf")
293
+ exporter.export_hf_model(
294
+ hf_model_path="/opt/checkpoints/hf_llama32_1B_hf",
295
+ tensor_parallelism_size=1,
296
+ )
297
+
298
+ # Generate output
299
+ output = exporter.forward(
300
+ input_texts=["What is the color of a banana?"],
301
+ top_k=1,
302
+ top_p=0.0,
303
+ temperature=1.0,
304
+ max_output_len=20,
305
+ )
306
+ print("output: ", output)
307
+
308
+ # Deploy to Triton
309
+ nm = DeployPyTriton(model=exporter, triton_model_name="llama", http_port=8000)
310
+ nm.deploy()
311
+ nm.serve()
312
+ ```
313
+
314
+ After running the code above, Triton Inference Server will start and begin serving the model. For instructions on how to query the deployed model and make inference requests, please refer to [Query Deployed Models](#-query-deployed-models).
315
+
316
+ ### Export and Deploy NeMo LLM Models to TensorRT-LLM and Triton Inference Server
317
+
318
+ Before running the example below, ensure you have a NeMo checkpoint file. If you don't have a checkpoint yet, see the [section on generating NeMo checkpoints](#generate-a-nemo-checkpoint) for step-by-step instructions on creating one.
319
+
320
+ ```python
321
+ from nemo_export.tensorrt_llm import TensorRTLLM
322
+ from nemo_deploy import DeployPyTriton
323
+
324
+ # Export model to TensorRT-LLM
325
+ exporter = TensorRTLLM(model_dir="/tmp/hf_llama32_1B_nemo2")
326
+ exporter.export(
327
+ nemo_checkpoint_path="/opt/checkpoints/hf_llama32_1B_nemo2",
328
+ tensor_parallelism_size=1,
329
+ )
330
+
331
+ # Generate output
332
+ output = exporter.forward(
333
+ input_texts=["What is the color of a banana?"],
334
+ top_k=1,
335
+ top_p=0.0,
336
+ temperature=1.0,
337
+ max_output_len=20,
338
+ )
339
+ print("output: ", output)
340
+
341
+ # Deploy to Triton
342
+ nm = DeployPyTriton(model=exporter, triton_model_name="llama", http_port=8000)
343
+ nm.deploy()
344
+ nm.serve()
345
+ ```
346
+
347
+ ### Export and Deploy NeMo Models to vLLM and Triton Inference Server
348
+
349
+ ```python
350
+ from nemo_export.vllm_exporter import vLLMExporter
351
+ from nemo_deploy import DeployPyTriton
352
+
353
+ # Export model to vLLM
354
+ exporter = vLLMExporter()
355
+ exporter.export(
356
+ nemo_checkpoint="/opt/checkpoints/hf_llama32_1B_nemo2",
357
+ model_dir="/tmp/hf_llama32_1B_nemo2",
358
+ tensor_parallel_size=1,
359
+ )
360
+
361
+ # Generate output
362
+ output = exporter.forward(
363
+ input_texts=["What is the color of a banana?"],
364
+ top_k=1,
365
+ top_p=0.0,
366
+ temperature=1.0,
367
+ max_output_len=20,
368
+ )
369
+ print("output: ", output)
370
+
371
+ # Deploy to Triton
372
+ nm = DeployPyTriton(model=exporter, triton_model_name="llama", http_port=8000)
373
+ nm.deploy()
374
+ nm.serve()
375
+ ```
376
+
377
+ ### Deploy NeMo Models Directly with Triton Inference Server
378
+
379
+ You can also deploy NeMo and Hugging Face models directly using Triton Inference Server without exporting to inference optimized libraries like TensorRT-LLM or vLLM. This provides a simpler deployment path while still leveraging Triton's scalable serving capabilities.
380
+
381
+ ```python
382
+ from nemo_deploy import DeployPyTriton
383
+ from nemo_deploy.nlp.megatronllm_deployable import MegatronLLMDeployableNemo2
384
+
385
+ model = MegatronLLMDeployableNemo2(
386
+ nemo_checkpoint_filepath="/opt/checkpoints/hf_llama32_1B_nemo2",
387
+ num_devices=1,
388
+ num_nodes=1,
389
+ )
390
+
391
+ # Deploy to Triton
392
+ nm = DeployPyTriton(model=model, triton_model_name="llama", http_port=8000)
393
+ nm.deploy()
394
+ nm.serve()
395
+ ```
396
+
397
+ ### Deploy Hugging Face Models Directly with Triton Inference Server
398
+
399
+ You can also deploy NeMo and Hugging Face models directly using Triton Inference Server without exporting to inference optimized libraries like TensorRT-LLM or vLLM. This provides a simpler deployment path while still leveraging Triton's scalable serving capabilities.
400
+
401
+ ```python
402
+ from nemo_deploy import DeployPyTriton
403
+ from nemo_deploy.nlp.hf_deployable import HuggingFaceLLMDeploy
404
+
405
+ model = HuggingFaceLLMDeploy(
406
+ hf_model_id_path="hf://meta-llama/Llama-3.2-1B",
407
+ device_map="auto",
408
+ )
409
+
410
+ # Deploy to Triton
411
+ nm = DeployPyTriton(model=model, triton_model_name="llama", http_port=8000)
412
+ nm.deploy()
413
+ nm.serve()
414
+ ```
415
+
416
+ ### Export and Deploy Multimodal Models to TensorRT-LLM and Triton Inference Server
417
+
418
+ ```python
419
+ from nemo_deploy import DeployPyTriton
420
+ from nemo_export.tensorrt_mm_exporter import TensorRTMMExporter
421
+
422
+ # Export multimodal model
423
+ exporter = TensorRTMMExporter(model_dir="/path/to/export/dir", modality="vision")
424
+ exporter.export(
425
+ visual_checkpoint_path="/path/to/model.nemo",
426
+ model_type="mllama",
427
+ llm_model_type="mllama",
428
+ tensor_parallel_size=1,
429
+ )
430
+
431
+ # Deploy to Triton
432
+ nm = DeployPyTriton(model=exporter, triton_model_name="mllama", port=8000)
433
+ nm.deploy()
434
+ nm.serve()
435
+ ```
436
+
437
+ ## 🔍 Query Deployed Models
438
+
439
+ ### Query LLM Model
440
+
441
+ ```python
442
+ from nemo_deploy.nlp import NemoQueryLLM
443
+
444
+ nq = NemoQueryLLM(url="localhost:8000", model_name="llama")
445
+ output = nq.query_llm(
446
+ prompts=["What is the capital of France?"],
447
+ max_output_len=100,
448
+ )
449
+ print(output)
450
+ ```
451
+
452
+ ### Query Multimodal Model
453
+
454
+ ```python
455
+ from nemo_deploy.multimodal import NemoQueryMultimodal
456
+
457
+ nq = NemoQueryMultimodal(url="localhost:8000", model_name="mllama", model_type="mllama")
458
+ output = nq.query(
459
+ input_text="What is in this image?",
460
+ input_media="/path/to/image.jpg",
461
+ max_output_len=30,
462
+ )
463
+ print(output)
464
+ ```
465
+
466
+ ## 🤝 Contributing
467
+
468
+ We welcome contributions to NeMo Export-Deploy! Please see our [Contributing Guidelines](https://github.com/NVIDIA-NeMo/Export-Deploy/blob/main/CONTRIBUTING.md) for more information on how to get involved.
469
+
470
+ ## License
471
+
472
+ NeMo Export-Deploy is licensed under the [Apache License 2.0](https://github.com/NVIDIA-NeMo/Export-Deploy?tab=Apache-2.0-1-ov-file).