-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Bug]: Cannot convert pytorch YOLOv9 model directly #26457
Comments
If running without exported_model = openvino.convert_model(model.model, example_input=dummy_tensor) # O
exported_model = openvino.convert_model(model.model, example_input=dummy_tensor, output=["boxes", "labels"]) # X |
@sungchul2 What is the purpose of specifying the names of outputs? Is it renaming of outputs? |
Yes, I want to change the output names to use model api. >>> ov_model
<Model: 'Model0' inputs[
<ConstOutput: names[x] shape[?,3,?,?] type: f32>
]
outputs[
<ConstOutput: names[] shape[?,84,8400] type: f32>,
<ConstOutput: names[xi.1] shape[?,144,4..,4..] type: f32>,
<ConstOutput: names[xi.3] shape[?,144,2..,2..] type: f32>,
<ConstOutput: names[xi] shape[?,144,1..,1..] type: f32>
]>
>>> ov_model.outputs
[<Output: names[] shape[?,84,8400] type: f32>, <Output: names[xi.1] shape[?,144,4..,4..] type: f32>, <Output: names[xi.3] shape[?,144,2..,2..] type: f32>, <Output: names[xi] shape[?,144,1..,1..] type: f32>] I tried to set names to each output but failed with the same error: >>> ov_model = ov.convert_model(model, example_input=example_input, output=["boxes", "labels", "a", "b"]) [41/1855]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sungchul/.pyenv/versions/3.11.8/envs/otx_v2/lib/python3.11/site-packages/openvino/tools/ovc/convert.py", line 100, in convert_model
ov_model, _ = _convert(cli_parser, params, True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sungchul/.pyenv/versions/3.11.8/envs/otx_v2/lib/python3.11/site-packages/openvino/tools/ovc/convert_impl.py", line 548, in _convert
raise e
File "/home/sungchul/.pyenv/versions/3.11.8/envs/otx_v2/lib/python3.11/site-packages/openvino/tools/ovc/convert_impl.py", line 494, in _convert
ov_model = driver(argv, {"conversion_parameters": non_default_params})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sungchul/.pyenv/versions/3.11.8/envs/otx_v2/lib/python3.11/site-packages/openvino/tools/ovc/convert_impl.py", line 250, in driver
ov_model = moc_emit_ir(prepare_ir(argv), argv)
^^^^^^^^^^^^^^^^
File "/home/sungchul/.pyenv/versions/3.11.8/envs/otx_v2/lib/python3.11/site-packages/openvino/tools/ovc/convert_impl.py", line 194, in prepare_ir
ov_model = moc_pipeline(argv, moc_front_end)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sungchul/.pyenv/versions/3.11.8/envs/otx_v2/lib/python3.11/site-packages/openvino/tools/ovc/moc_frontend/pipeline.py", line 136, in moc_pipeli
ne
oplaces.append(out_desc["name"])
~~~~~~~~^^^^^^^^
KeyError: 'name' |
For pytorch this is a tricky task to figure out what needs to be done when you specify output names, we discussed internally this case and we think that we cannot provide a robust enough solution and it may confuse users.
|
Thanks for your comment. I agree with your team's concern about the difficulty of knowing the output. |
Agree, will update to print a better error message |
OpenVINO Version
2024.3.0
Operating System
Ubuntu 20.04 (LTS)
Device used for inference
CPU
Framework
PyTorch
Model used
https://github.com/sungchul2/training_extensions/blob/yolov9-integration/src/otx/algo/detection/yolov9.py
Issue description
Error when converting YOLOv9 model to OpenVINO IR.
It seems that
fe_output_user_data_repack
return the list of dicts that don't have name key.openvino/tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py
Lines 134 to 136 in 1e3b88e
openvino/tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py
Lines 308 to 339 in 22079ca
Step-by-step reproduction
Relevant log output
Issue submission checklist
The text was updated successfully, but these errors were encountered: