new dockerfile for cpu only. update dockerfile from cuda 12.8 to 12.9
This commit is contained in:
parent
12973711f6
commit
26cc1072dd
4 changed files with 99 additions and 20 deletions
17
Dockerfile
17
Dockerfile
|
|
@ -1,4 +1,4 @@
|
||||||
FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04
|
FROM nvidia/cuda:12.9.1-cudnn-devel-ubuntu24.04
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
@ -9,13 +9,6 @@ ARG EXTRAS
|
||||||
ARG HF_PRECACHE_DIR
|
ARG HF_PRECACHE_DIR
|
||||||
ARG HF_TKN_FILE
|
ARG HF_TKN_FILE
|
||||||
|
|
||||||
# Install system dependencies
|
|
||||||
#RUN apt-get update && \
|
|
||||||
# apt-get install -y ffmpeg git && \
|
|
||||||
# apt-get clean && \
|
|
||||||
# rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# 2) Install system dependencies + Python + pip
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
python3 \
|
python3 \
|
||||||
|
|
@ -26,7 +19,7 @@ RUN apt-get update && \
|
||||||
python3-dev && \
|
python3-dev && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
|
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu129
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|
@ -35,10 +28,10 @@ COPY . .
|
||||||
# for more details.
|
# for more details.
|
||||||
RUN if [ -n "$EXTRAS" ]; then \
|
RUN if [ -n "$EXTRAS" ]; then \
|
||||||
echo "Installing with extras: [$EXTRAS]"; \
|
echo "Installing with extras: [$EXTRAS]"; \
|
||||||
pip install --no-cache-dir .[$EXTRAS]; \
|
pip install --no-cache-dir whisperlivekit[$EXTRAS]; \
|
||||||
else \
|
else \
|
||||||
echo "Installing base package only"; \
|
echo "Installing base package only"; \
|
||||||
pip install --no-cache-dir .; \
|
pip install --no-cache-dir whisperlivekit; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable in-container caching for Hugging Face models by:
|
# Enable in-container caching for Hugging Face models by:
|
||||||
|
|
@ -81,4 +74,4 @@ EXPOSE 8000
|
||||||
ENTRYPOINT ["whisperlivekit-server", "--host", "0.0.0.0"]
|
ENTRYPOINT ["whisperlivekit-server", "--host", "0.0.0.0"]
|
||||||
|
|
||||||
# Default args
|
# Default args
|
||||||
CMD ["--model", "base"]
|
CMD ["--model", "medium"]
|
||||||
61
Dockerfile.cpu
Normal file
61
Dockerfile.cpu
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
FROM python:3.13-slim
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ARG EXTRAS
|
||||||
|
ARG HF_PRECACHE_DIR
|
||||||
|
ARG HF_TKN_FILE
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
ffmpeg \
|
||||||
|
git \
|
||||||
|
build-essential \
|
||||||
|
python3-dev && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install CPU-only PyTorch
|
||||||
|
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Install WhisperLiveKit directly, allowing for optional dependencies
|
||||||
|
RUN if [ -n "$EXTRAS" ]; then \
|
||||||
|
echo "Installing with extras: [$EXTRAS]"; \
|
||||||
|
pip install --no-cache-dir whisperlivekit[$EXTRAS]; \
|
||||||
|
else \
|
||||||
|
echo "Installing base package only"; \
|
||||||
|
pip install --no-cache-dir whisperlivekit; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable in-container caching for Hugging Face models
|
||||||
|
VOLUME ["/root/.cache/huggingface/hub"]
|
||||||
|
|
||||||
|
# Conditionally copy a local pre-cache from the build context
|
||||||
|
RUN if [ -n "$HF_PRECACHE_DIR" ]; then \
|
||||||
|
echo "Copying Hugging Face cache from $HF_PRECACHE_DIR"; \
|
||||||
|
mkdir -p /root/.cache/huggingface/hub && \
|
||||||
|
cp -r $HF_PRECACHE_DIR/* /root/.cache/huggingface/hub; \
|
||||||
|
else \
|
||||||
|
echo "No local Hugging Face cache specified, skipping copy"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Conditionally copy a Hugging Face token if provided
|
||||||
|
RUN if [ -n "$HF_TKN_FILE" ]; then \
|
||||||
|
echo "Copying Hugging Face token from $HF_TKN_FILE"; \
|
||||||
|
mkdir -p /root/.cache/huggingface && \
|
||||||
|
cp $HF_TKN_FILE /root/.cache/huggingface/token; \
|
||||||
|
else \
|
||||||
|
echo "No Hugging Face token file specified, skipping token setup"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Expose port for the transcription server
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["whisperlivekit-server", "--host", "0.0.0.0"]
|
||||||
|
|
||||||
|
# Default args - you might want to use a smaller model for CPU
|
||||||
|
CMD ["--model", "tiny"]
|
||||||
34
README.md
34
README.md
|
|
@ -216,19 +216,39 @@ To deploy WhisperLiveKit in production:
|
||||||
|
|
||||||
4. **HTTPS Support**: For secure deployments, use "wss://" instead of "ws://" in WebSocket URL
|
4. **HTTPS Support**: For secure deployments, use "wss://" instead of "ws://" in WebSocket URL
|
||||||
|
|
||||||
### 🐋 Docker
|
## 🐋 Docker
|
||||||
|
|
||||||
A Dockerfile is provided which allows re-use of Python package installation options. Create a reusable image with only the basics and then run as a named container:
|
Deploy the application easily using Docker with GPU or CPU support.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
- Docker installed on your system
|
||||||
|
- For GPU support: NVIDIA Docker runtime installed
|
||||||
|
|
||||||
|
### Quick Start
|
||||||
|
|
||||||
|
**With GPU acceleration (recommended):**
|
||||||
```bash
|
```bash
|
||||||
docker build -t whisperlivekit-defaults .
|
docker build -t wlk .
|
||||||
docker create --gpus all --name whisperlivekit -p 8000:8000 whisperlivekit-defaults --model base
|
docker run --gpus all -p 8000:8000 --name wlk wlk
|
||||||
docker start -i whisperlivekit
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**: For **large** models, ensure that your **docker runtime** has enough **memory** available
|
**CPU only:**
|
||||||
|
```bash
|
||||||
|
docker build -f Dockerfile.cpu -t wlk .
|
||||||
|
docker run -p 8000:8000 --name wlk wlk
|
||||||
|
```
|
||||||
|
|
||||||
|
### Advanced Usage
|
||||||
|
|
||||||
|
**Custom configuration:**
|
||||||
|
```bash
|
||||||
|
# Example with custom model and language
|
||||||
|
docker run --gpus all -p 8000:8000 --name wlk wlk --model large-v3 --language fr
|
||||||
|
```
|
||||||
|
|
||||||
|
### Memory Requirements
|
||||||
|
- **Large models**: Ensure your Docker runtime has sufficient memory allocated
|
||||||
|
|
||||||
> **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.
|
|
||||||
|
|
||||||
#### Customization
|
#### Customization
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,12 @@ async function startRecording() {
|
||||||
isRecording = true;
|
isRecording = true;
|
||||||
updateUI();
|
updateUI();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
statusText.textContent = "Error accessing microphone. Please allow microphone access.";
|
if (window.location.hostname === "0.0.0.0") {
|
||||||
|
statusText.textContent =
|
||||||
|
"Error accessing microphone. Browsers may block microphone access on 0.0.0.0. Try using localhost:8000 instead.";
|
||||||
|
} else {
|
||||||
|
statusText.textContent = "Error accessing microphone. Please allow microphone access.";
|
||||||
|
}
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue