diff --git a/Dockerfile b/Dockerfile index f42a679..a81a308 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM nvidia/cuda:12.1.0-base-ubuntu22.04 ARG KOKORO_REPO +ARG KOKORO_COMMIT # Install base system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -13,14 +14,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Install heavy Python dependencies first (better layer caching) RUN pip3 install --no-cache-dir \ - phonemizer \ - torch \ - transformers \ - scipy \ - munch + phonemizer==3.3.0 \ + torch==2.5.1 \ + transformers==4.47.1 \ + scipy==1.14.1 \ + numpy==2.2.1 \ + munch==4.0.0 # Install API dependencies -RUN pip3 install --no-cache-dir fastapi uvicorn pydantic-settings +RUN pip3 install --no-cache-dir \ + fastapi==0.115.6 \ + uvicorn==0.34.0 \ + pydantic==2.10.4 \ + pydantic-settings==2.7.0 \ + python-dotenv==1.0.1 # Set working directory WORKDIR /app @@ -32,8 +39,9 @@ RUN apt-get update && apt-get install -y git-lfs \ && rm -rf /var/lib/apt/lists/* \ && git lfs install -# Clone Kokoro repo -RUN git clone ${KOKORO_REPO} . +# Clone Kokoro repo at specific commit +RUN git clone ${KOKORO_REPO} . && \ + git checkout ${KOKORO_COMMIT} # -------------------------------------- # Create output directory diff --git a/README.md b/README.md index 263c091..fe4ce35 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ # Kokoro TTS API [![Model Commit](https://img.shields.io/badge/model--commit-a67f113-blue)](https://huggingface.co/hexgrad/Kokoro-82M/tree/a67f11354c3e38c58c3327498bc4bd1e57e71c50) -FastAPI wrapper for [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) text-to-speech model with voice cloning capabilities. +FastAPI wrapper for [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) text-to-speech model. Dockerized with NVIDIA GPU support, simple queue handling via sqllite, and automatic chunking/stitching on lengthy input/outputs diff --git a/docker-compose.yml b/docker-compose.yml index 61988d0..1f7c264 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: context: . args: - KOKORO_REPO=https://huggingface.co/hexgrad/Kokoro-82M + - KOKORO_COMMIT=a67f11354c3e38c58c3327498bc4bd1e57e71c50 volumes: - ./api:/app/api ports: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..57f3b49 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,20 @@ +# Core dependencies +fastapi==0.115.6 +uvicorn==0.34.0 +pydantic==2.10.4 +python-dotenv==1.0.1 + +# ML/DL +torch==2.5.1 +transformers==4.47.1 +numpy==2.2.1 +scipy==1.14.1 + +# Text processing +phonemizer==3.3.0 +regex==2024.11.6 + +# Utilities +tqdm==4.67.1 +requests==2.32.3 +munch==4.0.0