mortont/axon_onnx

Fail to run on Elixir 1.16.0-rc.0

Closed this issue · 9 comments

Hi,

I just tested axon_onnx with Elixir 1.16.0-rc.0, but I got an error:

Reproducing process is here:

  1. Run iex
  2. Run Mix.install([:axon_onnx])
  3. Then the following warnings and error occurs:
==> axon_onnx
Compiling 28 files (.ex)
     warning: Nx.power/2 is deprecated. Use pow/2 instead364{"Pow", &Nx.power/2, :power},
     │                 ~
     │
     └─ lib/axon_onnx/deserialize.ex:364:17: AxonOnnx.Deserialize (module)

    warning: Nx.power/2 is deprecated. Use pow/2 instead44x |> Nx.power(2) |> Nx.sum(opts)
    │             ~
    │
    └─ lib/axon_onnx/shared.ex:44:13: AxonOnnx.Shared."__defn:sumsquare__"/2
    └─ lib/axon_onnx/shared.ex:52:13: AxonOnnx.Shared."__defn:l2_norm__"/2
    └─ lib/axon_onnx/shared.ex:63:18: AxonOnnx.Shared."__defn:lrn__"/2
    └─ lib/axon_onnx/shared.ex:65:16: AxonOnnx.Shared."__defn:lrn__"/2

    warning: Nx.Defn.Kernel.transform/2 is deprecated. Use deftransform/2 or deftransformp/2 from Nx.Defn instead58axes = transform(size, &Enum.to_list(0..(&1 - 1)))
    │            ~
    │
    └─ lib/axon_onnx/shared.ex:58:12: AxonOnnx.Shared."__defn:lrn__"/2
    └─ lib/axon_onnx/shared.ex:94:7: AxonOnnx.Shared."__defn:numpy_matmul__"/3

** (EXIT from #PID<0.109.0>) shell process exited with reason: an exception was raised:
    ** (ArithmeticError) bad argument in arithmetic expression
        :erlang.-(nil, 1)
        (elixir 1.16.0-rc.0) src/elixir_errors.erl:78: :elixir_errors.traverse_file_line/2
        (elixir 1.16.0-rc.0) src/elixir_errors.erl:64: :elixir_errors.get_file_line/2
        (elixir 1.16.0-rc.0) src/elixir_errors.erl:29: :elixir_errors.print_warning/2
        (elixir 1.16.0-rc.0) lib/module/parallel_checker.ex:311: anonymous fn/2 in Module.ParallelChecker.emit_warnings/2
        (elixir 1.16.0-rc.0) lib/enum.ex:4329: Enum.flat_map_list/2
        (elixir 1.16.0-rc.0) lib/module/parallel_checker.ex:266: Module.ParallelChecker.check_module/3
        (elixir 1.16.0-rc.0) lib/module/parallel_checker.ex:82: anonymous fn/6 in Module.ParallelChecker.spawn/4


18:57:57.509 [error] Process #PID<0.1637.0> raised an exception
** (ArithmeticError) bad argument in arithmetic expression
    :erlang.-(nil, 1)
    (elixir 1.16.0-rc.0) src/elixir_errors.erl:78: :elixir_errors.traverse_file_line/2
    (elixir 1.16.0-rc.0) src/elixir_errors.erl:64: :elixir_errors.get_file_line/2
    (elixir 1.16.0-rc.0) src/elixir_errors.erl:29: :elixir_errors.print_warning/2
    (elixir 1.16.0-rc.0) lib/module/parallel_checker.ex:311: anonymous fn/2 in Module.ParallelChecker.emit_warnings/2
    (elixir 1.16.0-rc.0) lib/enum.ex:4329: Enum.flat_map_list/2
    (elixir 1.16.0-rc.0) lib/module/parallel_checker.ex:266: Module.ParallelChecker.check_module/3
    (elixir 1.16.0-rc.0) lib/module/parallel_checker.ex:82: anonymous fn/6 in Module.ParallelChecker.spawn/4

This is an Elixir bug. I will look into it.

@josevalim Thank you for informing. In fact, I was thinking about whether to report the issue to Elixir or axon_onnx, but I decided to prioritize reporting it as soon as possible.

Fixed, thank you for trying out the RC!

Thanks! I found it is fixed on the main branch.

@josevalim Excuse me, I found an issue:

On main branch of Elixir and Erlang/OTP 24.3.4.13:

  1. Run iex
  2. Run Mix.install([:axon_onnx])
  3. The following error occurs:
==> axon_onnx
Compiling 28 files (.ex)
     warning: Nx.power/2 is deprecated. Use pow/2 instead364{"Pow", &Nx.power/2, :power},
     │                 ~
     │
     └─ lib/axon_onnx/deserialize.ex:364:17: AxonOnnx.Deserialize (module)

    warning: Nx.power/2 is deprecated. Use pow/2 instead44x |> Nx.power(2) |> Nx.sum(opts)
    │             ~
    │
    └─ lib/axon_onnx/shared.ex:44:13: AxonOnnx.Shared."__defn:sumsquare__"/2
    └─ lib/axon_onnx/shared.ex:52:13: AxonOnnx.Shared."__defn:l2_norm__"/2
    └─ lib/axon_onnx/shared.ex:63:18: AxonOnnx.Shared."__defn:lrn__"/2
    └─ lib/axon_onnx/shared.ex:65:16: AxonOnnx.Shared."__defn:lrn__"/2

    warning: Nx.Defn.Kernel.transform/2 is deprecated. Use deftransform/2 or deftransformp/2 from Nx.Defn instead58axes = transform(size, &Enum.to_list(0..(&1 - 1)))
    │            ~
    │
    └─ lib/axon_onnx/shared.ex:58:12: AxonOnnx.Shared."__defn:lrn__"/2
    └─ lib/axon_onnx/shared.ex:94:7: AxonOnnx.Shared."__defn:numpy_matmul__"/3

** (EXIT from #PID<0.103.0>) shell process exited with reason: an exception was raised:
    ** (ArithmeticError) bad argument in arithmetic expression
        (elixir 1.17.0-dev) src/elixir_errors.erl:78: :elixir_errors.traverse_file_line/2
        (elixir 1.17.0-dev) src/elixir_errors.erl:64: :elixir_errors.get_file_line/2
        (elixir 1.17.0-dev) src/elixir_errors.erl:29: :elixir_errors.print_warning/2
        (elixir 1.17.0-dev) lib/module/parallel_checker.ex:311: anonymous fn/2 in Module.ParallelChecker.emit_warnings/2
        (elixir 1.17.0-dev) lib/enum.ex:4329: Enum.flat_map_list/2
        (elixir 1.17.0-dev) lib/module/parallel_checker.ex:266: Module.ParallelChecker.check_module/3
        (elixir 1.17.0-dev) lib/module/parallel_checker.ex:82: anonymous fn/6 in Module.ParallelChecker.spawn/4

Interactive Elixir (1.17.0-dev) - press Ctrl+C to exit (type h() ENTER for help) 

20:59:56.935 [error] Process #PID<0.1654.0> raised an exception
** (ArithmeticError) bad argument in arithmetic expression
    (elixir 1.17.0-dev) src/elixir_errors.erl:78: :elixir_errors.traverse_file_line/2
    (elixir 1.17.0-dev) src/elixir_errors.erl:64: :elixir_errors.get_file_line/2
    (elixir 1.17.0-dev) src/elixir_errors.erl:29: :elixir_errors.print_warning/2
    (elixir 1.17.0-dev) lib/module/parallel_checker.ex:311: anonymous fn/2 in Module.ParallelChecker.emit_warnings/2
    (elixir 1.17.0-dev) lib/enum.ex:4329: Enum.flat_map_list/2
    (elixir 1.17.0-dev) lib/module/parallel_checker.ex:266: Module.ParallelChecker.check_module/3
    (elixir 1.17.0-dev) lib/module/parallel_checker.ex:82: anonymous fn/6 in Module.ParallelChecker.spawn/4
iex(1)>                          

What does elixir -v return?

$ elixir -v
Erlang/OTP 24 [erts-12.3.2.13] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]

Elixir 1.17.0-dev (7a570ab) (compiled with Erlang/OTP 24)

You are on a commit from yesterday, please get the latest :) (also note that main no longer supports OTP 24!).

I see!