Questions tagged [onnx]

ONNX is an open format to represent deep learning models and enable interoperability between different frameworks.

ONNX

The Open Neural Network Exchange (ONNX) is an open-source artificial intelligence ecosystem. With ONNX, AI developers can more easily move models between state-of-the-art tools and choose the combination that is best for them. ONNX is widely supported and can be found in many frameworks, tools, and hardware. It is developed and supported by a community of partners.

Official resources

809 questions
5
votes
1 answer

How to get input tensor shape of an unknown PyTorch model

I am writing a python script, which converts any deep learning models from popular frameworks (TensorFlow, Keras, PyTorch) to ONNX format. Currently I have used tf2onnx for tensorflow and keras2onnx for keras to ONNX conversion, and those work. Now…
gunjannandy
  • 117
  • 2
  • 12
5
votes
1 answer

Input dimension reshape when using PyTorch model with CoreML

I have a seq2seq model in PyTorch that I want to run with CoreML. When exporting the model to ONNX the input dimensions are fixed to the shape of the tensor used during export, and again with the conversion from ONNX to CoreML. import torch from…
Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
5
votes
3 answers

Errors when installing onnx with pip in Ubuntu 20.04

I'm trying to install onnx in a fresh Ubuntu 20.04 install, but I'm running into the error bellow. It seems that I need the protobuf compiler, although I haven't found any documentation that says that I need that package installed. $ sudo python3 -m…
tgonzalez89
  • 621
  • 1
  • 6
  • 26
5
votes
0 answers

Error in converting SageMaker XGBoost model to ONNX model

I'm trying to convert a SageMaker XGBoost model to ONNX, in order to use the ONNX model in .Net application using ML.NET. I've tried to convert the model using winmltools and onnxmltools but both tools are returned similar error. There is a good…
csharpbd
  • 3,786
  • 4
  • 23
  • 32
5
votes
1 answer

outputs are different between ONNX and pytorch

I try to convert my pytorch Resnet50 model to ONNX and do inference. The conversion procedural makes no errors, but the final result of onnx model from onnxruntime has large gaps with the result of origin model from pytorch. What is possible…
Kevin.Wan
  • 101
  • 1
  • 4
5
votes
2 answers

Caffe2: Load ONNX model, and inference single threaded on multi-core host / docker

I'm having trouble running inference on a model in docker when the host has several cores. The model is exported via PyTorch 1.0 ONNX exporter: torch.onnx.export(pytorch_net, dummyseq, ONNX_MODEL_PATH) Starting the model server (wrapped in Flask)…
NegatioN
  • 667
  • 2
  • 9
  • 24
5
votes
2 answers

Static linking of Protocol Buffers results in conflicts with existing symbols

We are trying to implement a Protocol Buffers format (ONNX) importer for a C++ runtime. Our runtime will be used by frontend applications, which also use the Protocol Buffers models. When trying to execute a process which runs both frontend and…
Artur Wojcik
  • 51
  • 1
  • 2
4
votes
1 answer

When using torch.autocast, how do I force individual layers to float32

I'm trying to train a model in mixed precision. However, I want a few of the layers to be in full precision for stability reasons. How do I force an individual layer to be float32 when using torch.autocast? In particular, I'd like for this to be…
Luke
  • 6,699
  • 13
  • 50
  • 88
4
votes
1 answer

Converting Pytorch model to Keras using ONNX

I want to convert a pytorch model to keras using onnx based on this medium article: https://medium.com/analytics-vidhya/pytorch-to-keras-using-onnx-71d98258ad76 I reproduced the same code as this article but when I want to convert the onnx model to…
4
votes
1 answer

ONNX with custom ops from TensorFlow in Java

in order to make use of Machine Learning in Java, I'm trying to train a model in TensorFlow, save it as ONNX file and then use the file for inference in Java. While this works fine with simple models, it's getting more complicated using…
nf3lix
  • 58
  • 4
4
votes
1 answer

Python NSFW detection module nudenet not longer working?

I have been using the python module nudenet for my final degree project. I'm using google colab to run it. It worked correctly and without any problem during this last months until yesterday, when I tried to import it, this error happenend: !pip…
Pablo Cordon
  • 249
  • 2
  • 4
  • 11
4
votes
1 answer

Yolov5 OpenCV error: (-215:Assertion failed) whilst using .onnx

I've just created a yolov5 model, and exported it in the onnx format so it is usable with opencv but I keep getting the error: [ERROR:0] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\dnn.cpp (3554)…
4
votes
1 answer

onnxruntime not using CUDA

Environment: CentOS 7 python 3.9.5 CUDA: 11.4 cudnn: 8.2.4 onnxruntime-gpu: 1.9.0 nvidia driver: 470.82.01 1 tesla v100 gpu while onnxruntime seems to be recognizing the gpu, when inferencesession is created, no longer does it seem to recognize…
kwagjj
  • 807
  • 1
  • 13
  • 23
4
votes
1 answer

How to train a PyTorch model in TensorFlow.js?

I'm looking to export my PyTorch model into tensorflow.js and have the ability to finetune it in tensorflow.js. To do this, I first convert PyTorch weights to ONNX, then to tensorflow, and finally use tensorflowjs_converter to convert to…
Stanley
  • 801
  • 2
  • 10
  • 20
4
votes
1 answer

Onnx to trt - [8] Assertion failed: creator && "Plugin not found

I am using TensorRT in order to convert a model from onnx to trt -format. The model is originally a tensorflow model from Tensorflow Model Zoo (SSD ResNet50). When I try to convert it I get the error: [E] [TRT]…
Araw
  • 2,410
  • 3
  • 29
  • 57
1 2
3
53 54