axon icon indicating copy to clipboard operation
axon copied to clipboard

(FunctionClauseError) no function clause matching in Nx.BinaryBackend.to_binary/1

Open vishal-h opened this issue 2 years ago • 5 comments

Trying out the example in https://github.com/elixir-nx/axon/blob/main/examples/generative/text_generator.exs throws the error (FunctionClauseError) no function clause matching in Nx.BinaryBackend.to_binary/1

    Attempted function clauses (showing 1 out of 1):
    
        defp to_binary(%Nx.Tensor{data: %{state: data}})
    
    (nx 0.5.3) lib/nx/binary_backend.ex:183: Nx.BinaryBackend.to_binary/1
    (nx 0.5.3) lib/nx/binary_backend.ex:1937: Nx.BinaryBackend.put_slice/5
    (nx 0.5.3) lib/nx/defn/evaluator.ex:418: Nx.Defn.Evaluator.eval_apply/4
    (nx 0.5.3) lib/nx/defn/evaluator.ex:239: Nx.Defn.Evaluator.eval/3
    (elixir 1.14.2) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.14.2) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (nx 0.5.3) lib/nx/container.ex:110: Nx.Container.Tuple.traverse/3
    #cell:rqzh2mse3mmtoh3y6bqigdl75hg64c5e:1: (file)

vishal-h avatar Jun 01 '23 03:06 vishal-h

Uses

Mix.install([
  {:axon, "~> 0.5"},
  {:nx, "~> 0.5.3"},
  {:exla, "~> 0.5"},
  {:req, "~> 0.3.3"}
])

vishal-h avatar Jun 01 '23 04:06 vishal-h

Please check your Mix.install logs to ensure the dependency installation worked properly

polvalente avatar Jun 01 '23 04:06 polvalente

Ok, so I tried to run this locally and it worked. I recommend:

  1. double checking that you're on latest Axon main
  2. Ensuring the libs were properly installed (it might be useful to add force: true to Mix.install to ensure you're actually getting the latest patch for each lib)
  3. If all still fails, it would be better to share either here or in a linked gist all of the command's output.

polvalente avatar Jun 01 '23 05:06 polvalente

@vishal-h were you able to get this working?

seanmor5 avatar Jun 08 '23 19:06 seanmor5

I got distracted with office work. Let me try again and revert.

vishal-h avatar Jun 09 '23 01:06 vishal-h