Open mooskagh opened 2 years ago
Code to repro keras error:
from onnx2keras import onnx_to_keras
import onnx
onnx_model = onnx.load("generated_network.onnx")
onnx_to_keras(onnx_model, ['/input/planes'])
After removing leading slashes, next error is
ValueError: Layer block0/conv2/se/matmul1 weight shape (1, 32) is not compatible with provided weight shape (384, 32).
It seems that onnx2keras just doesn't understand onnx well, I'm inclined not to push the slash removal (https://github.com/mooskagh/lc0/tree/onnx_slash) either.
I considered filing bugs in the onnx2keras repo, but the projects doesn't look alive, last commit was a year ago, probably not worth it.
Apparently, Keras doesn't like such onnx files, giving the error:
Fix is this: Remove trailing slashes in this file https://github.com/LeelaChessZero/lc0/blob/master/src/neural/onnx/converter.cc (basically, replace all
"/
which are not part of+ "/
with"
).