diff --git a/ai/Dockerfile b/ai/Dockerfile index 201f9de..8291da3 100644 --- a/ai/Dockerfile +++ b/ai/Dockerfile @@ -16,7 +16,8 @@ RUN apt-get update && \ texlive-latex-base texlive-latex-extra texlive-fonts-recommended texlive-xetex texlive-science \ qemu-user-static binfmt-support qemu-user-binfmt \ emacs-nox \ - libportaudio2 && \ + libportaudio2 \ + hipcc espeak-ng && \ rm -rf /var/lib/apt/lists/* # Création de l'utilisateur 'hermes' directement avec les bons accès @@ -30,6 +31,75 @@ WORKDIR /opt/hermes # On donne la propriété du dossier de travail à l'utilisateur hermes RUN chown hermes:hermes /opt/hermes +# ---------- Coqui TTS venv (Python 3.11 + PyTorch ROCm) ---------- +# Install Python 3.11 via uv for Coqui compatibility +RUN uv python install 3.11 + +# Create the coqui venv and install PyTorch ROCm + TTS +RUN uv venv --python 3.11 /opt/coqui-tts +RUN uv pip install --python /opt/coqui-tts/bin/python3 --no-cache-dir \ + torch==2.3.1+rocm5.7 \ + torchaudio==2.3.1+rocm5.7 \ + --index-url https://download.pytorch.org/whl/rocm5.7 +RUN uv pip install --python /opt/coqui-tts/bin/python3 --no-cache-dir TTS setuptools + +# Fix executable stack on bundled torch AMD libraries (required for ROCm) +RUN /opt/coqui-tts/bin/python3 -c " +import struct, os, glob +torch_lib = '/opt/coqui-tts/lib/python3.11/site-packages/torch/lib' +for so in glob.glob(os.path.join(torch_lib, '*.so*')): + try: + with open(so, 'r+b') as f: + if f.read(4) != b'\x7fELF': continue + f.seek(0) + h = f.read(64) + e_phoff = struct.unpack_from('