Jacky2305 commited on
Commit
85aea48
·
1 Parent(s): 19a95f5

Split pip install into batches to avoid memory issues

Browse files
Files changed (1) hide show
  1. Dockerfile +56 -13
Dockerfile CHANGED
@@ -4,24 +4,67 @@ ENV DEBIAN_FRONTEND=noninteractive
4
  ENV PIP_NO_CACHE_DIR=1
5
  ENV PYTHONUNBUFFERED=1
6
 
7
- # Install system dependencies with retry
8
- RUN for i in 1 2 3; do \
9
- apt-get update && apt-get install -y --no-install-recommends \
10
- ffmpeg \
11
- libsndfile1 \
12
- libportaudio2 \
13
- libasound2 \
14
- && rm -rf /var/lib/apt/lists/* \
15
- && break || sleep 10; \
16
- done
17
 
18
  WORKDIR /app
19
 
20
- # Install Python dependencies
21
  COPY requirements.txt .
22
- RUN pip install --no-cache-dir --timeout=300 -r requirements.txt
23
 
24
- # Copy RVC source code (pre-bundled to avoid git clone at build time)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  COPY infer ./infer
26
  COPY tools ./tools
27
  COPY configs ./configs
 
4
  ENV PIP_NO_CACHE_DIR=1
5
  ENV PYTHONUNBUFFERED=1
6
 
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ ffmpeg \
10
+ libsndfile1 \
11
+ libportaudio2 \
12
+ libasound2 \
13
+ && rm -rf /var/lib/apt/lists/*
 
 
 
14
 
15
  WORKDIR /app
16
 
17
+ # Install Python dependencies in batches to avoid memory issues
18
  COPY requirements.txt .
 
19
 
20
+ # Batch 1: Core ML deps (torch already has index-url)
21
+ RUN pip install --no-cache-dir --timeout=300 \
22
+ torch==2.4.1+cpu torchaudio==2.4.1+cpu \
23
+ --index-url https://download.pytorch.org/whl/cpu
24
+
25
+ # Batch 2: Audio processing
26
+ RUN pip install --no-cache-dir --timeout=300 \
27
+ numpy>=1.24.0,<2 \
28
+ scipy>=1.10.0,<2 \
29
+ librosa>=0.10.0,<0.11 \
30
+ soundfile>=0.12.0,<1 \
31
+ ffmpeg-python>=0.2.0,<1 \
32
+ av>=15.1.0,<16
33
+
34
+ # Batch 3: ML utilities
35
+ RUN pip install --no-cache-dir --timeout=300 \
36
+ faiss-cpu>=1.13.0,<2 \
37
+ praat-parselmouth>=0.4.5,<1 \
38
+ transformers>=4.49.0,<4.50 \
39
+ onnxruntime>=1.24.4,<2 \
40
+ opencv-python-headless>=4.10.0,<5 \
41
+ scikit-learn>=1.6.0,<2 \
42
+ einops>=0.8.0,<1
43
+
44
+ # Batch 4: Web UI
45
+ RUN pip install --no-cache-dir --timeout=300 \
46
+ gradio>=4.44.0 \
47
+ fastapi>=0.88.0,<0.100 \
48
+ uvicorn>=0.20.0,<0.23 \
49
+ pydantic>=1.10.13,<2 \
50
+ httpx>=0.23.0,<0.24 \
51
+ anyio>=3.6.2,<4 \
52
+ starlette>=0.22.0,<0.28 \
53
+ websockets>=10.4,<11
54
+
55
+ # Batch 5: Remaining
56
+ RUN pip install --no-cache-dir --timeout=300 \
57
+ tqdm>=4.67.0,<5 \
58
+ huggingface_hub>=0.20.0 \
59
+ PyYAML>=6.0 \
60
+ coloredlogs>=15.0,<16 \
61
+ torchfcpe>=0.0.4,<0.1 \
62
+ hyper-connections>=0.1.8,<0.4.3 \
63
+ local-attention>=1.11.0,<2 \
64
+ networkx>=3.2.0,<4 \
65
+ matplotlib>=3.8.2,<4
66
+
67
+ # Copy RVC source code
68
  COPY infer ./infer
69
  COPY tools ./tools
70
  COPY configs ./configs