Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Latest commit

History

History

bentoml

README.md

Running Whisper on edge with BentoML and whisper.cpp

This example demonstrates how to run Whisper on edge with BentoML and whisper.cpp using a custom CPP Runner.

Instruction

Install required dependencies:

pip install -r requirements.txt

To load a pretrained model, use Whisper.from_pretrained():

from whispercpp import Whisper

model = Whisper.from_pretrained("tiny.en")

# preprocess audio file and transcribe. You can use any preprocessing library you wish.
# the example uses librosa for convenience.
import librosa
import numpy as np
audio, _ = librosa.load("/path/to/audio.wav")
model.transcribe(audio.astype(np.float32))

Building bento

To package the bento, use build_bento.py:

python build_bento.py

To override existing bento, pass in --overrride:

python build_bento.py --override

Containerize bento

To containerize the bento, run bentoml containerize:

bentoml containerize whispercpp_asr