sob111 commited on
Commit
9fd106f
verified
1 Parent(s): 2b866c6

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +108 -0
Dockerfile ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ # Definir HOME y rutas de cach茅 para Hugging Face
4
+ WORKDIR /home/user/app
5
+ ENV HOME="/tmp"
6
+ ENV HF_HOME="/tmp/.cache/huggingface"
7
+ ENV OMP_NUM_THREADS=1
8
+
9
+ # Configuraci贸n de Git v铆a variables de entorno (sin .gitconfig)
10
+ ENV GIT_AUTHOR_NAME="sob111"
11
+ ENV GIT_AUTHOR_EMAIL="[email protected]"
12
+ ENV GIT_COMMITTER_NAME="sob111"
13
+ ENV GIT_COMMITTER_EMAIL="[email protected]"
14
+
15
+ # Instalar dependencias del sistema
16
+ RUN apt-get update && apt-get install -y \
17
+ git wget ffmpeg libsndfile1 unzip build-essential \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Instalar dependencias Python
21
+ COPY requirements.txt .
22
+ RUN pip install --upgrade pip \
23
+ && pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Instalar Coqui TTS en editable mode desde v0.22.0
26
+ RUN git clone --branch v0.22.0 https://github.com/coqui-ai/TTS.git /home/user/TTS \
27
+ && cd /home/user/TTS \
28
+ && git submodule update --init --recursive \
29
+ && pip install --no-cache-dir -e .
30
+
31
+ # 馃敡 Crear sitecustomize que simula numba (shim) y parchea librosa
32
+ RUN cat > /usr/local/lib/python3.10/site-packages/sitecustomize.py <<'PY'
33
+ import sys
34
+ import types
35
+ import os
36
+
37
+ # Asegurar cache de numba
38
+ NUMBA_CACHE = "/tmp/numba_cache"
39
+ try:
40
+ os.makedirs(NUMBA_CACHE, exist_ok=True)
41
+ os.chmod(NUMBA_CACHE, 0o777)
42
+ except Exception:
43
+ pass
44
+
45
+ # Crear un shim de numba si no existe
46
+ if "numba" not in sys.modules:
47
+ shim = types.ModuleType("numba")
48
+ shim.__file__ = "<numba_shim>"
49
+
50
+ def _identity_decorator(*d_args, **d_kwargs):
51
+ def _decorator(func):
52
+ return func
53
+ if len(d_args) == 1 and callable(d_args[0]):
54
+ return d_args[0]
55
+ return _decorator
56
+
57
+ shim.jit = _identity_decorator
58
+ shim.njit = _identity_decorator
59
+ shim.vectorize = _identity_decorator
60
+ shim.guvectorize = _identity_decorator
61
+ shim.generated_jit = _identity_decorator
62
+ shim.stencil = _identity_decorator
63
+
64
+ np_module = types.SimpleNamespace()
65
+ ufunc = types.SimpleNamespace()
66
+ decorators = types.SimpleNamespace()
67
+ decorators.vectorize = _identity_decorator
68
+ decorators.guvectorize = _identity_decorator
69
+ decorators.wrap = _identity_decorator
70
+ ufunc.decorators = decorators
71
+ np_module.ufunc = ufunc
72
+ shim.np = np_module
73
+
74
+ shim.config = types.SimpleNamespace()
75
+ shim.core = types.SimpleNamespace()
76
+ shim.core.decorators = types.SimpleNamespace()
77
+ shim.core.decorators.jit = _identity_decorator
78
+
79
+ sys.modules["numba"] = shim
80
+ sys.modules["numba.np"] = types.SimpleNamespace(ufunc=types.SimpleNamespace(decorators=decorators))
81
+ sys.modules["numba.np.ufunc"] = types.SimpleNamespace(decorators=decorators)
82
+ sys.modules["numba.np.ufunc.decorators"] = decorators
83
+
84
+ # Parche opcional librosa.magphase
85
+ try:
86
+ import librosa
87
+ try:
88
+ from librosa.core import spectrum
89
+ librosa.magphase = getattr(spectrum, "magphase", None)
90
+ except Exception:
91
+ pass
92
+ except Exception:
93
+ pass
94
+ PY
95
+
96
+ # Crear directorio de salida para checkpoints
97
+ RUN mkdir -p /tmp/output_model
98
+
99
+ # Copiar el proyecto
100
+ COPY . .
101
+
102
+ # Verificar instalaci贸n
103
+ RUN pip show TTS
104
+
105
+ # CMD por defecto (puedes cambiarlo en tu Space)
106
+ CMD ["python", "finetune_xtts_hf.py"]
107
+ #CMD ["python", "app.py"]
108
+ #CMD ["tail", "-f", "/dev/null"]