Skip to content

Commit

Permalink
Remove deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Feb 21, 2024
1 parent ea78eb8 commit 5b3d7ac
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ This release changes the directory structure of the models cache, such that cach
* Removed the serving `:seed` option in favour of a runtime, per-input seed ([#303](https://github.com/elixir-nx/bumblebee/pull/303))
* Conversational serving ([#308](https://github.com/elixir-nx/bumblebee/pull/308))
* Specific tokenizer modules in favour of a single module ([#310](https://github.com/elixir-nx/bumblebee/pull/310))
* Removed the deprecated `Bumblebee.Audio.speech_to_text/5` (in favour of the more specific `speech_to_text_whisper/5`)

### Fixed

Expand Down
26 changes: 0 additions & 26 deletions lib/bumblebee/audio.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,6 @@ defmodule Bumblebee.Audio do
High-level tasks related to audio processing.
"""

# TODO: remove in v0.5
@deprecated "Use Bumblebee.Audio.speech_to_text_whisper/5 instead."
def speech_to_text(model_info, featurizer, tokenizer, generation_config, opts \\ []) do
serving = speech_to_text_whisper(model_info, featurizer, tokenizer, generation_config, opts)
client_postprocessing = serving.client_postprocessing

Nx.Serving.client_postprocessing(serving, fn output_pair, info ->
output = client_postprocessing.(output_pair, info)

if is_list(output) do
Enum.map(output, &speech_to_text_convert_output/1)
else
speech_to_text_convert_output(output)
end
end)
end

defp speech_to_text_convert_output(%{chunks: chunks}) do
text =
chunks
|> Enum.map_join(& &1.text)
|> String.trim()

%{results: [%{text: text}]}
end

@typedoc """
A term representing audio.
Expand Down

0 comments on commit 5b3d7ac

Please sign in to comment.