-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
julia 1.7.2 using ONNXNaiveNASflux predict wiill get error #67
Comments
Thanks for the report. The error states that the model uses the Div operator which ONNXNaiveNASflux does not yet support. I can add support for it, but it would be good if you can provide a link to the model so I can see if there are other ops in there which needs to be added. You can register the Div operator yourself by running this before you try to load the model: ONNXNaiveNASflux.verts[:Div] = (name, inputs, params; kwargs...) -> ONNXNaiveNASflux.elemwisevertex(name, inputs, params, /, 1; kwargs...)
ONNXNaiveNASflux.refresh()
|
Thanks for your support. The model onnx link: https://github.com/onnx/models/blob/main/vision/classification/mnist/model/mnist-1.onnx |
I had a look at the model and it seems to be a very old type of model which is using version 1 of the ONNX spec (current version is 8). It seems to use a very different mechanism for loading model parameters (storing them as constant nodes in the graph) than the one implemented in this package (initializers). The consequence is that in order to hoist it into a Flux model I would need to implement some form of constant propagation on the protostructs. I think it would be possible to add support for it but it would require quite a bit of effort as working with the "raw" protos is quite cumbersome. Given that the model is for a toy-dataset, is there any chance that you just tried this to see if the library worked? If so, I would prefer to just put "implement constant propagation" in the backlog for now and revisit if it surfaces again. Implementing it now might hamper future additions so it is not a one-time cost to support it. To add a little bit of context: Flux and ONNX use very different layer definitions (which is a natural consequence of them being developed independently) so not every valid ONNX model is a valid Flux model and vice versa. In many cases it is possible to transform to an equivalent model, but there is no method which is guaranteed to always work. This problem is not unique to Flux vs ONNX: All the major frameworks suffer from this to some extent. |
thanks. I can use other versions of model files, but I will use Julia as the architecture later in the technical research phase. |
using ONNXNaiveNASflux
using MLDatasets
train_x, train_y = MNIST.traindata(2)
data=train_x[:,:,1]
input = reshape(data,(1,1,28,28))
model = ONNXNaiveNASflux.load("mnist-1.onnx")
out = model(input)
exe top these ,will get error "ERROR: LoadError: AssertionError: Optype Div not supported!" ONNX 0.11 has same proplem.
The text was updated successfully, but these errors were encountered: