Fix Dockerfile.hpu ffmpeg package install, update README.md whisper container usage

This commit is contained in:
PiotrBLL 2024-11-08 18:17:37 +01:00
parent 9e3936581a
commit 82a5380ad7
2 changed files with 24 additions and 3 deletions

View File

@ -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

View File

@ -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