Skip to content

Commit 7df2b1d

Browse files
authored
Merge pull request #494 from classtranscribe/UpdateForWhisper
Update for whisper
2 parents f5627d7 + 2fe4720 commit 7df2b1d

File tree

3 files changed

+91
-45
lines changed

3 files changed

+91
-45
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
**/secrets.dev.yaml
1919
**/values.dev.yaml
2020
**/.toolstarget
21-
**/node_modules
21+
**/node_modules
22+
whisper.cpp

pythonrpcserver.Dockerfile

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,45 @@
1-
# # ------------------------------
2-
# # Stage 1: Build Whisper.cpp
3-
# # ------------------------------
4-
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
5-
RUN apt-get update && \
6-
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg git
7-
8-
WORKDIR /whisper.cpp
9-
# RUN git clone https://github.com/ggerganov/whisper.cpp . && make
10-
RUN git clone https://github.com/ggerganov/whisper.cpp . && \
11-
git checkout 021eef1 && \
12-
make
13-
RUN bash ./models/download-ggml-model.sh base.en
14-
RUN bash ./models/download-ggml-model.sh tiny.en
15-
RUN bash ./models/download-ggml-model.sh large-v3
16-
1+
# ------------------------------
2+
# Stage 1: Build Whisper.cpp
3+
# ------------------------------
4+
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
5+
RUN apt-get update && \
6+
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg git && \
7+
apt-get install -y wget && \
8+
wget https://github.com/Kitware/CMake/releases/download/v3.27.7/cmake-3.27.7-linux-x86_64.sh -O /tmp/cmake-install.sh && \
9+
chmod +x /tmp/cmake-install.sh && \
10+
/tmp/cmake-install.sh --skip-license --prefix=/usr/local && \
11+
rm /tmp/cmake-install.sh
12+
13+
WORKDIR /whisper.cpp
14+
RUN git clone https://github.com/ggml-org/whisper.cpp . && \
15+
cmake -B build -DWHISPER_BUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=OFF && \
16+
cmake --build build --parallel $(nproc)
17+
RUN bash ./models/download-ggml-model.sh base.en
18+
RUN bash ./models/download-ggml-model.sh tiny.en
19+
RUN bash ./models/download-ggml-model.sh large-v3
20+
1721
# ------------------------------
1822
# Stage 2: Setup Python RPC Server
1923
# ------------------------------
20-
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS rpcserver
21-
RUN apt-get update && \
22-
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg
23-
24-
ENV OMP_THREAD_LIMIT=1
25-
COPY --from=whisperbuild /whisper.cpp/main /usr/local/bin/whisper
26-
COPY --from=whisperbuild /whisper.cpp/models /PythonRpcServer/models
27-
WORKDIR /PythonRpcServer
28-
29-
# Don't copy any py files here, so that we don't need to re-run whisper
30-
COPY ./PythonRpcServer/transcribe_hellohellohello.wav .
31-
# The output of tis whisper run is used when we set MOCK_RECOGNITION=MOCK for quick testing
32-
RUN whisper -ojf -f transcribe_hellohellohello.wav
33-
34-
COPY ./PythonRpcServer/requirements.txt requirements.txt
35-
RUN pip install --no-cache-dir --upgrade pip && \
36-
pip install --no-cache-dir -r requirements.txt
37-
38-
COPY ct.proto ct.proto
39-
RUN python -m grpc_tools.protoc -I . --python_out=./ --grpc_python_out=./ ct.proto
40-
41-
COPY ./PythonRpcServer .
42-
43-
44-
CMD [ "nice", "-n", "18", "ionice", "-c", "2", "-n", "6", "python3", "-u", "/PythonRpcServer/server.py" ]
45-
46-
47-
24+
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS rpcserver
25+
RUN apt-get update && \
26+
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg
27+
28+
ENV OMP_THREAD_LIMIT=1
29+
COPY --from=whisperbuild /whisper.cpp/build/bin/whisper-cli /usr/local/bin/whisper
30+
COPY --from=whisperbuild /whisper.cpp/models /PythonRpcServer/models
31+
WORKDIR /PythonRpcServer
32+
33+
COPY ./PythonRpcServer/transcribe_hellohellohello.wav .
34+
RUN whisper -ojf -f transcribe_hellohellohello.wav
35+
36+
COPY ./PythonRpcServer/requirements.txt requirements.txt
37+
RUN pip install --no-cache-dir --upgrade pip && \
38+
pip install --no-cache-dir -r requirements.txt
39+
40+
COPY ct.proto ct.proto
41+
RUN python -m grpc_tools.protoc -I . --python_out=./ --grpc_python_out=./ ct.proto
42+
43+
COPY ./PythonRpcServer .
44+
45+
CMD [ "nice", "-n", "18", "ionice", "-c", "2", "-n", "6", "python3", "-u", "/PythonRpcServer/server.py" ]

pythonrpcserver_legacy.Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# # ------------------------------
2+
# # Stage 1: Build Whisper.cpp
3+
# # ------------------------------
4+
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS whisperbuild
5+
RUN apt-get update && \
6+
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg git
7+
8+
WORKDIR /whisper.cpp
9+
# RUN git clone https://github.com/ggerganov/whisper.cpp . && make
10+
RUN git clone https://github.com/ggerganov/whisper.cpp . && \
11+
git checkout 021eef1 && \
12+
make
13+
RUN bash ./models/download-ggml-model.sh base.en
14+
RUN bash ./models/download-ggml-model.sh tiny.en
15+
RUN bash ./models/download-ggml-model.sh large-v3
16+
17+
# ------------------------------
18+
# Stage 2: Setup Python RPC Server
19+
# ------------------------------
20+
FROM --platform=linux/amd64 python:3.8.15-slim-buster AS rpcserver
21+
RUN apt-get update && \
22+
apt-get install -y curl gcc g++ make libglib2.0-0 libsm6 libxext6 libxrender-dev ffmpeg
23+
24+
ENV OMP_THREAD_LIMIT=1
25+
COPY --from=whisperbuild /whisper.cpp/main /usr/local/bin/whisper
26+
COPY --from=whisperbuild /whisper.cpp/models /PythonRpcServer/models
27+
WORKDIR /PythonRpcServer
28+
29+
# Don't copy any py files here, so that we don't need to re-run whisper
30+
COPY ./PythonRpcServer/transcribe_hellohellohello.wav .
31+
# The output of tis whisper run is used when we set MOCK_RECOGNITION=MOCK for quick testing
32+
RUN whisper -ojf -f transcribe_hellohellohello.wav
33+
34+
COPY ./PythonRpcServer/requirements.txt requirements.txt
35+
RUN pip install --no-cache-dir --upgrade pip && \
36+
pip install --no-cache-dir -r requirements.txt
37+
38+
COPY ct.proto ct.proto
39+
RUN python -m grpc_tools.protoc -I . --python_out=./ --grpc_python_out=./ ct.proto
40+
41+
COPY ./PythonRpcServer .
42+
43+
44+
CMD [ "nice", "-n", "18", "ionice", "-c", "2", "-n", "6", "python3", "-u", "/PythonRpcServer/server.py" ]
45+
46+
47+

0 commit comments

Comments
 (0)