Quentin Fuxa commited on
Commit
4ab518f
·
2 Parent(s): 8288540 68fb041

Merge pull request #114 from needabetterusername/implement-69-clean

Browse files
Files changed (2) hide show
  1. Dockerfile +82 -0
  2. README.md +29 -0
Dockerfile ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV PYTHONUNBUFFERED=1
5
+
6
+ WORKDIR /app
7
+
8
+ ARG EXTRAS
9
+ ARG HF_PRECACHE_DIR
10
+ ARG HF_TKN_FILE
11
+
12
+ # Install system dependencies
13
+ #RUN apt-get update && \
14
+ # apt-get install -y ffmpeg git && \
15
+ # apt-get clean && \
16
+ # rm -rf /var/lib/apt/lists/*
17
+
18
+ # 2) Install system dependencies + Python + pip
19
+ RUN apt-get update && \
20
+ apt-get install -y --no-install-recommends \
21
+ python3 \
22
+ python3-pip \
23
+ ffmpeg \
24
+ git && \
25
+ rm -rf /var/lib/apt/lists/*
26
+
27
+ RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
28
+
29
+ COPY . .
30
+
31
+ # Install WhisperLiveKit directly, allowing for optional dependencies
32
+ # Note: For gates modedls, need to add your HF toke. See README.md
33
+ # for more details.
34
+ RUN if [ -n "$EXTRAS" ]; then \
35
+ echo "Installing with extras: [$EXTRAS]"; \
36
+ pip install --no-cache-dir .[$EXTRAS]; \
37
+ else \
38
+ echo "Installing base package only"; \
39
+ pip install --no-cache-dir .; \
40
+ fi
41
+
42
+ # Enable in-container caching for Hugging Face models by:
43
+ # Note: If running multiple containers, better to map a shared
44
+ # bucket.
45
+ #
46
+ # A) Make the cache directory persistent via an anonymous volume.
47
+ # Note: This only persists for a single, named container. This is
48
+ # only for convenience at de/test stage.
49
+ # For prod, it is better to use a named volume via host mount/k8s.
50
+ VOLUME ["/root/.cache/huggingface/hub"]
51
+
52
+ # or
53
+ # B) Conditionally copy a local pre-cache from the build context to the
54
+ # container's cache via the HF_PRECACHE_DIR build-arg.
55
+ # WARNING: This will copy ALL files in the pre-cache location.
56
+
57
+ # Conditionally copy a cache directory if provided
58
+ RUN if [ -n "$HF_PRECACHE_DIR" ]; then \
59
+ echo "Copying Hugging Face cache from $HF_PRECACHE_DIR"; \
60
+ mkdir -p /root/.cache/huggingface/hub && \
61
+ cp -r $HF_PRECACHE_DIR/* /root/.cache/huggingface/hub; \
62
+ else \
63
+ echo "No local Hugging Face cache specified, skipping copy"; \
64
+ fi
65
+
66
+ # Conditionally copy a Hugging Face token if provided
67
+
68
+ RUN if [ -n "$HF_TKN_FILE" ]; then \
69
+ echo "Copying Hugging Face token from $HF_TKN_FILE"; \
70
+ mkdir -p /root/.cache/huggingface && \
71
+ cp $HF_TKN_FILE /root/.cache/huggingface/token; \
72
+ else \
73
+ echo "No Hugging Face token file specified, skipping token setup"; \
74
+ fi
75
+
76
+ # Expose port for the transcription server
77
+ EXPOSE 8000
78
+
79
+ ENTRYPOINT ["whisperlivekit-server", "--host", "0.0.0.0"]
80
+
81
+ # Default args
82
+ CMD ["--model", "tiny.en"]
README.md CHANGED
@@ -250,6 +250,35 @@ To deploy WhisperLiveKit in production:
250
 
251
  4. **HTTPS Support**: For secure deployments, use "wss://" instead of "ws://" in WebSocket URL
252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  ## 🔮 Use Cases
254
 
255
  - **Meeting Transcription**: Capture discussions in real-time
 
250
 
251
  4. **HTTPS Support**: For secure deployments, use "wss://" instead of "ws://" in WebSocket URL
252
 
253
+ ### 🐋 Docker
254
+
255
+ A basic Dockerfile is provided which allows re-use of python package installation options. See below useage examples:
256
+
257
+ ***NOTE:** For **larger** models, ensure that your **docker runtime** has enough **memory** available.*
258
+
259
+ #### All defaults
260
+ - Create a reuseable image with only the basics and then run as a named container.
261
+ ```bash
262
+ docker build -t whisperlivekit-defaults .
263
+ docker create --gpus all --name whisperlivekit -p 8000:8000 whisperlivekit-defaults
264
+ docker start -i whisperlivekit
265
+ ```
266
+
267
+ > **Note**: If you're running on a system without NVIDIA GPU support (such as Mac with Apple Silicon or any system without CUDA capabilities), you need to **remove the `--gpus all` flag** from the `docker create` command. Without GPU acceleration, transcription will use CPU only, which may be significantly slower. Consider using small models for better performance on CPU-only systems.
268
+
269
+ #### Customization
270
+ - Customise the container options.
271
+ ```bash
272
+ docker build -t whisperlivekit-defaults .
273
+ docker create --gpus all --name whisperlivekit-base -p 8000:8000 whisperlivekit-defaults --model base
274
+ docker start -i whisperlivekit-base
275
+ ```
276
+
277
+ - `--build-arg` Options
278
+ - `EXTRAS="whisper-timestamped"` - Add extras to the image's installation (no spaces). Remember to set necessary container options!
279
+ - `HF_PRECACHE_DIR=./.cache/` - Pre-load a model cache for faster first-time start
280
+ - `HF_TOKEN=./token` - Add your Hugging Face Hub access token to download gated models
281
+
282
  ## 🔮 Use Cases
283
 
284
  - **Meeting Transcription**: Capture discussions in real-time