From 82a5380ad739c2f662b594619cc7d21a3babdb27 Mon Sep 17 00:00:00 2001 From: PiotrBLL Date: Fri, 8 Nov 2024 18:17:37 +0100 Subject: [PATCH] Fix Dockerfile.hpu `ffmpeg` package install, update README.md whisper container usage --- Dockerfile.hpu | 10 +++++++++- README.md | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Dockerfile.hpu b/Dockerfile.hpu index 6d4e080..a3b7b11 100644 --- a/Dockerfile.hpu +++ b/Dockerfile.hpu @@ -22,9 +22,17 @@ RUN apt-get update && apt-get install -y \ bc \ gawk \ tmux \ - ffmpeg \ && rm -rf /var/lib/apt/lists/* +# Download and install the static build of ffmpeg +RUN mkdir -p /usr/local/bin/ffmpeg && \ + cd /usr/local/bin/ffmpeg && \ + wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \ + tar -xf ffmpeg-release-amd64-static.tar.xz && \ + cp -a ffmpeg-*-static/ffmpeg /usr/bin/ffmpeg && \ + cp -a ffmpeg-*-static/ffprobe /usr/bin/ffprobe && \ + rm -rf /usr/local/bin/ffmpeg + # Add Whisper repo contents ADD . /root/whisper WORKDIR /root/whisper diff --git a/README.md b/README.md index afa9175..2d86aed 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ docker run -it --runtime=habana \ --cap-add=sys_nice \ --net=host \ --ipc=host \ - -v /path/to/your/whisper:/workspace/whisper \ + -v /path/to/your/whisper:/root/whisper \ whisper_hpu:latest \ /bin/bash ``` @@ -171,7 +171,20 @@ Make sure to replace `/path/to/your/whisper` with the path to the Whisper reposi To run the `whisper` command with Intel® Gaudi® hpu, you can use the `--device hpu` option: - whisper audio.flac audio.mp3 audio.wav --model turbo --device hpu + python3 -m whisper.transcribe audio.flac audio.mp3 audio.wav --model turbo --device hpu + + +### Python usage with Intel® Gaudi® hpu + +To use Intel® Gaudi® hpu within Python, you can specify the device when loading the model: + +```python +import whisper + +model = whisper.load_model("turbo", device="hpu") +result = model.transcribe("audio.mp3") +print(result["text"]) +``` ## More examples