From 9f381cd299a8d575d9c4bac46886be098d570507 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Mon, 7 Aug 2023 23:11:49 +0800 Subject: [PATCH 1/3] remove Dockerfile --- Dockerfile | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8805246..0000000 --- a/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 - -ARG DEBIAN_FRONTEND=noninteractive - -# Remove any third-party apt sources to avoid issues with expiring keys. -RUN rm -f /etc/apt/sources.list.d/*.list - -# Install some basic utilities. -RUN apt-get update && apt-get install -y \ - curl \ - ca-certificates \ - sudo \ - git \ - bzip2 \ - libx11-6 \ - && rm -rf /var/lib/apt/lists/* - -RUN apt update - -# install python -RUN apt install software-properties-common -y && \ - add-apt-repository ppa:deadsnakes/ppa && \ - apt update - -RUN apt install python3-dev -y && \ - apt install python-is-python3 - - -# install pip -RUN apt install python3-pip -y - -# Create a working directory. -RUN mkdir /app -WORKDIR /app - -COPY setup.sh /app -COPY requirements/ /app - -RUN bash setup.sh -RUN pip install -r server.txt - -RUN pip install whisper-live - -COPY run_server.py /app -CMD ["python", "run_server.py"] From e602ba1282c95a560b551bbdfea8eaae193b1843 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Mon, 7 Aug 2023 23:12:53 +0800 Subject: [PATCH 2/3] add cpu&gpu specifice Dockerfiles --- docker/Dockerfile.cpu | 45 ++++++++++++++++++++++++++++++++++++++++ docker/Dockerfile.gpu | 47 ++++++++++++++++++++++++++++++++++++++++++ whisper_live/server.py | 5 +++-- 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 docker/Dockerfile.cpu create mode 100644 docker/Dockerfile.gpu diff --git a/docker/Dockerfile.cpu b/docker/Dockerfile.cpu new file mode 100644 index 0000000..d495f6f --- /dev/null +++ b/docker/Dockerfile.cpu @@ -0,0 +1,45 @@ +FROM ubuntu:focal + +ARG DEBIAN_FRONTEND=noninteractive + +# Remove any third-party apt sources to avoid issues with expiring keys. +RUN rm -f /etc/apt/sources.list.d/*.list + +# Install some basic utilities. +RUN apt-get update && apt-get install -y \ + curl \ + ca-certificates \ + sudo \ + git \ + bzip2 \ + libx11-6 \ + && rm -rf /var/lib/apt/lists/* + +RUN apt update + +# install python +RUN apt install software-properties-common -y && \ + add-apt-repository ppa:deadsnakes/ppa && \ + apt update + +RUN apt install python3-dev -y && \ + apt install python-is-python3 + + +# install pip +RUN apt install python3-pip -y + +# Create a working directory. +RUN mkdir /app +WORKDIR /app + +COPY setup.sh /app +COPY requirements/ /app + +RUN bash setup.sh +RUN pip install -r server.txt + +COPY whisper_live /app/whisper_live + +COPY run_server.py /app +CMD ["python", "run_server.py"] diff --git a/docker/Dockerfile.gpu b/docker/Dockerfile.gpu new file mode 100644 index 0000000..cccd17a --- /dev/null +++ b/docker/Dockerfile.gpu @@ -0,0 +1,47 @@ +FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 + +ARG DEBIAN_FRONTEND=noninteractive + +# Remove any third-party apt sources to avoid issues with expiring keys. +RUN rm -f /etc/apt/sources.list.d/*.list + +# Install some basic utilities. +RUN apt-get update && apt-get install -y \ + curl \ + ca-certificates \ + sudo \ + git \ + bzip2 \ + libx11-6 \ + && rm -rf /var/lib/apt/lists/* + +RUN apt update + +# install python +RUN apt install software-properties-common -y && \ + add-apt-repository ppa:deadsnakes/ppa && \ + apt update + +RUN apt install python3-dev -y && \ + apt install python-is-python3 + + +# install pip +RUN apt install python3-pip -y + +# Create a working directory. +RUN mkdir /app +WORKDIR /app + +COPY setup.sh /app +COPY requirements/ /app + +RUN apt update --fix-missing +RUN bash setup.sh +RUN pip install -r server.txt + +COPY whisper_live /app/whisper_live + +COPY run_server.py /app + +CMD ["python", "run_server.py"] diff --git a/whisper_live/server.py b/whisper_live/server.py index f368bd2..cb2d51c 100644 --- a/whisper_live/server.py +++ b/whisper_live/server.py @@ -79,10 +79,11 @@ class ServeClient: self.frames = b"" self.language = language if multilingual else "en" self.task = task + device = "cuda" if torch.cuda.is_available() else "cpu" self.transcriber = WhisperModel( "small" if multilingual else "small.en", - device=device if device else "cuda", - compute_type="float16", + device=device, + compute_type="int8" if device=="cpu" else "float16", local_files_only=False, ) From 6927a44b5be41cdfb2e8e5aa2e1c0bfff591869b Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Mon, 7 Aug 2023 23:14:03 +0800 Subject: [PATCH 3/3] bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index de5f007..64b99fb 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text() # This call to setup() does all the work setup(name="whisper-live", - version="0.0.4", + version="0.0.5", description="A nearly-live implementation of OpenAI's Whisper.", long_description=README, long_description_content_type="text/markdown",