forked from svc-develop-team/so-vits-svc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-install.sh
121 lines (97 loc) · 3.58 KB
/
run-install.sh
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
#!/bin/bash
# Functions
log_message() {
local msg="$1"
time="\033[32m$(date '+%Y-%m-%d %H:%M:%S.%N' | awk '{print substr($0, 1, 20) substr($0, 21, 3)}')\033[0m"
fmsg="\033[1;37m$msg\033[0m"
tag="\033[1;37mINFO\033[0m"
file="\033[36m$0\033[0m"
echo -e "$time | $tag | $file - $fmsg"
}
# Arguments
acc=false
while [[ "$#" -gt 0 ]]; do
case "$1" in
--acc)
log_message "Using acceleration https://ghfast.top/ and https://hf-mirror.com/"
acc=true
shift
;;
*)
log_message "Unknown option: $1"
exit 1
;;
esac
done
# Main
log_message "Installing audio-preprocess..."
if [ "$acc" = true ]; then
if ! grep -qF -- "https://ghfast.top/" ".gitmodules"; then
sed -i 's|https://github.com/|https://ghfast.top/https://github.com/|g' ".gitmodules"
fi
git submodule update --init || exit
if ! grep -qF -- "https://ghfast.top/" "audio-preprocess/pyproject.toml"; then
sed -i 's|https://github.com/|https://ghfast.top/https://github.com/|g' "audio-preprocess/pyproject.toml"
fi
else
if grep -qF -- "https://ghfast.top/" ".gitmodules"; then
sed -i 's|https://ghfast.top/https://github.com/|https://github.com/|g' ".gitmodules"
fi
git submodule update --init || exit
if grep -qF -- "https://ghfast.top/" "audio-preprocess/pyproject.toml"; then
sed -i 's|https://ghfast.top/https://github.com/|https://github.com/|g' "audio-preprocess/pyproject.toml"
fi
fi
log_message "Installing python3.9..."
sudo apt update
sudo apt install python3.9 python3.9-venv -y
log_message "Done: $(python3.9 --version | awk '{print $2}')"
log_message "Installing ffmpeg"
sudo apt install ffmpeg -y
log_message "Creating venv..."
python3.9 -m venv audio-preprocess/venv
source audio-preprocess/venv/bin/activate
log_message "Installing requirements..."
python3.9 -m pip install --upgrade pip
python3.9 -m pip install -e ./audio-preprocess/
log_message "Done."
fap --help || {
log_message "FAP failed."
exit 1
}
deactivate
log_message "Installing so-vits-svc requirements..."
sudo apt install python3.8 -y
python3.8 -m pip install -r requirements.txt || {
log_message "Failed with install requirements"
exit 1
}
log_message "Done."
log_message "Downloading pretrained models..."
sudo apt install aria2 jq -y
aria2c --allow-overwrite=true -s 10 https://hf-mirror.com/hfd/hfd.sh
sudo chmod +x hfd.sh
if [ "$acc" = true ]; then
export HF_ENDPOINT=https://hf-mirror.com
gh_url="https://ghfast.top/https://github.com"
else
unset HF_ENDPOINT
gh_url="https://github.com"
fi
./hfd.sh lj1995/VoiceConversionWebUI --include hubert_base.pt -x 10 --local-dir pretrain || exit
mv pretrain/hubert_base.pt pretrain/checkpoint_best_legacy_500.pt
aria2c --allow-overwrite=true -s 10 -d tmp/ "$gh_url/yxlllc/RMVPE/releases/download/230917/rmvpe.zip" || exit
unzip -o tmp/rmvpe.zip -d pretrain
mv pretrain/model.pt pretrain/rmvpe.pt
./hfd.sh Sucial/so-vits-svc4.1-pretrain_model --include vec768l12/vol_emb/ -x 10 --local-dir logs/44k || exit
mv logs/44k/vec768l12/vol_emb/*.pth logs/44k/
rm -r logs/44k/vec768l12/
./hfd.sh Sucial/so-vits-svc4.1-pretrain_model --include diffusion/768l12/model_0.pt -x 10 --local-dir logs/44k/diffusion || exit
mv logs/44k/diffusion/diffusion/768l12/model_0.pt logs/44k/diffusion/
rm -r logs/44k/diffusion/diffusion/
aria2c --allow-overwrite=true -s 10 -d tmp/ -o hifigan.zip "$gh_url/openvpi/vocoders/releases/download/nsf-hifigan-v1/nsf_hifigan_20221211.zip" || exit
unzip -o tmp/hifigan.zip -d pretrain
log_message "Done."
log_message "Cleaning..."
rm -r tmp
log_message "Done."