Hi, have you done any exporting for gelan.pt?
I tried to run torch2onnx.py for gelan.pt weights, but it didn't work.
Code error:
python3 torch2onnx.py --weights ./weights/gelan/best.pt --output ./weights/gelan/best.onnx --max_size 512 --data ../yolov9/data/custom.yaml
Fusing layers...
gelan_custom summary: 452 layers, 31384759 parameters, 0 gradients, 117.5 GFLOPs
[INFO] Convert from Torch to ONNX
/home/egorundel/projects/yolov9-tensorrt/models/yolo.py:108: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
elif self.dynamic or self.shape != shape:
torch2onnx.py:22: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
for x in output:
type x <class 'torch.Tensor'>
Traceback (most recent call last):
File "torch2onnx.py", line 72, in <module>
torch.onnx.export(model, # model being run
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/onnx/__init__.py", line 316, in export
return utils.export(model, args, f, export_params, verbose, training,
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/onnx/utils.py", line 107, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names,
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/onnx/utils.py", line 724, in _export
_model_to_graph(model, args, verbose, input_names,
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/onnx/utils.py", line 493, in _model_to_graph
graph, params, torch_out, module = _create_jit_graph(model, args)
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/onnx/utils.py", line 437, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/onnx/utils.py", line 388, in _trace_and_get_graph_from_model
torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/jit/_trace.py", line 1166, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/jit/_trace.py", line 127, in forward
graph, out = torch._C._create_graph_by_tracing(
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/jit/_trace.py", line 118, in wrapper
outs.append(self.inner(*trace_inputs))
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/egorundel/venvs/yolov9/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1090, in _slow_forward
result = self.forward(*input, **kwargs)
File "torch2onnx.py", line 28, in forward
output = output.permute(0, 2, 1)
RuntimeError: number of dims don't match in permute
Hi, have you done any exporting for
gelan.pt
? I tried to run torch2onnx.py forgelan.pt
weights, but it didn't work.Code error: