Skip to content
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

onnx Infer problem? #638

Closed
montensorrt opened this issue Oct 19, 2022 · 2 comments · Fixed by #636
Closed

onnx Infer problem? #638

montensorrt opened this issue Oct 19, 2022 · 2 comments · Fixed by #636

Comments

@montensorrt
Copy link

montensorrt commented Oct 19, 2022

Is your feature request related to a problem? Please describe.
when infer the onnx model,don‘t find meta_data.json file?
if i want infer onnx,must be using openvino libs?
maybe provide some scripts for onnx model infer ,such as using onnxruntime infer? or other?

@samet-akcay
Copy link
Contributor

Hi @montensorrt, PR #636 addresses this issue. We hope to be able to merge it by the end of today. Hope that answers your question.

@montensorrt
Copy link
Author

it's solved,but have a lit problem,why must to export_mode == "openvino",the meta_data.json file would be created,when I only export_mode == "onnx“,the file wondn't created,maybe ,should adjust the order,
Such as:
torch.onnx.export(
model.model,
torch.zeros((1, 3, height, width)).to(model.device),
onnx_path,
opset_version=12,
input_names=["input"],
output_names=["output"],
)

with open(Path(export_path) / "meta_data.json", "w", encoding="utf-8") as metadata_file:
    meta_data = get_model_metadata(model)
    # Convert metadata from torch
    for key, value in meta_data.items():
        if isinstance(value, Tensor):
            meta_data[key] = value.numpy().tolist()
    json.dump(meta_data, metadata_file, ensure_ascii=False, indent=4)

if export_mode == "openvino":

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants