File size: 4,597 Bytes
df51520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba7d697
df51520
 
 
 
 
 
 
 
ba7d697
 
 
df51520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Copyright (c) 2023 Agung Wijaya
# Installing Gradio via Dockerfile

# pull docker
FROM python:3.8.16-slim-bullseye

# install virtualenv
RUN apt update \
    && apt install -y aria2 wget curl tree unzip ffmpeg build-essential \
    && rm -rf /var/lib/apt/lists/*

# clean up
RUN apt-get clean; \
    rm -rf /etc/machine-id /var/lib/dbus/machine-id /var/lib/apt/lists/* /tmp/* /var/tmp/*; \
    find /var/log -name "*.log" -type f -delete

# set tmp
RUN mkdir -p /content/tmp
RUN chmod -R 777 /content/tmp
RUN rm -rf /tmp
RUN ln -s /content/tmp /tmp

# make dir
RUN mkdir -p /content
RUN chmod -R 777 /content

# try fix mplconfigdir
RUN mkdir -p /content/mplconfig
RUN chmod -R 777 /content/mplconfig

# try fix 
# RuntimeError: cannot cache function '__shear_dense': no locator available for file '/usr/local/lib/python3.8/site-packages/librosa/util/utils.py'
RUN mkdir -p /content/numbacache
RUN chmod -R 777 /content/numbacache

# try fix
# PermissionError: [Errno 13] Permission denied: '/.cache' (Demucs)
RUN mkdir -p /content/demucscache
RUN chmod -R 777 /content/demucscache
RUN ln -s /content/demucscache /.cache

# set workdir
WORKDIR /content

# set environment
# PYTORCH_NO_CUDA_MEMORY_CACHING can help users with even smaller RAM such as 2GB (Demucs)
ENV PYTORCH_NO_CUDA_MEMORY_CACHING=1 \
    MPLCONFIGDIR=/content/mplconfig \
    NUMBA_CACHE_DIR=/content/numbacache

# upgrade pip
RUN python -m pip install --no-cache-dir --upgrade pip

# install library
RUN pip install --no-cache-dir --upgrade gradio
RUN pip install --no-cache-dir --upgrade setuptools wheel
RUN pip install --no-cache-dir faiss-gpu fairseq gradio ffmpeg ffmpeg-python praat-parselmouth pyworld numpy==1.23.5 numba==0.56.4 librosa==0.9.2

# copying requirements.txt
COPY requirements.txt /content/requirements.txt

# install requirements
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# copying files
COPY . .

# download hubert_base
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt -d /content -o hubert_base.pt

# download library infer_pack
RUN mkdir -p infer_pack
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://raw.githubusercontent.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/main/infer_pack/attentions.py        -d /content/infer_pack -o attentions.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://raw.githubusercontent.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/main/infer_pack/commons.py           -d /content/infer_pack -o commons.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://raw.githubusercontent.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/main/infer_pack/models.py            -d /content/infer_pack -o models.py 
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://raw.githubusercontent.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/main/infer_pack/models_onnx.py       -d /content/infer_pack -o models_onnx.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://raw.githubusercontent.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/main/infer_pack/models_onnx_moess.py -d /content/infer_pack -o models_onnx_moess.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://raw.githubusercontent.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/main/infer_pack/modules.py           -d /content/infer_pack -o modules.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://raw.githubusercontent.com/fumiama/Retrieval-based-Voice-Conversion-WebUI/main/infer_pack/transforms.py        -d /content/infer_pack -o transforms.py

# download library infer_pipeline.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/spaces/DJQmUKV/rvc-inference/raw/main/vc_infer_pipeline.py -d /content -o vc_infer_pipeline.py

# download library config.py and util.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/spaces/DJQmUKV/rvc-inference/raw/main/config.py -d /content -o config.py
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/spaces/DJQmUKV/rvc-inference/raw/main/util.py -d /content -o util.py

# extract models
RUN mkdir -p model
RUN unzip -x yanzi_sun.zip
RUN mv -v yanzi_sun model
RUN rm yanzi_sun.zip
RUN unzip -x vae.zip
RUN mv -v vae model
RUN rm vae.zip
RUN unzip -x stefanie_sun.zip
RUN mv -v stefanie_sun model
RUN rm stefanie_sun.zip

# check /tmp
RUN ls -l /tmp

# expose port gradio
EXPOSE 7860

# run app
CMD ["python", "app.py"]

# Enjoy run Gradio!