Skip to content
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

Loading ONNX models #2

Open
berkay-onder opened this issue Apr 26, 2019 · 4 comments
Open

Loading ONNX models #2

berkay-onder opened this issue Apr 26, 2019 · 4 comments

Comments

@berkay-onder
Copy link

I tried to load ONNX models with ONNXKnet.load_model using Julia 1.0.3 and I am getting the following error:

MethodError: no method matching foldl(::getfield(DataFlow, Symbol("##70#71")), ::IVertex, ::Tuple{Int64})
Closest candidates are:
foldl(::Any, ::Any; kw...) at reduce.jl:88

Stacktrace:
[1] inputnode(::Int64) at /kuacc/users/bonder17/.julia/packages/DataFlow/0bc6q/src/syntax/sugar.jl:178
[2] (::getfield(ONNXKnet, Symbol("##15#16")){Dict{Any,Any}})(::ONNXKnet.Types.ValueInfo) at ./none:0
[3] iterate at ./generator.jl:47 [inlined]
[4] _all(::getfield(Base, Symbol("##220#222")), ::Base.Generator{Array{ONNXKnet.Types.ValueInfo,1},getfield(ONNXKnet, Symbol("##15#16")){Dict{Any,Any}}}, ::Colon) at ./reduce.jl:660
[5] all at ./reduce.jl:656 [inlined]
[6] Dict(::Base.Generator{Array{ONNXKnet.Types.ValueInfo,1},getfield(ONNXKnet, Symbol("##15#16")){Dict{Any,Any}}}) at ./dict.jl:131
[7] _graph(::ONNXKnet.Types.Graph) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/graph/graph.jl:49
[8] graph(::ONNXKnet.Types.Graph) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/graph/graph.jl:96
[9] code(::ONNXKnet.Types.Graph) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/graph/graph.jl:104
[10] write_julia_file(::String) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/convert.jl:221
[11] load_model(::String) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/convert.jl:236
[12] top-level scope at In[2]:1

As an example, I tried loading to load MobileNet model from https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/mobilenetv2-1.0.onnx

using

ONNXKnet.load_model("mobilenetv2-1.0.onnx")

command after downloading the model file into my working directory.

Thank you for your help.

@ayush-1506
Copy link
Member

ayush-1506 commented Apr 27, 2019

This is because this package depends on the latest version of DataFlow.jl, but when you ]add ONNXKnet , it just uses the last tagged version. Can you try ]dev DataFlow , cd ~/.julia/dev/DataFlow/ && git pull and then try loading the model?

@berkay-onder
Copy link
Author

Hi,

I added tagged version of DataFlow.jl using the commands specified, but this time I get

KeyError: key :BatchNormalization not found

Stacktrace:
[1] getindex(::Dict{Symbol,Any}, ::Symbol) at ./dict.jl:478
[2] _graph(::ONNXKnet.Types.Graph) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/graph/graph.jl:0
[3] graph(::ONNXKnet.Types.Graph) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/graph/graph.jl:96
[4] code(::ONNXKnet.Types.Graph) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/graph/graph.jl:104
[5] write_julia_file(::String) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/convert.jl:221
[6] load_model(::String) at /kuacc/users/bonder17/.julia/dev/ONNXKnet/src/convert.jl:236
[7] top-level scope at In[2]:1

error when I try to load ONNX models using ONNXKnet.load_model command.

@ayush-1506
Copy link
Member

Yes, that is because I'm still working on adding batchnorm interface. For now, you could try loading the mnist model (https://github.com/onnx/models/tree/master/mnist).

@ayush-1506
Copy link
Member

@berkay-onder You can look at the currently supported operators here : https://github.com/KnetML/ONNXKnet.jl#supported-operators
(I'm a bit busy with exams right now, but I'll work on more ops soon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants