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
2
votes
1 answer

tf_rep.export_graph(tf_model_path): KeyError: 'input.1

I am trying to convert a onnx model to tflite, im facing an error executing line tf_rep.export_graph(tf_model_path). This question was asked in SO before but none provided a definitive solution. Requirements installed: tensorflow: 2.12.0, onnx…
afsara_ben
  • 542
  • 1
  • 11
  • 30
2
votes
0 answers

ONNX as a form of model managment

I have am working on a project that requires the use of previously created model objects. They have all been built with scikit-learn but with different library versions (0.23.1, 0.23.2, 1.0.2, and 1.2.2). I have always been under the assumption that…
magladde
  • 614
  • 5
  • 23
2
votes
1 answer

Failed to use OnnxRuntime on Windows 7

Here's an issue we are encountering when using OnnxRuntime on Windows 7. We have provided below the software environment of our machine for your reference. Software Environment Windows 10 Visual Studio 2022 dotnet 6.0 Microsoft.ML.OnnxRuntime…
2
votes
0 answers

How can I execute decoder of ONNX Export from Seq2Seq model

I made an export of the Helsinki model using python optimum and i am trying to run the model with only the onnx environment and implement beam search from scratch because I have to later port this to a system not running python. So I want to…
klsmgföl
  • 21
  • 3
2
votes
1 answer

Export MarianMT model to ONNX

I would like to use the Helsinki-NLP/opus-mt-de-en model from HuggingFace to translate text. This works fine with the HuggingFace Inference API or a Transformers pipeline, e.g.: from transformers import AutoTokenizer, pipeline from…
RGe
  • 1,181
  • 1
  • 10
  • 19
2
votes
3 answers

How do I export a Pytorch model from Huggingface into ONNX with tokenizer included?

I'm trying to convert a huggingface model into ONNX so I can use it in BigQuery ML. The latter one allows importing ONNX models. However transformers tokenizer is never included into the model. How do I export a model WITH tokenizer into a single…
stkvtflw
  • 12,092
  • 26
  • 78
  • 155
2
votes
0 answers

ONNX sklearn model interface for android only returns class label as output

I am trying to get probability/confidence score from the model on my android application. While creating the ONNX model in python, I am able to see the confidence/probability score for a given input. However, when I give the same input on Android,…
ImMathan
  • 3,911
  • 4
  • 29
  • 45
2
votes
1 answer

Why Onnxruntime runs 2-3x slower in C++ than Python?

I have a code that runs 3 inference sessions one after the other. The problem that I am having is that it only runs at top performance in my Mac and the Windows VM (VMWare) that runs in my Mac. It takes between 58-68s to run my test set. When I ask…
Adriel Jr
  • 2,451
  • 19
  • 25
2
votes
0 answers

How to post-process a Yolov7 ONNX model?

I trained a YOLOv7 model on a custom dataset and converted it to ONNX. The input of the model on Netron reads "Float32(1,3,640,640)" which I understand. The output, however, is unclear to me as other tutorials mentioned there should be 6 elements…
Loay Altal
  • 21
  • 3
2
votes
0 answers

RuntimeError: Argument passed to at() was not in the map

I am trying to generate an ONNX file from a neural network model called GANet which is made in PyTorch. However, I am facing the RuntimeError: Argument passed to at() was not in the map error. System settings: Python 3.9.13 and PyTorch 1.13.0. The…
user297962
  • 21
  • 2
2
votes
1 answer

torch.onnx.export() raises indexError: too many indices for tensor of dimension 2

This is the snipped of my code, dummy_input = torch.randn(800, 1067, 3) torch.onnx.export(model, dummy_input, "/content/model/detectron2.onnx", opset_version=11) This is the error it gives: 22 dummy_input = torch.randn(800, 1067, 3) ---> 23…
2
votes
1 answer

How to export trained stable-baselines/TensorFlow neural network to MATLAB?

I'm trying to export a PPO2-trained neural network to MATLAB. It was saved as a zip file using model.save(os.path.join(save_dir, 'best_overall_model')) I can load my model with model = PPO2.load(os.path.join(load_dir), env=env,…
gilianzz
  • 199
  • 2
  • 14
2
votes
1 answer

Getting different results after converting a model to from pytorch to ONNX

I'm coverting a googlenet model form pytorch to onnx using the following code: torch.onnx.export(model, # model being run input_batch, # model input (or a tuple for multiple inputs) …
Luis Ramon Ramirez Rodriguez
  • 9,591
  • 27
  • 102
  • 181
2
votes
1 answer

How to convert ONNX back to pth format

I have a model in onnx format, and I want to run it in fastai learner. possibly something like this learn = learn.load('model.onnx') another way is to convert back to pth format, but I dont see any proper library on this task. I need your help in…
2
votes
0 answers

Stripping down/modifying Yolov5 for real-time on RPi4

I want to use my Raspberry Pi 4 to detect license plates in real time without any hardware add-ons. I know it doesn't sound very feasible but hear me out. I am using two ways of optimizing the network for this purpose: stripping down the neurons of…