Skip to content

Cannot load any ONNX models - 28 tests fail #43

@NikEyX

Description

@NikEyX

Hi,

I am using Julia 1.5.0-beta1.0 and am encountering the following when trying to run the tests:

  Test threw exception
  Expression: ≈(((ONNX.ops[Symbol(get_optype(read_model(filename)))])(get_dict(read_model(filename)), ip...) |> syntax) |> eval, op_expected, atol = 0.001)
  syntax: unexpected semicolon in tuple
  Stacktrace:
   [1] top-level scope at none:1
   [2] eval at ./boot.jl:331 [inlined]
   [3] eval(::Expr) at ./client.jl:467
   [4] |>(::Expr, ::typeof(eval)) at ./operators.jl:834
   [5] main_test(::String, ::Array{Float32,2}, ::Array{Float32,2}) at /home/xxx/.julia/packages/ONNX/iz0dL/test/ops_tests.jl:114
   [6] top-level scope at /home/xxx/.julia/packages/ONNX/iz0dL/test/conversions.jl:5
   [7] include(::String) at ./client.jl:457
   [8] top-level scope at /home/xxx/.julia/packages/ONNX/iz0dL/test/runtests.jl:8
   [9] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Test/src/Test.jl:1114
   [10] top-level scope at /home/xxx/.julia/packages/ONNX/iz0dL/test/runtests.jl:8

......

Test Summary: | Error  Total
ONNX          |    28     28
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 28 errored, 0 broken.

All errors are the same.

Furthermore (and not sure if related) I cannot load any pre-trained models, they all fail, here is on ResNet:

julia> using Flux, ONNX
julia> ONNX.load_model("resnet101-v1-7.onnx")
ERROR: cannot read wire type 2 as int64
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] read_field(::IOStream, ::ONNX.Proto.ModelProto, ::ProtoBuf.ProtoMetaAttribs, ::UInt64, ::Nothing) at /home/xxx/.julia/packages/ProtoBuf/JY3fQ/src/codec.jl:470
 [3] readproto(::IOStream, ::ONNX.Proto.ModelProto, ::ProtoBuf.ProtoMeta) at /home/xxx/.julia/packages/ProtoBuf/JY3fQ/src/codec.jl:502
 [4] readproto(::IOStream, ::ONNX.Proto.ModelProto) at /home/xxx/.julia/packages/ProtoBuf/JY3fQ/src/codec.jl:486
 [5] rawproto at /home/xxx/.julia/packages/ONNX/iz0dL/src/convert.jl:3 [inlined]
 [6] open(::typeof(ONNX.rawproto), ::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./io.jl:325
 [7] open at ./io.jl:323 [inlined]
 [8] rawproto at /home/xxx/.julia/packages/ONNX/iz0dL/src/convert.jl:4 [inlined]
 [9] write_weights(::String) at /home/xxx/.julia/packages/ONNX/iz0dL/src/convert.jl:204
 [10] load_model(::String) at /home/xxx/.julia/packages/ONNX/iz0dL/src/convert.jl:249
 [11] top-level scope at REPL[2]:1

and even my own super simple 3 layer MLP fails with yet another different msg, though I can see that layers.0.weight is in the file:

ERROR: KeyError: key "layers.0.weight" not found
Stacktrace:
 [1] getindex at ./dict.jl:467 [inlined]
 [2] (::ONNX.var"#120#122"{Dict{String,IVertex}})(::String) at /home/xxx/.julia/packages/ONNX/iz0dL/src/graph/graph.jl:57
 [3] iterate at ./generator.jl:47 [inlined]
 [4] collect_to!(::Array{IVertex,1}, ::Base.Generator{Array{AbstractString,1},ONNX.var"#120#122"{Dict{String,IVertex}}}, ::Int64, ::Int64) at ./array.jl:734
 [5] collect_to_with_first! at ./array.jl:712 [inlined]
 [6] _collect(::Array{AbstractString,1}, ::Base.Generator{Array{AbstractString,1},ONNX.var"#120#122"{Dict{String,IVertex}}}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:706
 [7] collect_similar(::Array{AbstractString,1}, ::Base.Generator{Array{AbstractString,1},ONNX.var"#120#122"{Dict{String,IVertex}}}) at ./array.jl:630
 [8] map(::Function, ::Array{AbstractString,1}) at ./abstractarray.jl:2145
 [9] _graph(::ONNX.Types.Graph) at /home/xxx/.julia/packages/ONNX/iz0dL/src/graph/graph.jl:57
 [10] graph(::ONNX.Types.Graph) at /home/xxx/.julia/packages/ONNX/iz0dL/src/graph/graph.jl:92
 [11] code(::ONNX.Types.Graph) at /home/xxx/.julia/packages/ONNX/iz0dL/src/graph/graph.jl:100
 [12] write_julia_file(::String) at /home/xxx/.julia/packages/ONNX/iz0dL/src/convert.jl:235
 [13] load_model(::String) at /home/xxx/.julia/packages/ONNX/iz0dL/src/convert.jl:250
 [14] top-level scope at REPL[2]:1

Any advice to make this work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions