Open Shining-Tears opened 2 years ago
not change the tutorial file
I got the same error, do you find the solution?
@Raychen0617 Hi, You can reduce the pytorch version to 1.9.0
Hi, @matudouchen after reducing my pytorch version to 1.9.1, I got another error running quantization_quick_start_mnist.py
[07/15/2022-06:54:23] [TRT] [W] DynamicRange(min: -0.424213, max: 2.82149). Dynamic range should be symmetric for better accuracy.
Traceback (most recent call last):
File "quantization_quick_start_mnist.py", line 93, in
IndexError Traceback (most recent call last) /home/chenwz/code/pycharm/test2.ipynb Cell 6' in <cell line: 4>() 2 input_shape = (32, 1, 28, 28) 3 engine = ModelSpeedupTensorRT(model, input_shape, config=calibration_config, batchsize=32) ----> 4 engine.compress() 5 test_trt(engine)
File ~/.conda/envs/nni-wenze/lib/python3.8/site-packages/nni/compression/pytorch/quantization_speedup/integrated_tensorrt.py:291, in ModelSpeedupTensorRT.compress(self) 288 assert self.input_shape is not None 290 # Convert pytorch model to onnx model and save onnx model in onnxpath --> 291 , self.onnx_config = fonnx.torch_to_onnx(self.model, self.config, input_shape=self.input_shape, 292 model_path=self.onnx_path, input_names=self.input_names, output_names=self.output_names) 294 if self.calib_data_loader is not None: 295 assert self.calibrate_type is not None
File ~/.conda/envs/nni-wenze/lib/python3.8/site-packages/nni/compression/pytorch/quantization_speedup/frontend_to_onnx.py:144, in torch_to_onnx(model, config, input_shape, model_path, input_names, output_names) 142 # Load onnx model 143 model_onnx = onnx.load(model_path) --> 144 model_onnx, onnx_config = unwrapper(model_onnx, index2name, config) 145 onnx.save(model_onnx, model_path) 147 onnx.checker.check_model(model_onnx)
File ~/.conda/envs/nni-wenze/lib/python3.8/site-packages/nni/compression/pytorch/quantization_speedup/frontend_to_onnx.py:82, in unwrapper(model_onnx, index2name, config) 80 mul_nd = model_onnx.graph.node[idx-1] ... ---> 82 index = int(onnx.numpy_helper.to_array(const_nd.attribute[0].t)) 83 if index != -1: 84 name = index2name[index]
IndexError: list index (0) out of range
Environment:
Configuration:
Log message:
How to reproduce it?: