-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not export to ONNX model. AttributeError: 'NoneType' object has no attribute 'shape' #485
Comments
I got the exact same error, it will work with batch_size != 1 |
You are right. I just tried with batch_size != 1, it worked. But still wonder if the bug can be fixed later on. |
Sorry @willjoy and @Wikidepia , I've missed this tickets, I can reproduce this problem locally. And seems that this is caused by the newer version of PyTorch (1.11-1.13), I only test this function at PyTorch 1.9-1.10, we need to fix this problem. |
I reproduced this problem on my ubuntu platform with torch2.0cu117. Everything seems fine till |
@zhiqwang @SharynHu is right. yolort/yolort/runtime/ort_helper.py Line 236 in 672ae82
try to use tuple with an empty target None
|
However while transforming such output is coming:
Is this normal? Then when I'm loading with
I am having best.pt which is obtained from training(best mAP). In order to convert this weights I'm changing the |
Sorry for the delay in replying to you @mr-mainak , The whole workflow looks fine, the onnx we export now is too dynamic to be used by |
🐛 Describe the bug
I followed the NoteBook to export a pre-trained YOLOv5 model to ONNX model. It's successful all the way to inferencing in yolov5-rt. I tested on a custom image, it gives correct boxes, labels, scores.
However, when I try to export to ONNX model with NMS, it failed.
export_onnx(model=model, onnx_path=onnx_path, opset_version=opset_version)
When I run the above code, it gives error. It's much appreciated if anyone can help.
Versions
Collecting environment information...
PyTorch version: 1.13.1
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A
OS: Microsoft Windows 10 Enterprise
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A
Python version: 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19045-SP0
Is CUDA available: True
CUDA runtime version: 11.7.99
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA T1200 Laptop GPU
Nvidia driver version: 517.13
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture=9
CurrentClockSpeed=2496
DeviceID=CPU0
Family=198
L2CacheSize=10240
L2CacheSpeed=
Manufacturer=GenuineIntel
MaxClockSpeed=2496
Name=11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
ProcessorType=3
Revision=
Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.24.2
[pip3] numpydoc==1.5.0
[pip3] torch==1.13.1
[pip3] torchaudio==0.13.1
[pip3] torchvision==0.14.1
[conda] blas 1.0 mkl
[conda] mkl 2021.4.0 haa95532_640
[conda] mkl-service 2.4.0 py39h2bbff1b_0
[conda] mkl_fft 1.3.1 py39h277e83a_0
[conda] mkl_random 1.2.2 py39hf11a4ad_0
[conda] numpy 1.24.2 pypi_0 pypi
[conda] numpydoc 1.5.0 py39haa95532_0
[conda] pytorch 1.13.1 py3.9_cuda11.7_cudnn8_0 pytorch
[conda] pytorch-cuda 11.7 h67b0de4_1 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.13.1 pypi_0 pypi
[conda] torchvision 0.14.1 pypi_0 pypi
The text was updated successfully, but these errors were encountered: