-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathDockerfile.rvc_original
More file actions
146 lines (132 loc) · 7.44 KB
/
Dockerfile.rvc_original
File metadata and controls
146 lines (132 loc) · 7.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Docker Buildfile for RVC WebUI Installation with ROCm 5.4.2 for RX580 / Polaris / gfx803 AMD GPU
# Created, Built, and Compiled by Levent Sunay (lsunay) - May-April 2025
#
# Description:
# This Dockerfile is the second stage of a multi-stage build for installing the Retrieval-based-Voice-Conversion-WebUI (RVC)
# on top of a base image with ROCm 5.4.2 and PyTorch compiled for gfx803 architecture (e.g., AMD RX580 / Polaris GPUs).
# It sets up the necessary environment, dependencies, and configurations to run the RVC WebUI application.
#
# File Name: Dockerfile.rvc_original - Stage 2: Original RVC WebUI Installation (Based on ROCm 5.4.2)
FROM rocm542_gfx803_base:5.4.2
# Base image tag from Stage 1
# === Environment Variables ===
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=UTF-8
ENV PIP_ROOT_USER_ACTION='ignore'
ENV HSA_OVERRIDE_GFX_VERSION=8.0.3
ENV PYTORCH_ROCM_ARCH=gfx803
ENV ROCM_ARCH=gfx803
ENV RVC_PORT=7865
ENV NODE_VERSION=22.9.0
ENV NVM_DIR="/root/.nvm"
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin:${PATH}"
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
aria2 \
git wget curl ffmpeg \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# === RVC WebUI Installation ===
# Clone the RVC project repository into the /app directory.
RUN echo "Cloning RVC repository..." && \
git clone https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git . && \
echo "RVC repository cloned into /app."
# Create a Python 3.10 virtual environment (.venv)
RUN python3 -m venv .venv # .venv will be created under /app
# Create constraints.txt to use PyTorch wheels and other pinned versions from Stage 1
RUN echo "** Creating constraints.txt **" && \
export PATH="/opt/rocm/bin:/opt/rocm/hip/bin:${PATH}" && \
PYTORCH_WHEEL_FILE_PATH=$(cat /opt/pytorch_wheel_name.txt) && \
TORCHVISION_WHEEL_FILE_PATH=$(cat /opt/torchvision_wheel_name.txt) && \
TORCHAUDIO_WHEEL_FILE_PATH=$(cat /opt/torchaudio_wheel_name.txt) && \
echo "torch @ file://${PYTORCH_WHEEL_FILE_PATH}" > .venv/constraints.txt && \
echo "torchvision @ file://${TORCHVISION_WHEEL_FILE_PATH}" >> .venv/constraints.txt && \
echo "torchaudio @ file://${TORCHAUDIO_WHEEL_FILE_PATH}" >> .venv/constraints.txt && \
echo "numpy==1.23.5" >> .venv/constraints.txt && \
echo "protobuf==4.25.3" >> .venv/constraints.txt && \
echo "matplotlib==3.7.2" >> .venv/constraints.txt && \
echo "joblib==1.1.0" >> .venv/constraints.txt && \
echo "numba==0.56.4" >> .venv/constraints.txt && \
echo "llvmlite==0.39.0" >> .venv/constraints.txt && \
echo "fairseq==0.12.2" >> .venv/constraints.txt && \
echo "faiss-cpu==1.7.3" >> .venv/constraints.txt && \
echo "gradio==3.34.0" >> .venv/constraints.txt && \
echo "pyworld==0.3.2" >> .venv/constraints.txt && \
echo "torchcrepe==0.0.23" >> .venv/constraints.txt && \
echo "torchfcpe" >> .venv/constraints.txt && \
echo "Contents of constraints.txt:" && cat .venv/constraints.txt
# Process RVC's main requirements.txt and requirements-amd.txt files
RUN echo "Processing RVC requirements files" && \
# ---- Debugging: Check files for troubleshooting ----
echo "Current directory: $(pwd)" && ls -la && \
# ---- End of debugging ----
if [ ! -f "requirements.txt" ]; then echo "ERROR: requirements.txt NOT FOUND in $(pwd)" >&2; exit 1; fi && \
if [ ! -f "requirements-amd.txt" ]; then echo "ERROR: requirements-amd.txt NOT FOUND in $(pwd)" >&2; exit 1; fi && \
echo "--- Original requirements.txt ---" && cat requirements.txt && echo "--- End ---" && \
echo "--- Original requirements-amd.txt ---" && cat requirements-amd.txt && echo "--- End ---" && \
\
# Remove torch*, fairseq, and extension_* lines from requirements.txt
sed -i -E '/^torch(vision|audio)?\s*(==|>=)?/d' requirements.txt && \
sed -i '/^fairseq @ /d' requirements.txt && \
sed -i '/^extension_/d' requirements.txt && \
sed -i "/; sys_platform 'win32'/d" requirements.txt && \
sed -i "/; sys_platform 'darwin'/d" requirements.txt && \
echo "--- Cleaned main requirements.txt ---" && cat requirements.txt && echo "--- End ---" && \
\
# Remove torch*, numpy, numba, llvmlite, fairseq, faiss-cpu, gradio, pyworld, torchcrepe,
# torchfcpe, and onnxruntime* packages from requirements-amd.txt
sed -i -E '/^torch(vision|audio)?\\s*(==|>=)?/d' requirements-amd.txt && \
sed -i '/^tensorflow-rocm/d' requirements-amd.txt && \
sed -i '/^joblib/d' requirements-amd.txt && \
sed -i '/^numba/d' requirements-amd.txt && \
sed -i '/^numpy/d' requirements-amd.txt && \
sed -i '/^scipy/d' requirements-amd.txt && \
sed -i '/^librosa/d' requirements-amd.txt && \
sed -i '/^llvmlite/d' requirements-amd.txt && \
sed -i '/^fairseq/d' requirements-amd.txt && \
sed -i '/^faiss-cpu/d' requirements-amd.txt && \
sed -i '/^gradio/d' requirements-amd.txt && \
sed -i '/^Cython/d' requirements-amd.txt && \
sed -i '/^pyworld/d' requirements-amd.txt && \
sed -i '/^torchcrepe/d' requirements-amd.txt && \
sed -i '/^torchfcpe/d' requirements-amd.txt && \
sed -i '/^onnxruntime/d' requirements-amd.txt && \
sed -i "/; sys_platform 'darwin'/d" requirements-amd.txt && \
echo "--- Cleaned requirements-amd.txt ---" && cat requirements-amd.txt && echo "--- End ---"
# You can end this RUN block here to debug sed errors if needed.
# === Installation (Separate RUN blocks) ===
# Install remaining dependencies from the cleaned main requirements.txt
RUN echo "** Installing RVC dependencies from main requirements.txt (cleaned) **" && \
./.venv/bin/python -m pip install --no-cache-dir -r requirements.txt -c .venv/constraints.txt
# Install remaining dependencies from the cleaned requirements-amd.txt
RUN echo "** Installing RVC specific dependencies from requirements-amd.txt (cleaned) **" && \
./.venv/bin/python -m pip install --no-cache-dir -r requirements-amd.txt -c .venv/constraints.txt
# Install additional dependencies manually or with constraints, which are not in requirements files or have different pins
RUN echo "** Installing other essential dependencies into venv **" && \
./.venv/bin/python -m pip install --no-cache-dir \
-c .venv/constraints.txt \
Cython scipy librosa==0.10.2 pydub>=0.25.1 soundfile>=0.12.1 ffmpeg-python>=0.2.0 \
tensorboardX Jinja2>=3.1.2 json5 Markdown matplotlib>=3.7.2 matplotlib-inline>=0.1.3 \
praat-parselmouth>=0.4.2 Pillow>=9.1.1 resampy>=0.4.2 scikit-learn tensorboard \
tqdm>=4.63.1 tornado>=6.1 Werkzeug>=2.2.3 uc-micro-py>=1.0.1 sympy>=1.11.1 \
tabulate>=0.8.10 PyYAML>=6.0 pyasn1>=0.4.8 pyasn1-modules>=0.2.8 fsspec>=2022.11.0 \
absl-py>=1.2.0 audioread uvicorn>=0.21.1 colorama>=0.4.5 httpx fastapi==0.88 \
ffmpy==0.3.1 python-dotenv>=1.0.0 av torchcrepe==0.0.23 torchfcpe joblib==1.1.0 \
numba==0.56.4 llvmlite==0.39.0 fairseq==0.12.2 faiss-cpu==1.7.3 gradio==3.34.0 \
pyworld==0.3.2 \
# onnxruntime-rocm \ # <-- Comment or remove this line
# Try installing standard onnxruntime instead (if RVC supports it)
onnxruntime \
&& \
echo "Essential dependencies installed into venv."
# Set executable permissions for RVC scripts
RUN chmod +x *.sh
# RVC Application Launch
EXPOSE ${RVC_PORT}
# Default port for RVC (typically 7865, verify as needed)
# Copy and set up the entrypoint script for RVC
COPY entrypoint_rvc.sh /entrypoint_rvc.sh
RUN chmod +x /entrypoint_rvc.sh
ENTRYPOINT ["/entrypoint_rvc.sh"]