You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When I quantize the yolo_tube.onnx model, the scale_ array tensor for bias was a scalar, so an exception was thrown #581
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/modelopt/onnx/quantization/qdq_utils.py", line 781, in qdq_to_dq
scaled = _convert_weight(weight_array, scale, zp, quantized_node)
File "/usr/local/lib/python3.10/dist-packages/modelopt/onnx/quantization/qdq_utils.py", line 676, in _convert_weight
reshape_dims[axis] = scale_array.shape[0]
IndexError: tuple index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srcs/codes/wujie/model-optimizer/./src/model_optimizer/quantization/models/yolo.py", line 114, in
quantize_model_onnx(model, quant_cfg, quant_mode, args)
File "/srcs/codes/wujie/model-optimizer/./src/model_optimizer/quantization/models/yolo.py", line 39, in quantize_model_onnx
quantize(
File "/usr/local/lib/python3.10/dist-packages/modelopt/onnx/quantization/quantize.py", line 523, in quantize
onnx_model = qdq_to_dq(onnx_model)
File "/usr/local/lib/python3.10/dist-packages/modelopt/onnx/quantization/qdq_utils.py", line 806, in qdq_to_dq
raise RuntimeError(f"Failed to convert node {node.name}: {e!s}")
RuntimeError: Failed to convert node /model.23/cv3.0/cv3.0.2/weight_quantizer/QuantizeLinear: tuple index out of range
After adding the following code, the problem can be fixed
scale_array = onnx.numpy_helper.to_array(scale)
if not scale_array.shape: ### ---------this is my added
scale_array = np.expand_dims(scale_array, axis=0)
print(f'none scale found extend to {scale_array}')
changed the title [-]When I quantified the yolo_tube.onnx model, the scale_ array tensor for bias was a scalar, so an exception was thrown[/-][+]When I quantize the yolo_tube.onnx model, the scale_ array tensor for bias was a scalar, so an exception was thrown[/+]on Nov 20, 2025
After adding the following code, the problem can be fixed
scale_array = onnx.numpy_helper.to_array(scale)
if not scale_array.shape: ### ---------this is my added
scale_array = np.expand_dims(scale_array, axis=0)
print(f'none scale found extend to {scale_array}')
Activity
[-]When I quantified the yolo_tube.onnx model, the scale_ array tensor for bias was a scalar, so an exception was thrown[/-][+]When I quantize the yolo_tube.onnx model, the scale_ array tensor for bias was a scalar, so an exception was thrown[/+]happyAnger66-an commentedon Nov 20, 2025
After adding the following code, the problem can be fixed
scale_array = onnx.numpy_helper.to_array(scale)
if not scale_array.shape: ### ---------this is my added
scale_array = np.expand_dims(scale_array, axis=0)
print(f'none scale found extend to {scale_array}')