From 8d3149c9f283d168d7f1b2a0fcf841f2c2d7f750 Mon Sep 17 00:00:00 2001
From: yumoqing <yumoqing@gmail.com>
Date: Thu, 27 Mar 2025 22:06:59 +0800
Subject: [PATCH] bugfix

---
 qwen25-omni.sh   | 30 ++++++++++++++++++++++++++++++
 qwq32b/qwq32b.sh |  3 ++-
 2 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 qwen25-omni.sh

diff --git a/qwen25-omni.sh b/qwen25-omni.sh
new file mode 100644
index 0000000..cb87cbb
--- /dev/null
+++ b/qwen25-omni.sh
@@ -0,0 +1,30 @@
+sudo apt install ffmpeg
+sudo {{homepath}}/{{user}}
+sudo chown -R $(id -nu):$(id -ng) {{homepath}}/{{user}}
+cd {{homepath}}/{{user}}
+python3 -m venv py3
+source py/bin/activate
+pip install git+https://github.com/huggingface/transformers@3a1ead0aabed473eafe527915eea8c197d424356
+pip install accelerate
+pip install qwen-omni-utils[decord]
+pip install -U flash-attn --no-build-isolation
+cat >> .bashrc <<EOF
+export PATH=$HOME/py3/bin:$PATH
+source $HOME/py3/bin/activate
+EOF
+cat > loadmodel.py <<EOF
+from transformers import Qwen2_5OmniModel
+
+model = Qwen2_5OmniModel.from_pretrained(
+    "Qwen/Qwen2.5-Omni-7B",
+    device_map="auto",
+    torch_dtype=torch.bfloat16,
+    attn_implementation="flash_attention_2",
+)
+EOF
+sudo useradd -m -g {{user}} -s /usr/bin/bash -d {{homepath}}/{{user}} {{user}}
+echo "{{user}}:{{password}}" | sudo chpasswd
+sudo chown -R {{user}}:{{user}} {{homepath}}/{{user}}
+
+sudo - {{user}} -c "python loadmodel.py"
+
diff --git a/qwq32b/qwq32b.sh b/qwq32b/qwq32b.sh
index 26887cc..0bc8802 100644
--- a/qwq32b/qwq32b.sh
+++ b/qwq32b/qwq32b.sh
@@ -46,7 +46,8 @@ python3 -m venv {{home}}/py3
 {{home}}/py3/bin/pip install vllm
 sudo deluser {{user}}
 sudo delgroup {{user}}
-sudo useradd -m -g {{user}} -s bash -d {{home}} {{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}}
 systemctl enable {{user}}.service