alibaba / alibaba/esod

Exporting to ONNX failed

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
140
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Hey guys, when trying to export to the ONNX format, I'm getting an error
```shell
PyTorch: starting from weights/esod_yolov8m.pt (267.6 MB)
ONNX: starting export with onnx 1.17.0...
/data/lh/projects/esod/models/common.py:328: 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!
assert c == self.c, f'{c} - {self.c}'
/data/lh/projects/esod/models/common.py:331: 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!
if torch.max(mask_pred) > 1. or torch.min(mask_pred) < 0.:
/data/lh/projects/esod/utils/general.py:304: TracerWarning: Converting a tensor to a Python float 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!
return math.ceil(x / divisor) * divisor
/data/lh/projects/esod/models/common.py:469: TracerWarning: Converting a tensor to a Python float 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!
ratio_x, ratio_y = int(math.ceil(width / cluster_w)), int(math.ceil(height / cluster_h))
/data/lh/projects/esod/models/common.py:473: 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!
if getattr(self, 'grid_vtx', None) is None or self.grid_vtx.size(0) != ratio_x*ratio_y*bs:
/data/lh/miniforge3/envs/esod/lib/python3.8/site-packages/torch/tensor.py:587: RuntimeWarning: 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).
warnings.warn('Iterating over a tensor might cause the trace to be incorrect. '
/data/lh/projects/esod/models/common.py:480: 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!
if getattr(self, 'grid', None) is None or self.grid[0].shape[-1] != cluster_h*cluster_w:
/data/lh/projects/esod/models/common.py:489: 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!
if (~obj_centers).all():
ONNX: export failure: Only tuples, lists and Variables are supported as JIT inputs/outputs. Dictionaries and strings are also accepted, but their usage is not recommended. Here, received an input of unsupported type: NoneType
```
anyone knows how to fix it?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the ONNX export failure for weights/esod_yolov8m.pt and inspect the export entry point that reports the NoneType JIT input error. Review the referenced code in models/common.py and utils/general.py, then verify that export completes without the reported failure and that the resulting ONNX model can be produced.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.