Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align batch handling for serving run and batched run #252

Merged
merged 4 commits into from
Sep 25, 2023
Merged

Conversation

jonatanklosko
Copy link
Member

Uses the new Nx.Serving.batch_size/2 and also converts the input to a basic stream.

Comment on lines +107 to +114
if batch_size do
stream =
all_chunks
|> Stream.chunk_every(batch_size)
|> Stream.map(fn all_chunks ->
inputs = Bumblebee.Featurizer.process_input(featurizer, all_chunks)
Nx.Batch.concatenate([inputs])
end)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josevalim for now we still read the whole audio, but we chunk, so that the Bumblebee.Featurizer.process_input is called per batch, rather than for all chunks at once. I will later look at optimising ffmpeg to only decode chunk at a time.

mix.exs Outdated Show resolved Hide resolved
@jonatanklosko jonatanklosko merged commit a503832 into main Sep 25, 2023
2 checks passed
@jonatanklosko jonatanklosko deleted the jk-batch branch September 25, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants