Ultralytics YOLO INT8 engines larger than FP32: 23.76 MB zero-filled block in TensorRT 11.4 plan on RTX PRO 6000 Blackwell
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 12/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- ai, performance
Hướng nghiên cứu
Start by running build_size.py after make_onnx.py to reproduce the 23.76 MB zero run in the INT8 plan. The issue reports that builder_optimization_level=0 removes it, so compare the plan layout across optimization levels. This is engine-internal work in TensorRT's builder, so a newcomer would need deep familiarity with the tactic and memory allocation code before any change.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
INT8 engines built from Ultralytics YOLO ONNX models quantized with ModelOpt (explicit Q/DQ) are larger than the FP32 engine of the same model: 29.6 MB vs 11.0 MB for YOLO26n. Almost all of the difference is one contiguous run of 23.76 MB of zero bytes inside the serialized plan. zlib compresses the INT8 plan to 2.6 MB.
The zero block is exactly 23.76 MB for both YOLO26n and YOLO11n, and appears with default builder settings on TensorRT 11.2.1.2 and 11.4.0.106:
| TensorRT | ONNX | Plan | zlib-compressed | Longest zero run |
|---|---|---|---|---|
| 11.4.0.106 | yolo26n.onnx (FP32) |
11.01 MB | 8.92 MB | 0 |
| 11.4.0.106 | yolo26n.int8.onnx (Q/DQ) |
29.58 MB | 2.58 MB | 23.76 MB |
| 11.2.1.2 | yolo26n.onnx (FP32) |
10.99 MB | 8.92 MB | 0 |
| 11.2.1.2 | yolo26n.int8.onnx (Q/DQ) |
29.60 MB | 2.63 MB | 23.76 MB |
What we checked:
builder_optimization_level=0builds a 9.8 MB INT8 plan without the zero block. Levels 1, 2, 3 (default) and 5 all give about 29.5 MB.max_aux_streams=0, ModelOptdisable_mha_qdq=True, and quantizing onlyConv(op_types_to_quantize=["Conv"]) leave the size unchanged.- In the Ultralytics export pipeline on TensorRT 11.2.1.2, the YOLO26n INT8 engine also reports
device_memory_size_v2of 41.2 MB, against 15.0 MB for the FP16 engine. - We see the same on DGX Spark (GB10): YOLO26n INT8 is 28.4 MB and FP16 is 6.7 MB on TensorRT 11.2.1.2. See the Ultralytics DGX Spark guide.
Ultralytics format="engine", quantize=8 exports quantize with ModelOpt and then build with TensorRT (modelopt_quantize_onnx). As a result, users get INT8 engines about 4x larger than FP16, which matters on storage-constrained edge devices.
Is this zero block expected, for example as space reserved for a particular tactic? Can it be avoided without dropping to optimization level 0?
Environment
TensorRT Version: 11.4.0.106 and 11.2.1.2 (tensorrt-cu13 pip wheels)
NVIDIA GPU: NVIDIA RTX PRO 6000 Blackwell Server Edition (also seen on DGX Spark GB10)
NVIDIA Driver Version: 595.99.02
CUDA Version: 13.2
CUDNN Version: N/A
Operating System: Ubuntu 24.04.5 LTS
Python Version (if applicable): 3.12.3
PyTorch Version (if applicable): 2.15.0 (CPU, used only for the ONNX export)
Other: ultralytics 8.4.196, nvidia-modelopt 0.47.0, onnx 1.21.0, ONNX opset 18
Baremetal or Container (if so, version): Baremetal
Relevant Files
Model link: yolo26n.pt. Both ONNX files are generated by step 1 below.
Steps To Reproduce
Commands or scripts:
pip install ultralytics==8.4.196 "nvidia-modelopt[onnx]==0.47.0" tensorrt-cu13==11.4.0.106
python make_onnx.py # step 1
python build_size.py # step 2
make_onnx.py:
# Step 1: export Ultralytics YOLO26n to ONNX (FP32) and quantize it to INT8 Q/DQ with ModelOpt
import numpy as np
from modelopt.onnx.quantization import quantize
from ultralytics import YOLO
YOLO("yolo26n.pt").export(format="onnx", imgsz=640) # -> yolo26n.onnx
quantize(
"yolo26n.onnx",
quantize_mode="int8",
calibration_data={"images": np.random.rand(8, 3, 640, 640).astype(np.float32)}, # random data, size is unaffected
calibration_method="max",
calibration_eps=["cpu"],
output_path="yolo26n.int8.onnx",
)
build_size.py:
# Step 2: build both ONNX files with default builder settings and inspect the serialized plans
import re
import zlib
import tensorrt as trt
logger = trt.Logger(trt.Logger.WARNING)
for onnx_file in ("yolo26n.onnx", "yolo26n.int8.onnx"):
builder = trt.Builder(logger)
network = builder.create_network(0)
config = builder.create_builder_config()
assert trt.OnnxParser(network, logger).parse_from_file(onnx_file)
plan = bytes(builder.build_serialized_network(network, config))
zero_run = max((m.end() - m.start() for m in re.finditer(rb"\x00{4096,}", plan)), default=0)
print(
f"TensorRT {trt.__version__} {onnx_file}: plan {len(plan) / 1e6:.2f} MB, "
f"zlib-compressed {len(zlib.compress(plan)) / 1e6:.2f} MB, longest zero run {zero_run / 1e6:.2f} MB"
)
Output:
TensorRT 11.4.0.106 yolo26n.onnx: plan 11.01 MB, zlib-compressed 8.92 MB, longest zero run 0.00 MB
TensorRT 11.4.0.106 yolo26n.int8.onnx: plan 29.58 MB, zlib-compressed 2.58 MB, longest zero run 23.76 MB
Have you tried the latest release?: Yes, 11.4.0.106.
Can this model run on other frameworks?: Yes. Both ONNX files run in ONNX Runtime and produce the expected (1, 84, 8400) output. The INT8 engine builds and runs normally; only its size is affected.
- Ngôn ngữ chính
- C++
- Star
- 13.5k
- Fork
- 2.4k
- Merge trung bình
- 6 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/TensorRT
-
Module:Polygraphy
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 6 ngày
-
Polygraphy NumPy Top-K sorts unsigned and minimum signed integers incorrectlyCó thể đã có người làm @0z5a đã nhận 16 ngày trước. Đang mởModule:Polygraphy
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 6 ngày
-
Polygraphy INT32 comparison can overflow and falsely pass at zero toleranceCó thể đã có người làm @0z5a đã nhận 16 ngày trước. Đang mởModule:Polygraphy
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 6 ngày
-
onnx-graphsurgeon: Graph.toposort() hits RecursionError when a graph has a local function and an If/Loop nodeCó thể đã có người làm @gabortar đã nhận 39 ngày trước. Đang mởModule:GraphSurgeon
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 6 ngày
-
Polygraphy parse_meta accepts a shape with a missing bracketCó thể đã có người làm @SashaMIT đã nhận 51 ngày trước. Đang mởModule:Polygraphy
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của NVIDIA/TensorRT
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
maplibre/maplibre-native#5072 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[UBSan] spawn_simulator passes null child_options.args to uv_spawn (execvp nonnull violation)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
tenstorrent/tt-umd#4017 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
difficulty:easy func:gui prio:low type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NatronGitHub/Natron#1538 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
hyprwm/hyprsunset#103 · 1 bình luận ·