Kokoro-FastAPI/MigrationWorkingNotes.md
bgs4free b064066b9e Add experimental rocm support
Tested with rocm 6.3.1.

Known issues with this commit:
 * The generated docker image becomes quite big
 * Suppressed MIOPEN warnings, which might not be a good idea
 * No windows support, at least not tested
 * Incomplete documentation
 * Not thoroughly tested
2025-01-19 16:49:28 +01:00

1.8 KiB

UV Setup

Deprecated notes for myself

Structure

docker/
  ├── cpu/
  │   ├── pyproject.toml     # CPU deps (torch CPU)
  │   └── requirements.lock  # CPU lockfile
  ├── gpu/
  │   ├── pyproject.toml     # GPU deps (torch CUDA)
  │   └── requirements.lock  # GPU lockfile
  ├── rocm/
  │   ├── pyproject.toml     # ROCM deps (torch ROCM)
  │   └── requirements.lock  # ROCM lockfile
  └── shared/
      └── pyproject.toml     # Common deps

Regenerate Lock Files

CPU

cd docker/cpu
uv pip compile pyproject.toml ../shared/pyproject.toml --output-file requirements.lock

GPU

cd docker/gpu
uv pip compile pyproject.toml ../shared/pyproject.toml --output-file requirements.lock

ROCM

cd docker/rocm
uv pip compile pyproject.toml ../shared/pyproject.toml --output-file requirements.lock

Local Dev Setup

CPU

cd docker/cpu
uv venv
.venv\Scripts\activate  # Windows
uv pip sync requirements.lock

GPU

cd docker/gpu
uv venv
.venv\Scripts\activate  # Windows
uv pip sync requirements.lock --extra-index-url https://download.pytorch.org/whl/cu121 --index-strategy unsafe-best-match

ROCM

cd docker/rocm
uv venv
source .venv/bin/activate
# not tested on Windows
#.venv\Scripts\activate  # Windows
uv pip sync requirements.lock --extra-index-url https://download.pytorch.org/whl/rocm6.2

Run Server

# From project root with venv active:
uvicorn api.src.main:app --reload

Docker

CPU

cd docker/cpu
docker compose up

GPU

cd docker/gpu
docker compose up

ROCM

cd docker/rocm
docker compose up

Known Issues

  • Module imports: Run server from project root
  • PyTorch CUDA: Always use --extra-index-url and --index-strategy for GPU env