This commit is contained in:
yumoqing 2025-03-15 19:19:33 +08:00
parent b02772f4d0
commit d3473ba24f
2 changed files with 60 additions and 0 deletions

3
qwq32b/params.ui Normal file
View File

@ -0,0 +1,3 @@
{
}

57
qwq32b/qwq32b.sh Normal file
View File

@ -0,0 +1,57 @@
#!/bin/bash
# 变量
#
# home
# user
# passwd
#
# 开始要检查安装nvidia驱动
create_user()
{
sudo deluser {{user}}
sudo delgroup {{user}}
sudo useradd -m -g {{user}} -s bash -d {{home}} {{user}}
echo "{{user}}:{{passwd}}" | sudo chpasswd {{user}}
}
curusr=$(id -un)
curgrp=$(id -gn)
sudo apt install git-lfs
sudo rm -rf {{home}}
sudo mkdir {{home}}
sudo chown -R $(curusr):$(curgrp) $(home)
sudo apt -y install python3-venv
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
~/py3/bin/python -m vllm.entrypoints.openai.api_server --model ./QwQ-32B --served-model-name qwq:
32b --gpu-memory-utilization 0.9 --max_model_len 40960 --tensor-parallel-size 4
EOF
chmod +x {{home}}/run.sh
sudo cat <<EOF>/etc/systemd/system/{{user}}.service
[Unit]
Wants=systemd-networkd.service
Requires=nginx.service
[Service]
Type=forking
ExecStart=su - {{user}} -c "{{home}}/run.sh"
ExecStop=su - {{user}} "killname vllm"
[Install]
WantedBy=multi-user.target
EOF
python3 -m venv {{home}}/py3
{{home}}/py3/bin/pip install vllm
create_user
sudo chown -R {{user}}:{{user}} {{home}}
systemctl enable {{user}}.service
systemctl start {{user}}.service
exit 0