r4z4

r4z4

Hey everyone. I try to refrain from coming here with all my problems but I am truly at a loss with this one and I thought it was worth a shot to see if anyone had any ideas on the matter.

The background is that I am just trying to get Whisper set up via Bumblebee. I am getting an error that references a to_operator function that I cannot seem to find anywhere. It is in a module I cannot seem to find, either. The whole thing is just throwing me off.

Anyways, I am following a pretty basic set up as I will show, and then just getting an error that seems to stem from it creating the pow operator with the arguments that it gets, but I just cant get past that in my head. When I removed the EXLA backend line, I got an error stating that the pow operator was undefined.

  defp serving do
    {:ok, whisper} = Bumblebee.load_model({:hf, "openai/whisper-tiny"})
    {:ok, featurizer} = Bumblebee.load_featurizer({:hf, "openai/whisper-tiny"})
    {:ok, tokenizer} = Bumblebee.load_tokenizer({:hf, "openai/whisper-tiny"})

    serving =
      Bumblebee.Audio.speech_to_text(whisper, featurizer, tokenizer,
        max_new_tokens: 100,
        defn_options: [compiler: EXLA]
      )
  end

  def handle_event("predict", value, socket) do
    text = {:file, "03_Smile.wav"}
      |> then(&Nx.Serving.run(serving, &1))
      |> get_in([:results, Access.all(), :text])

    {:noreply,
    socket
    |> assign(text: text)}
  end

& then here is the to_operator error message:

[error] GenServer #PID<0.2273.0> terminating
** (FunctionClauseError) no function clause matching in EXLA.Defn.to_operator/4
    (exla 0.4.2) EXLA.Defn.to_operator(:pow, [%EXLA.Op{builder: #Reference<0.2409059649.1181614081.76036>, ref: #Reference<0.2409059649.1181614081.76933>}, %EXLA.Op{builder: #Reference<0.2409059649.1181614081.76036>, ref: #Reference<0.2409059649.1181614081.76934>}], #Nx.Tensor<
  f32[frames: 3000][frequencies: 400]
  
  Nx.Defn.Expr
  parameter a:0                          f32[480000]
  b = iota nil                           s64[400][1]
  c = concatenate [0, b], 1              s64[400][2]
  d = while {0.0, 0, 0, a, c}            tuple5
  e = elem d, 0                          f32[3000][400]
  f = iota nil                           f32[401]
  g = multiply 6.283185307179586, f      f32[401]
  h = divide g, 400                      f32[401]
  i = cos h                              f32[401]
  j = subtract 1, i                      f32[401]
  k = multiply 0.5, j                    f32[401]
  l = slice k, [0], [400], [1]           f32[400]
  m = multiply e, l                      f32[3000][400]
  n = fft m, length: 400, eps: 1.0e-10   c64[3000][400]
  o = abs n                              f32[3000][400]
  p = pow o, 2                           f32[3000][400]
>, %{builder: %EXLA.Builder{ref: #Reference<0.2409059649.1181614081.76036>, parent: nil, name: "#Function<136.4924062/1 in Nx.Defn.Compiler.fun/2>"}, params: %{0 => %EXLA.Op{builder: #Reference<0.2409059649.1181614081.76036>, ref: #Reference<0.2409059649.1181614081.76245>}}, precision: :highest, scope_ids: %{#Reference<0.2409059649.1181483009.76217> => :reshape, #Reference<0.2409059649.1181483009.76213> => :slice, #Reference<0.2409059649.1181483009.76207> => :greater_equal, #Reference<0.2409059649.1181483009.76198> => :add, #Reference<0.2409059649.1181483009.76204> => :multiply, #Reference<0.2409059649.1181483009.76226> => :min, #Reference<0.2409059649.1181483009.76194> => :subtract, #Reference<0.2409059649.1181483009.76232> => :reshape, #Reference<0.2409059649.1181483009.76227> => :max, #Reference<0.2409059649.1181483009.76234> => :slice, #Reference<0.2409059649.1181483009.76202> => :divide, #Reference<0.2409059649.1181483009.76039> => :multiply, #Reference<0.2409059649.1181483009.76210> => :exp, #Reference<0.2409059649.1181483009.76238> => :log, #Reference<0.2409059649.1181483009.76196> => :iota, #Reference<0.2409059649.1181483009.76030> => :parameter, #Reference<0.2409059649.1181483009.76193> => :reshape, #Reference<0.2409059649.1181483009.76225> => :divide, #Reference<0.2409059649.1181483009.76205> => :add, #Reference<0.2409059649.1181483009.76208> => :subtract, #Reference<0.2409059649.1181483009.76243> => :add, #Reference<0.2409059649.1181483009.76223> => :slice, #Reference<0.2409059649.1181483009.76220> => :negate, #Reference<0.2409059649.1181483009.76209> => :multiply, #Reference<0.2409059649.1181483009.76216> => :reshape, #Reference<0.2409059649.1181483009.76201> => :subtract, #Reference<0.2409059649.1181483009.76229> => :slice, #Reference<0.2409059649.1181483009.76203> => :iota, #Reference<0.2409059649.1181483009.76175> => :fft, #Reference<0.2409059649.1181483009.76169> => :elem, #Reference<0.2409059649.1181483009.76219> => :slice, #Reference<0.2409059649.1181483009.76206> => :multiply, #Reference<0.2409059649.1181483009.76197> => :multiply, #Reference<0.2409059649.1181483009.76222> => :divide, #Reference<0.2409059649.1181483009.76231> => :divide, #Reference<0.2409059649.1181483009.76168> => :while, #Reference<0.2409059649.1181483009.76233> => :multiply, #Reference<0.2409059649.1181483009.76191> => :pow, #Reference<0.2409059649.1181483009.76215> => :subtract, #Reference<0.2409059649.1181483009.76190> => :abs, #Reference<0.2409059649.1181483009.76200> => :reshape, #Reference<0.2409059649.1181483009.76192> => :reshape, #Reference<0.2409059649.1181483009.76047> => :iota, #Reference<0.2409059649.1181483009.76042> => :subtract, #Reference<0.2409059649.1181483009.76048> => :concatenate, #Reference<0.2409059649.1181483009.76211> => :multiply, ...}})
    (exla 0.4.2) lib/exla/defn.ex:582: EXLA.Defn.cached_recur_operator/4
    (exla 0.4.2) lib/exla/defn.ex:474: EXLA.Defn.recur_operator/3
    (nx 0.5.1) lib/nx/defn/tree.ex:212: Nx.Defn.Tree.apply_args/4
    (exla 0.4.2) lib/exla/defn.ex:581: EXLA.Defn.cached_recur_operator/4
    (exla 0.4.2) lib/exla/defn.ex:474: EXLA.Defn.recur_operator/3
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (exla 0.4.2) lib/exla/defn.ex:581: EXLA.Defn.cached_recur_operator/4
    (exla 0.4.2) lib/exla/defn.ex:474: EXLA.Defn.recur_operator/3
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (exla 0.4.2) lib/exla/defn.ex:581: EXLA.Defn.cached_recur_operator/4
    (exla 0.4.2) lib/exla/defn.ex:474: EXLA.Defn.recur_operator/3
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (exla 0.4.2) lib/exla/defn.ex:581: EXLA.Defn.cached_recur_operator/4
    (exla 0.4.2) lib/exla/defn.ex:474: EXLA.Defn.recur_operator/3
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (exla 0.4.2) lib/exla/defn.ex:581: EXLA.Defn.cached_recur_operator/4
    (exla 0.4.2) lib/exla/defn.ex:474: EXLA.Defn.recur_operator/3
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (exla 0.4.2) lib/exla/defn.ex:581: EXLA.Defn.cached_recur_operator/4
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F04_pmJLkpzdPyZh", event: "event", payload: %{"event" => "predict", "type" => "click", "value" => %{"value" => ""}}, ref: "8", join_ref: "4"}
State: %{components: {%{}, %{}, 1}, join_ref: "4", serializer: Phoenix.Socket.V2.JSONSerializer, socket: #Phoenix.LiveView.Socket<id: "phx-F04_pmJLkpzdPyZh", endpoint: AppWeb.Endpoint, view: AppWeb.WhisperLive, parent_pid: nil, root_pid: #PID<0.2273.0>, router: AppWeb.Router, assigns: %{__changed__: %{}, flash: %{}, live_action: :index, prediction: nil, running?: false, serving: %Nx.Serving{module: Nx.Serving.Default, arg: #Function<0.94466209/1 in Bumblebee.Audio.SpeechToText.speech_to_text/4>, client_preprocessing: #Function<1.94466209/1 in Bumblebee.Audio.SpeechToText.speech_to_text/4>, client_postprocessing: #Function<2.94466209/3 in Bumblebee.Audio.SpeechToText.speech_to_text/4>, distributed_postprocessing: &Function.identity/1, process_options: [batch_size: nil], defn_options: [compiler: EXLA]}, text: nil}, transport_pid: #PID<0.2266.0>, ...>, topic: "lv:phx-F04_pmJLkpzdPyZh", upload_names: %{}, upload_pids: %{}}

Thanks everyone, you guys are great. Any help is much appreciated, and just trying to see if anyone just make a little more sense of what is going on exactly than I am able to :slight_smile:

Thanks again

Showing Posts 1 to 3

polvalente

polvalente

Nx Core Team

Try updating to EXLA 0.5

codeanpeace

codeanpeace

Could it be a file path issue? Where is the .wav located?

    |> Nx.Serving.client_preprocessing(fn input ->
        ...
          {:file, path} when is_binary(path) ->
            ffmpeg_read_as_pcm(path, sampling_rate)
        ...

  defp ffmpeg_read_as_pcm(path, sampling_rate) do
    ...

    cond do
      System.find_executable("ffmpeg") == nil ->
        {:error, "ffmpeg not found in PATH"}


      not File.exists?(path) ->
        {:error, "no file found at #{path}"}


      true ->
        System.cmd("ffmpeg", [
          "-i",
          path,
          "-ac",
          Integer.to_string(channels),
          "-ar",
          Integer.to_string(sampling_rate),
          "-f",
          format,
          "-hide_banner",
          "-loglevel",
          "quiet",
          "pipe:1"
        ])
        |> case do
          {data, 0} ->
            {:ok, Nx.from_binary(data, :f32)}


          {_, 1} ->
            {:error, "ffmpeg failed to decode the given file"}
        end
    end
  end

source: bumblebee/lib/bumblebee/audio/speech_to_text.ex at ce43378d2f63cbd55a8f5c12f759f3f43e578576 · elixir-nx/bumblebee · GitHub

r4z4

r4z4 OP

Thanks all. Of course it was me just being dumb and failing to update EXLA.

— All posts loaded —

Where Next? Top

Trending in Questions Top

axelson
One of my LiveView view’s has a very heavy javascript dependency so I want to avoid loading it for every page on the site, while still us...
New
yasoob
Hi all! I know that quite a few people use Phoenix LiveView but it is hard to get a more up-to-date list of folks/companies using it. I ...
New
neurodynamic
I have a page in my Phoenix app with some LiveView code. When you click a button, it shows the Stripe credit card modal form via a Hook. ...
New
Hellowman
Hello everyone! I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++. Does anyone ...
New
yarrichar
I’m very new to Elixir, so sorry if this is a silly question: I am wondering what happens to the mailbox of a process when the machine i...
New
mandar1045
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
Fl4m3Ph03n1x
Background When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error: * assembling mark...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
261 13183 112
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
charlenopires
Hi everyone :waving_hand: I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews