82 lines
2.3 KiB
Bash
82 lines
2.3 KiB
Bash
#!/bin/bash
|
||
# 变量
|
||
#
|
||
# home
|
||
# user
|
||
# passwd
|
||
# modelpath
|
||
# llms_path
|
||
#
|
||
# modelname
|
||
# gpucnt
|
||
# port
|
||
#
|
||
# 开始要检查安装nvidia驱动
|
||
# 需要下载两个模型
|
||
# 1)SWivid/F5-TTS
|
||
# 2)charactr/vocos-mel-24khz
|
||
sudo apt install git-lfs
|
||
sudo rm -rf {{home}}
|
||
sudo mkdir {{home}}
|
||
sudo chown -R $(id -un):$(id -gn) {{home}}
|
||
sudo apt -y install python3-venv
|
||
if [ -f "/usr/bin/hf-cli" ];then
|
||
echo "hf-cli exists"
|
||
else
|
||
sudo cat <<EOF>/usr/bin/hf-cli
|
||
#!/usr/bin/bash
|
||
|
||
export HF_ENDPOINT=https://hf-mirror.com
|
||
huggingface-cli download --resume-download $1 --local-dir {{llm_path}}/$1
|
||
EOF
|
||
fi
|
||
sudo chmod +x /usr/bin/hf-cli
|
||
nohup hf-cli SWivid/F5-TTS &
|
||
nohup hf-cli charactr/vocos-mel-24khz &
|
||
mkdir {{home}}/.pip
|
||
cat <<EOF> {{home}}/.pip/pip.conf
|
||
[global]
|
||
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
|
||
[install]
|
||
trusted-host = https://pypi.tuna.tsinghua.edu.cn
|
||
EOF
|
||
cat <<EOF>{{home}}/run.sh
|
||
#!/bin/bash
|
||
|
||
{{home}}/py3/bin/python {{home}}/py/f5tts/app/f5tts.py -w {{home}}/py/f5tts -p {{port}} 2>>{{home}}/py/f5tts/logs/f5tts.log &
|
||
{{home}}/py3/bin/python {{home}}/py/f5tts/app/f5tts.py -w {{home}}/py/f5tts -p {{ws_port}} 2>>{{home}}/py/f5tts/logs/f5tts.log &
|
||
|
||
EOF
|
||
chmod +x {{home}}/run.sh
|
||
cat <<EOF>{{home}}/{{user}}.service
|
||
[Unit]
|
||
Wants=systemd-networkd.service
|
||
|
||
[Service]
|
||
Type=forking
|
||
ExecStart=su - {{user}} -c "{{home}}/run.sh"
|
||
ExecStop=su - {{user}} "killname {{home}}/py/f5tts/app/f5tts.py"
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
EOF
|
||
sudo mv {{home}}/{{user}}.service /etc/systemd/system
|
||
/usr/bin/python3 -m venv {{home}}/py3
|
||
{{home}}/py3/bin/pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124
|
||
mkdir {{home}}/py
|
||
{{home}}/py3/bin/pip install git+https://git.kaiyuancloud.cn/yumoqing/apppublic
|
||
{{home}}/py3/bin/pip install git+https://git.kaiyuancloud.cn/yumoqing/sqlor
|
||
{{home}}/py3/bin/pip install git+https://git.kaiyuancloud.cn/yumoqing/ahserver
|
||
{{home}}/py3/bin/pip install f5-tts
|
||
cd {{home}}/py
|
||
git clone https://git.kaiyuancloud.cn/yumoqing/f5tts
|
||
sudo deluser {{user}}
|
||
sudo delgroup {{user}}
|
||
sudo groupadd {{user}}
|
||
sudo useradd -m -g {{user}} -s /usr/bin/bash -d {{home}} {{user}}
|
||
echo "{{user}}:{{passwd}}" | sudo chpasswd
|
||
sudo chown -R {{user}}:{{user}} {{home}}
|
||
sudo systemctl enable {{user}}.service
|
||
sudo systemctl start {{user}}.service
|
||
|
||
exit 0
|