microsoft / microsoft/onnxruntime

.NET onnxruntime Protobuf parsing failed

Open
#20,133 6 comments 0 reactions 1 assignee Claimed by @prathikr View on GitHub
api:CSharp platform:windows
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the issue
Coming across a similar error when trying to use an ONNX model generated by optimum:

optimum-cli export onnx --model avsolatorio/GIST-small-Embedding-v0 --optimize O3 --device cpu --library-name transformers --trust-remote-code gist_quantized_fp16_O3_vcpu_tranformers/

Transformers version: 4.39.1
Platform: Linux-5.15.0-1055-aws-x86_64-with-glibc2.35
Python version: 3.10.12
Huggingface_hub version: 0.22.1
Safetensors version: 0.4.2
Accelerate version: 0.23.0
Accelerate config: not found
PyTorch version (GPU?): 2.0.1+cu118 (True)
Tensorflow version (GPU?): 2.14.0 (True)
Flax version (CPU?/GPU?/TPU?): not installed (NA)
Jax version: not installed
JaxLib version: not installed
onnx==1.15.0
onnxruntime-gpu==1.17.1
optimum==1.18.0

Getting the following error when trying when opening an InferenceSession using the model:

[ErrorCode:InvalidProtobuf] Load model from ... failed:Protobuf parsing failed.

### To reproduce
Try opening an InferenceSession using the model (too large to attach here unfortunately), then you get the exception. Netron is fine with it.

### Urgency

Expected behavior
File should be able to be opened since Netron opens it correctly detecting "ONNX v4" format, or at least we should have a more descriptive error.

![image](https://github.com/microsoft/onnxruntime/assets/12361146/86031f0d-eafe-47ae-87ee-c129fa37ddaf)

Have a project deadline that depends on this.

### Platform

Windows

### OS Version

Windows 10

### ONNX Runtime Installation

Released Package

### ONNX Runtime Version or Commit ID

1.17.1

### ONNX Runtime API

C#

### Architecture

X64

### Execution Provider

Default CPU

### Execution Provider Library Version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.