- Change default device to CPU in docker-compose and main.py - Set compute_type=int8 for CPU inference - Auto-detect device if env not set
36 lines
805 B
Docker
36 lines
805 B
Docker
# Use ROCm PyTorch base image with compatible PyTorch
|
|
FROM rocm/pytorch:rocm7.2.3_ubuntu22.04_py3.10_pytorch_release_2.10.0
|
|
|
|
# Set environment variables for ROCm and Python
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONPATH=/app
|
|
ENV HF_HOME=/app/.cache/huggingface
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
ffmpeg \
|
|
libsndfile1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy project files
|
|
COPY . .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --upgrade pip
|
|
RUN pip install -e .
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Set default environment variables
|
|
ENV WHISPERX_MODEL=turbo
|
|
ENV WHISPERX_DEVICE=cuda
|
|
ENV WHISPERX_COMPUTE_TYPE=float16
|
|
|
|
# Start the server
|
|
CMD ["python", "-m", "whisperx.api.serve"] |