RWKVSharp icon indicating copy to clipboard operation
RWKVSharp copied to clipboard

"Protobuf parsing failed" when trying to load onnx model

Open HughPH opened this issue 2 years ago • 1 comments

This error occurs when running CRWKV.ONNX.Test.

Input Model Name (RWKV_32_2560_16.onnx): RWKV-4-Raven-3B-v11-Eng99-Other1-20230425-ctx4096_32_2560_16.bin
Loading...
Unhandled exception. Microsoft.ML.OnnxRuntime.OnnxRuntimeException: [ErrorCode:InvalidProtobuf] Load model from /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX.Test/bin/Debug/net6.0/Model/RWKV-4-Raven-3B-v11-Eng99-Other1-20230425-ctx4096_32_2560_16.bin failed:Protobuf parsing failed.
   at Microsoft.ML.OnnxRuntime.NativeApiStatus.VerifySuccess(IntPtr nativeStatus)
   at Microsoft.ML.OnnxRuntime.InferenceSession.Init(String modelPath, SessionOptions options, PrePackedWeightsContainer prepackedWeightsContainer)
   at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath, SessionOptions options)
   at RWKV.OnnxModel..ctor(String model, Int32 embed, Int32 layers) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX/RWKV/OnnxModel.cs:line 36
   at RWKV.RunnerFactoryExtend.RegisterRWKVOnnxModel(RunnerFactory runnerFactory, String name, String modelPath, String tokenizerPath, Int32 embed, Int32 layers) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX/RWKV/RunnerFactoryExtend.cs:line 15
   at RWKV.RunnerFactoryExtend.RegisterRWKVOnnxModel(RunnerFactory runnerFactory, String modelPath, String tokenizerPath, Int32 embed, Int32 layers) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX/RWKV/RunnerFactoryExtend.cs:line 10
   at Program.<Main>$(String[] args) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX.Test/Program.cs:line 17

Have also tried with 1B5

Input Model Name (RWKV_32_2560_16.onnx): RWKV-4-Raven-1B5-v11-Eng99-Other1-20230425-ctx4096_24_2048_16.bin
Loading...
Unhandled exception. Microsoft.ML.OnnxRuntime.OnnxRuntimeException: [ErrorCode:InvalidProtobuf] Load model from /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX.Test/bin/Debug/net6.0/Model/RWKV-4-Raven-1B5-v11-Eng99-Other1-20230425-ctx4096_24_2048_16.bin failed:Protobuf parsing failed.
   at Microsoft.ML.OnnxRuntime.NativeApiStatus.VerifySuccess(IntPtr nativeStatus)
   at Microsoft.ML.OnnxRuntime.InferenceSession.Init(String modelPath, SessionOptions options, PrePackedWeightsContainer prepackedWeightsContainer)
   at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath, SessionOptions options)
   at RWKV.OnnxModel..ctor(String model, Int32 embed, Int32 layers) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX/RWKV/OnnxModel.cs:line 36
   at RWKV.RunnerFactoryExtend.RegisterRWKVOnnxModel(RunnerFactory runnerFactory, String name, String modelPath, String tokenizerPath, Int32 embed, Int32 layers) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX/RWKV/RunnerFactoryExtend.cs:line 15
   at RWKV.RunnerFactoryExtend.RegisterRWKVOnnxModel(RunnerFactory runnerFactory, String modelPath, String tokenizerPath, Int32 embed, Int32 layers) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX/RWKV/RunnerFactoryExtend.cs:line 10
   at Program.<Main>$(String[] args) in /home/hugh/RiderProjects/CSharp-RWKV-V4/CRWKV.ONNX.Test/Program.cs:line 17
Aborted (core dumped)

These .bin files downloaded from: https://huggingface.co/imxcstar/rwkv-4-raven-onnx/tree/main

HughPH avatar Aug 12 '23 00:08 HughPH

For the next person who faces this... It's not obvious because HF doesn't show the whole filenames, but the smaller files are .onnx files which you will also need.

HughPH avatar Aug 12 '23 00:08 HughPH