diff --git a/Dockerfile_hpu b/Dockerfile_hpu new file mode 100644 index 0000000..5c2bd48 --- /dev/null +++ b/Dockerfile_hpu @@ -0,0 +1,35 @@ +# Use the official Gaudi Docker image with PyTorch +FROM vault.habana.ai/gaudi-docker/1.17.0/ubuntu22.04/habanalabs/pytorch-installer-2.3.1:latest + +# Set environment variables for Habana +ENV HABANA_VISIBLE_DEVICES=all +ENV OMPI_MCA_btl_vader_single_copy_mechanism=none +ENV PT_HPU_LAZY_ACC_PAR_MODE=0 +ENV PT_HPU_ENABLE_LAZY_COLLECTIVES=1 + +# Install essential Linux packages and ffmpeg +ENV DEBIAN_FRONTEND="noninteractive" TZ=Etc/UTC +RUN apt-get update && apt-get install -y \ + tzdata \ + bash-completion \ + python3-pip \ + openssh-server \ + vim \ + git \ + iputils-ping \ + net-tools \ + protobuf-compiler \ + curl \ + bc \ + gawk \ + tmux \ + ffmpeg \ + && rm -rf /var/lib/apt/lists/* + +# Copy the Whisper repo contents +ADD whisper /root/whisper +WORKDIR /root/whisper + +# Install Python packages from Whisper requirements +RUN pip install --upgrade pip \ + && pip install -r requirements.txt \ diff --git a/README.md b/README.md index 910b7db..ddbdd2d 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,36 @@ result = whisper.decode(model, mel, options) print(result.text) ``` +## Intel® Gaudi® hpu usage + +### Build the Docker Image + +```bash +docker build -t whisper_hpu:latest -f Dockerfile_hpu . +``` + +### Run the Container + +```bash +docker run -it --runtime=habana \ + -e HABANA_VISIBLE_DEVICES=all \ + -e OMPI_MCA_btl_vader_single_copy_mechanism=none \ + --cap-add=sys_nice \ + --net=host \ + --ipc=host \ + -v /path/to/your/whisper:/workspace/whisper \ + whisper_hpu:latest \ + /bin/bash +``` + +Make sure to replace `/path/to/your/whisper` with the path to the Whisper repository on your local machine. + +### Command-line usage with Intel® Gaudi® hpu + +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 + ## More examples Please use the [🙌 Show and tell](https://github.com/openai/whisper/discussions/categories/show-and-tell) category in Discussions for sharing more example usages of Whisper and third-party extensions such as web demos, integrations with other tools, ports for different platforms, etc.