yolor icon indicating copy to clipboard operation
yolor copied to clipboard

error while converting to onnx

Open abdessamad-abid opened this issue 2 years ago • 3 comments

I'm trying to convert yolor_p6.pt to onnx and when i run the export file i get this error :

model = torch.load(opt.weights, map_location=torch.device('cpu'))['model'].float() AttributeError: 'collections.OrderedDict' object has no attribute 'float'

abdessamad-abid avatar Feb 28 '22 10:02 abdessamad-abid

The same problem also arises when I run the code. After modifications (removing the float) it seems to run smoothly until it reaches a point with the following error message:

ONNX export failure: Exporting the operator Silu to ONNX "opset" version 12 is not supported. Please open a bug to request ONNX export support for the missing operator.

Has anybody encountered this issue and knows a way out? Just be be clear, also higher "opset" versions have been tried (up to 15) and the error still remains the same.

MarioCodeMatuschek avatar Mar 09 '22 09:03 MarioCodeMatuschek

I found that I needed to download the .pt file using the link provided in scripts/get_pretrain.sh Note the difference between the filenames where the link in the repo is yolor_p6.pt versus yolor-p6.pt. The latter did not have this attribute error AttributeError: 'collections.OrderedDict' object has no attribute 'float'. I too am stuck at the issue with Silu. This issue is not discussed in the other issues relating to onnx conversion.

tylertroy avatar Mar 22 '22 19:03 tylertroy

I found that I needed to download the .pt file using the link provided in scripts/get_pretrain.sh Note the difference between the filenames where the link in the repo is yolor_p6.pt versus yolor-p6.pt. The latter did not have this attribute error AttributeError: 'collections.OrderedDict' object has no attribute 'float'. I too am stuck at the issue with Silu. This issue is not discussed in the other issues relating to onnx conversion. I solved it by update torch to version 1.8.x

hungtooc avatar Apr 04 '22 11:04 hungtooc