xtts-castellano / Dockerfile_train
sob111's picture
Rename Dockerfile to Dockerfile_train
3259878 verified
FROM python:3.10
# Definir HOME y rutas de caché para Hugging Face
WORKDIR /home/user/app
ENV HOME="/tmp"
ENV HF_HOME="/tmp/.cache/huggingface"
ENV OMP_NUM_THREADS=1
# Configuración de Git vía variables de entorno (sin .gitconfig)
ENV GIT_AUTHOR_NAME="sob111"
ENV GIT_AUTHOR_EMAIL="[email protected]"
ENV GIT_COMMITTER_NAME="sob111"
ENV GIT_COMMITTER_EMAIL="[email protected]"
# Instalar dependencias del sistema y herramientas para el modo desarrollador
RUN apt-get update && apt-get install -y \
git wget ffmpeg libsndfile1 unzip build-essential \
bash curl wget procps \
&& rm -rf /var/lib/apt/lists/*
# Instalar dependencias Python
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Instalar Coqui TTS en editable mode desde v0.22.0
RUN git clone --branch v0.22.0 https://github.com/coqui-ai/TTS.git /home/user/TTS \
&& cd /home/user/TTS \
&& git submodule update --init --recursive \
&& pip install --no-cache-dir -e .
# 🔧 Crear sitecustomize que simula numba (shim) y parchea librosa
RUN cat > /usr/local/lib/python3.10/site-packages/sitecustomize.py <<'PY'
import sys
import types
import os
# Asegurar cache de numba
NUMBA_CACHE = "/tmp/numba_cache"
try:
os.makedirs(NUMBA_CACHE, exist_ok=True)
os.chmod(NUMBA_CACHE, 0o777)
except Exception:
pass
# Crear un shim de numba si no existe
if "numba" not in sys.modules:
shim = types.ModuleType("numba")
shim.__file__ = "<numba_shim>"
def _identity_decorator(*d_args, **d_kwargs):
def _decorator(func):
return func
if len(d_args) == 1 and callable(d_args[0]):
return d_args[0]
return _decorator
shim.jit = _identity_decorator
shim.njit = _identity_decorator
shim.vectorize = _identity_decorator
shim.guvectorize = _identity_decorator
shim.generated_jit = _identity_decorator
shim.stencil = _identity_decorator
np_module = types.SimpleNamespace()
ufunc = types.SimpleNamespace()
decorators = types.SimpleNamespace()
decorators.vectorize = _identity_decorator
decorators.guvectorize = _identity_decorator
decorators.wrap = _identity_decorator
ufunc.decorators = decorators
np_module.ufunc = ufunc
shim.np = np_module
shim.config = types.SimpleNamespace()
shim.core = types.SimpleNamespace()
shim.core.decorators = types.SimpleNamespace()
shim.core.decorators.jit = _identity_decorator
sys.modules["numba"] = shim
sys.modules["numba.np"] = types.SimpleNamespace(ufunc=types.SimpleNamespace(decorators=decorators))
sys.modules["numba.np.ufunc"] = types.SimpleNamespace(decorators=decorators)
sys.modules["numba.np.ufunc.decorators"] = decorators
# Parche opcional librosa.magphase
try:
import librosa
try:
from librosa.core import spectrum
librosa.magphase = getattr(spectrum, "magphase", None)
except Exception:
pass
except Exception:
pass
PY
# Crear directorio de salida para checkpoints
RUN mkdir -p /tmp/output_model
# Copiar el proyecto
COPY . .
# Verificar instalación
RUN pip show TTS
# Exponer el puerto por el que Hugging Face espera respuesta
EXPOSE 8080
# Mantener el servidor vivo
# Usar el servidor HTTP de la librería estándar
# CMD ["python", "-m", "http.server", "7860"]
CMD ["python", "app_old.py"]