Ultralytics YOLO INT8 engines larger than FP32: 23.76 MB zero-filled block in TensorRT 11.4 plan on RTX PRO 6000 Blackwell
Los mantenedores suelen responder en 6 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 12/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- ai, performance
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C++
- Estrellas
- 13.5k
- Forks
- 2.4k
- Merge medio
- 6 d 21 h
- PR fusionados (30 d)
- 3
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/TensorRT
-
Module:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 6 días
-
Polygraphy NumPy Top-K sorts unsigned and minimum signed integers incorrectlyPosiblemente ocupada @0z5a la tomó hace 16 días. AbiertoModule:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 6 días
-
Polygraphy INT32 comparison can overflow and falsely pass at zero tolerancePosiblemente ocupada @0z5a la tomó hace 16 días. AbiertoModule:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 6 días
-
onnx-graphsurgeon: Graph.toposort() hits RecursionError when a graph has a local function and an If/Loop nodePosiblemente ocupada @gabortar la tomó hace 39 días. AbiertoModule:GraphSurgeon
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 6 días
-
Polygraphy parse_meta accepts a shape with a missing bracketPosiblemente ocupada @SashaMIT la tomó hace 51 días. AbiertoModule:Polygraphy
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 6 días
Todos los issues de NVIDIA/TensorRT
Issues similares
-
[UBSan] spawn_simulator passes null child_options.args to uv_spawn (execvp nonnull violation)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
tenstorrent/tt-umd#4017 ·
Los mantenedores suelen responder en 3 días
-
difficulty:easy func:gui prio:low type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NatronGitHub/Natron#1538 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
hyprwm/hyprsunset#103 · 1 comentario ·
-
Feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
qbittorrent/qBittorrent#25338 ·
Los mantenedores suelen responder en 2 días
-
Needs: Attention Needs: Version Info Platform: Android Platform: tvOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
react/react-native#60180 · 3 comentarios ·
Los mantenedores suelen responder en 2 días