mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-05 16:48:53 +00:00
Update to ROCm 6.4 and use uv to install dependencies
This commit is contained in:
parent
b19fd1d179
commit
105b96e575
3 changed files with 39 additions and 23 deletions
|
@ -23,15 +23,30 @@ RUN apt-get update && apt upgrade -y && apt-get install -y --no-install-recommen
|
||||||
RUN mkdir -p /app/api/src/models/v1_0
|
RUN mkdir -p /app/api/src/models/v1_0
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install UV using the installer script
|
||||||
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
|
||||||
|
mv /root/.local/bin/uv /usr/local/bin/ && \
|
||||||
|
mv /root/.local/bin/uvx /usr/local/bin/
|
||||||
|
|
||||||
|
# Create non-root user and set up directories and permissions
|
||||||
|
RUN useradd -m -u 1001 appuser && \
|
||||||
|
mkdir -p /app/api/src/models/v1_0 && \
|
||||||
|
chown -R appuser:appuser /app
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy dependency files
|
# Copy dependency files
|
||||||
COPY pyproject.toml ./pyproject.toml
|
COPY --chown=appuser:appuser pyproject.toml ./pyproject.toml
|
||||||
|
|
||||||
# Install dependencies
|
ENV PHONEMIZER_ESPEAK_PATH=/usr/bin \
|
||||||
ENV CAUSAL_CONV1D_FORCE_BUILD=TRUE \
|
PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data \
|
||||||
HIP_ARCHITECTURES=gfx1100
|
ESPEAK_DATA_PATH=/usr/share/espeak-ng-data
|
||||||
|
|
||||||
RUN pip3 install --upgrade pip && \
|
# Install dependencies with GPU extras (using cache mounts)
|
||||||
pip3 install -e .
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
uv venv --python 3.10 && \
|
||||||
|
uv sync --extra rocm
|
||||||
|
|
||||||
# Copy project files including models
|
# Copy project files including models
|
||||||
COPY --chown=appuser:appuser api ./api
|
COPY --chown=appuser:appuser api ./api
|
||||||
|
@ -39,16 +54,19 @@ COPY --chown=appuser:appuser web ./web
|
||||||
COPY --chown=appuser:appuser docker/scripts/ ./
|
COPY --chown=appuser:appuser docker/scripts/ ./
|
||||||
RUN chmod +x ./entrypoint.sh
|
RUN chmod +x ./entrypoint.sh
|
||||||
|
|
||||||
# Set environment variables
|
# Set all environment variables in one go
|
||||||
ENV PYTHONUNBUFFERED=1 \
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
PYTHONPATH=/app:/app/api \
|
PYTHONPATH=/app:/app/api \
|
||||||
USE_GPU=true \
|
PATH="/app/.venv/bin:$PATH" \
|
||||||
DOWNLOAD_MODEL=true
|
UV_LINK_MODE=copy \
|
||||||
|
USE_GPU=true
|
||||||
|
|
||||||
|
ENV DOWNLOAD_MODEL=true
|
||||||
# Download model if enabled
|
# Download model if enabled
|
||||||
RUN if [ "$DOWNLOAD_MODEL" = "true" ]; then \
|
RUN if [ "$DOWNLOAD_MODEL" = "true" ]; then \
|
||||||
python download_model.py --output api/src/models/v1_0; \
|
python download_model.py --output api/src/models/v1_0; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ENV DEVICE="gpu"
|
||||||
# Run FastAPI server through entrypoint.sh
|
# Run FastAPI server through entrypoint.sh
|
||||||
CMD ["python3", "-m", "uvicorn", "api.src.main:app", "--host", "0.0.0.0", "--port", "8880", "--log-level", "debug"]
|
CMD ["./entrypoint.sh"]
|
||||||
|
|
|
@ -8,6 +8,12 @@ services:
|
||||||
- seccomp:unconfined
|
- seccomp:unconfined
|
||||||
cap_add:
|
cap_add:
|
||||||
- SYS_PTRACE
|
- SYS_PTRACE
|
||||||
|
group_add:
|
||||||
|
# NOTE: These groups are the group ids for: video, input, and render
|
||||||
|
# Numbers can be found via running: getent group $GROUP_NAME | cut -d: -f3
|
||||||
|
- 44
|
||||||
|
- 993
|
||||||
|
- 996
|
||||||
restart: 'always'
|
restart: 'always'
|
||||||
volumes:
|
volumes:
|
||||||
- ./kokoro-tts/config:/root/.config/miopen
|
- ./kokoro-tts/config:/root/.config/miopen
|
||||||
|
|
|
@ -14,7 +14,7 @@ dependencies = [
|
||||||
"python-dotenv==1.0.1",
|
"python-dotenv==1.0.1",
|
||||||
"sqlalchemy==2.0.27",
|
"sqlalchemy==2.0.27",
|
||||||
# ML/DL Base
|
# ML/DL Base
|
||||||
"numpy>=1.26.0",
|
"numpy==1.26.4",
|
||||||
"scipy==1.14.1",
|
"scipy==1.14.1",
|
||||||
# Audio processing
|
# Audio processing
|
||||||
"soundfile==0.13.0",
|
"soundfile==0.13.0",
|
||||||
|
@ -47,8 +47,10 @@ gpu = [
|
||||||
"torch==2.6.0+cu124",
|
"torch==2.6.0+cu124",
|
||||||
]
|
]
|
||||||
rocm = [
|
rocm = [
|
||||||
"torch==2.5.1+rocm6.2",
|
"torch @ https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/torch-2.6.0%2Brocm6.4.0.git2fb0ac2b-cp310-cp310-linux_x86_64.whl",
|
||||||
"pytorch-triton-rocm==3.1.0",
|
"pytorch-triton-rocm @ https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/pytorch_triton_rocm-3.2.0%2Brocm6.4.0.git6da9e660-cp310-cp310-linux_x86_64.whl",
|
||||||
|
"torchvision @ https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/torchvision-0.21.0%2Brocm6.4.0.git4040d51f-cp310-cp310-linux_x86_64.whl",
|
||||||
|
"torchaudio @ https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/torchaudio-2.6.0%2Brocm6.4.0.gitd8831425-cp310-cp310-linux_x86_64.whl",
|
||||||
]
|
]
|
||||||
cpu = [
|
cpu = [
|
||||||
"torch==2.6.0",
|
"torch==2.6.0",
|
||||||
|
@ -75,11 +77,6 @@ conflicts = [
|
||||||
torch = [
|
torch = [
|
||||||
{ index = "pytorch-cpu", extra = "cpu" },
|
{ index = "pytorch-cpu", extra = "cpu" },
|
||||||
{ index = "pytorch-cuda", extra = "gpu" },
|
{ index = "pytorch-cuda", extra = "gpu" },
|
||||||
{ index = "pytorch-rocm", extra = "rocm" },
|
|
||||||
]
|
|
||||||
# uv would not install torch for rocm6.2 without this explicit transient dependency
|
|
||||||
pytorch-triton-rocm = [
|
|
||||||
{ index = "pytorch-rocm", extra = "rocm" },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[tool.uv.index]]
|
[[tool.uv.index]]
|
||||||
|
@ -92,11 +89,6 @@ name = "pytorch-cuda"
|
||||||
url = "https://download.pytorch.org/whl/cu124"
|
url = "https://download.pytorch.org/whl/cu124"
|
||||||
explicit = true
|
explicit = true
|
||||||
|
|
||||||
[[tool.uv.index]]
|
|
||||||
name = "pytorch-rocm"
|
|
||||||
url = "https://download.pytorch.org/whl/rocm6.2"
|
|
||||||
explicit = true
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools>=61.0"]
|
requires = ["setuptools>=61.0"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
Loading…
Add table
Reference in a new issue