State-of-the-Art Deep Learning scripts organized by models - easy to train and deploy with reproducible accuracy and performance on enterprise-grade infrastructure.
13.21k
stars
3.17k
forks
source link
[Efficientnet/Pytorch] Error when exporting onnx #1079
WARNING: Logging before flag parsing goes to stderr.
E0214 03:47:01.921174 140610225248064 amp_wrapper.py:31] AMP is not avaialble.
=> loading pretrained weights from '/data1/model_zoo/DeepLearningExamples/weights/nvidia-efficientnet-quant-b0-130421.pth'
Traceback (most recent call last):
File "model2onnx.py", line 161, in <module>
main(args, model_args, model_arch)
File "model2onnx.py", line 114, in main
model = model_arch(**model_args.__dict__)
File "/data1/model_zoo/DeepLearningExamples/PyTorch/Classification/ConvNets/image_classification/models/model.py", line 149, in __call__
model.load_state_dict(state_dict)
File "/data1/env-torch-1.8.x/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1224, in load_state_dict
self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for EfficientNet:
Unexpected key(s) in state_dict: "layers.0.block0.se.pooling._input_quantizer._amax", "layers.1.block0.se.pooling._input_quantizer._amax", "layers.1.block1.se.pooling._input_quantizer._amax", "layers.2.block0.se.pooling._input_quantizer._amax", "layers.2.block1.se.pooling._input_quantizer._amax", "layers.3.block0.se.pooling._input_quantizer._amax", "layers.3.block1.se.pooling._input_quantizer._amax", "layers.3.block2.se.pooling._input_quantizer._amax", "layers.4.block0.se.pooling._input_quantizer._amax", "layers.4.block1.se.pooling._input_quantizer._amax", "layers.4.block2.se.pooling._input_quantizer._amax", "layers.5.block0.se.pooling._input_quantizer._amax", "layers.5.block1.se.pooling._input_quantizer._amax", "layers.5.block2.se.pooling._input_quantizer._amax", "layers.5.block3.se.pooling._input_quantizer._amax", "layers.6.block0.se.pooling._input_quantizer._amax", "classifier.pooling._input_quantizer._amax".
and python model2onnx.py --arch efficientnet-b0 --pretrained-from-file nvidia_efficientnet-b0_210412.pth -b 1 --trt True is ok.
To Reproduce
Steps to reproduce the behavior:
Install '...'
Set "..."
Launch '...'
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Please provide at least:
Container version (e.g. pytorch:19.05-py3):
GPUs in the system: (e.g. 8x Tesla V100-SXM2-16GB):
Related to Model/Framework(s)
[Efficientnet/Pytorch]
Describe the bug
python model2onnx.py --arch efficientnet-quant-b0 --pretrained-from-file nvidia-efficientnet-quant-b0-130421.pth -b 1 --trt True
and
python model2onnx.py --arch efficientnet-b0 --pretrained-from-file nvidia_efficientnet-b0_210412.pth -b 1 --trt True
is ok.To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Environment Please provide at least: