NVIDIA/Model-Optimizer
A unified library of SOTA model optimization techniques like quantization, distillation, pruning, neural architecture search, speculative decoding, etc. It compresses deep learning models for downstream deployment frameworks like TensorRT-LLM, TensorRT, vLLM, etc. to optimize inference speed.
The score is jscpd's own --health model: markup, data and text left out, tests kept. The numbers below are the trending scan's.
Most complex files
- modelopt/onnx/utils.py539 cx
- modelopt/onnx/autocast/precisionconverter.py502 cx
- modelopt/torch/quantization/nn/modules/tensor_quantizer.py463 cx
- modelopt/torch/export/quant_utils.py460 cx
- modelopt/torch/quantization/algorithms.py453 cx
- modelopt/torch/quantization/model_calib.py442 cx
- modelopt/torch/export/unified_export_megatron.py430 cx
- tests/_test_utils/torch/nas_prune/models.py391 cx
- modelopt/torch/export/trtllm/layer_utils.py337 cx
- modelopt/torch/quantization/plugins/huggingface.py330 cx
Dead code 2.63% unused · 122 findings
- modelopt/torch/sparsity/attention_sparsity/plugins/vllm.pyunused-file
- tools/launcher/core.pyunused-file
- modelopt/torch/utils/mlflow.pyunused-file
- modelopt/torch/utils/plugins/transformers_dataset.pyunused-file
- modelopt/torch/sparsity/attention_sparsity/plugins/vllm_runtime.pyunused-file
- modelopt/torch/speculative/plugins/hf_streaming_dataset.pyunused-file
- modelopt/torch/speculative/plugins/rdma_hidden_states_connector.pyunused-file
- modelopt/torch/kernels/common/attention/decode_attention.pyunused-file
- modelopt/torch/utils/plugins/mbridge.pyunused-file
- modelopt/torch/sparsity/attention_sparsity/plugins/sparse_attn_calibration.pyunused-file
The code number leaves out tests, fixtures, docs, examples, data files, styles, translations and vendored code.
Largest clones in the code
- 18 lines in 2 placescpp684 tokensmodelopt/onnx/quantization/src/modelopt_round_and_pack_ext.cpp:1–18modelopt/torch/kernels/quantization/gemm/tensor_quant.cpp:1–18
1/* 2 * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 *First 10 of 18 lines.
- 18 lines in 2 placesc-header683 tokensmodelopt/torch/kernels/quantization/gemm/tensor_quant.h:1–18modelopt/torch/kernels/quantization/gemm/tensor_quant_mx.h:1–18
1/* 2 * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 *First 10 of 18 lines.
- 16 lines in 2 placescpp682 tokensmodelopt/onnx/quantization/src/modelopt_round_and_pack_ext.cpp:1–16modelopt/torch/kernels/quantization/conv/implicit_gemm_binding.cpp:1–16
1/* 2 * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 *First 10 of 16 lines.
7 more
- 15 lines in 2 placescpp636 tokens
- 67 lines in 2 placespython496 tokens
- 66 lines in 2 placespython493 tokens
- 30 lines in 2 placespython390 tokens
- 48 lines in 2 placespython364 tokens
- 47 lines in 2 placespython363 tokens
- 46 lines in 2 placespython333 tokens
Largest clones over all files, tests and data included
- 16 lines in 7 placescppdocs and examples682 tokensexamples/onnx_ptq/custom_op_plugin/plugin/IdentityConvPlugin.cpp:1–16examples/onnx_ptq/custom_op_plugin/plugin/IdentityConvPluginCreator.cpp:1–16examples/onnx_ptq/custom_op_plugin/plugin/PluginRegistration.cpp:1–16examples/onnx_ptq/custom_op_plugin/plugin/PluginUtils.cpp:1–16modelopt/onnx/quantization/src/modelopt_round_and_pack_ext.cpp:1–16and 2 more
1/* 2 * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 *First 10 of 16 lines.
- 16 lines in 5 placesc-headerdocs and examples682 tokensexamples/onnx_ptq/custom_op_plugin/plugin/IdentityConvPlugin.h:1–16examples/onnx_ptq/custom_op_plugin/plugin/IdentityConvPluginCreator.h:1–16examples/onnx_ptq/custom_op_plugin/plugin/PluginUtils.h:1–16modelopt/torch/kernels/quantization/gemm/tensor_quant.h:1–16modelopt/torch/kernels/quantization/gemm/tensor_quant_mx.h:1–16
1/* 2 * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 *First 10 of 16 lines.
- 6 lines in 7 placesmarkdowndocs and examples150 tokensexamples/diffusers/README.md:482–487examples/hf_ptq/README.md:792–797examples/llm_distill/README.md:182–187examples/onnx_ptq/README.md:273–278examples/speculative_decoding/README.md:350–355and 2 more
482- 📅 [Roadmap](https://github.com/NVIDIA/Model-Optimizer/issues/1699) 483- 📖 [Documentation](https://nvidia.github.io/Model-Optimizer) 484- 🎯 [Benchmarks](../benchmark.md) 485- 💡 [Release Notes](https://nvidia.github.io/Model-Optimizer/reference/0_changelog.html) 486- 🐛 [File a bug](https://github.com/NVIDIA/Model-Optimizer/issues/new?template=1_bug_report.md) 487- ✨ [File a Feature Request](https://github.com/NVIDIA/Model-Optimizer/issues/new?template=2_feature_request.md) - 15 lines in 2 placescppdocs and examples636 tokens
- 122 lines in 2 placespythondocs and examples577 tokens
By format, code only
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| python | 558 | 185,988 | 229 | 3,383 | 1.82% |
| bash | 43 | 4,809 | 5 | 73 | 1.52% |
| cpp | 4 | 339 | 4 | 55 | 16.22% |
| c-header | 2 | 315 | 2 | 27 | 8.57% |
| perl | 1 | 174 | 0 | 0 | 0% |
By format, all files
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| python | 1,247 | 371,685 | 870 | 11,619 | 3.13% |
| yaml | 394 | 22,513 | 302 | 5,732 | 25.46% |
| markdown | 187 | 27,856 | 45 | 433 | 1.55% |
| bash | 159 | 10,662 | 17 | 176 | 1.65% |
| cpp | 8 | 756 | 8 | 117 | 15.48% |
| c-header | 5 | 519 | 5 | 73 | 14.07% |
| txt | 10 | 140 | 1 | 9 | 6.43% |
| json | 17 | 923 | 0 | 0 | 0% |
| text | 26 | 572 | 0 | 0 | 0% |
| toml | 10 | 566 | 0 | 0 | 0% |
Trending appearances
| Day | Rank | Stars | Files | Lines | Clones | All files | Code | Health | Commit |
|---|---|---|---|---|---|---|---|---|---|
| Sep 27, 2026 | #2 | 4,807 (+357) | 2,070 | 436,739 | 1,248 | 4.16% | 1.85% | C 66.3 | 23355ed |
| Sep 26, 2026 | #9 | 4,526 (+359) | 2,070 | 436,739 | 1,248 | 4.16% | 1.85% | C 66.3 | 23355ed |
| Sep 25, 2026 | #3 | 4,148 (+44) | 2,070 | 436,738 | 1,248 | 4.16% | 1.85% | C 66.3 | ed7e879 |
Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.