README.md 4.98 KB
Newer Older
raojy's avatar
raojy committed
1
# Qwen3-Omni
raojy's avatar
raojy committed
2
## 论文
raojy's avatar
raojy committed
3
[Qwen3-Omni](https://github.com/QwenLM/Qwen3-Omni/blob/main/assets/Qwen3_Omni.pdf)
raojy's avatar
raojy committed
4

raojy's avatar
raojy committed
5
6
7
8
9
10
## 模型简介
Qwen3-Omni 是一款原生的端到端全模态基座模型,具备对文本、图像、音频及视频的统一理解与生成能力。 该模型在多项音视频基准测试中展现出卓越的业界领先(SOTA)性能,其语音识别、音频理解及交互对话能力已可媲美 Gemini 2.5 Pro;同时,得益于早期的“文本优先”预训练策略,它在强化多模态支持的同时,完全保留了顶级的纯文本与图像处理水平,并支持多达 119 种文本语言及 19 种语音输入的跨语言交互。

在架构创新上,Qwen3-Omni 采用了基于 MoE(混合专家模型)的 “Thinker–Talker” 设计,结合 AuT 预训练与多码本技术,显著降低了推理延迟。 这种先进的设计使其能够支持极低延迟的流式音视频实时交互,实现自然的对话轮替与即时反馈。此外,模型提供了灵活的系统提示词控制机制,并同步开源了高精度的 30B 级别音频描述器(Captioner),为开源社区在全模态实时感知与复杂任务处理领域提供了强有力的支持。

<div align=center>
raojy's avatar
raojy committed
11
    <img src="./doc/arc2.png" width="50%" />
raojy's avatar
raojy committed
12
13
14
15
16
</div>

## 环境依赖
| 软件 |                    版本                     |
| :------: |:-----------------------------------------:|
17
18
19
20
21
| DTK |               26.04              |
| python |             3.10.12               |
| transformers |           4.57.6           |
| vllm |     0.15.1+das.opt1.alpha.dtk2604     |
| vllm-omni  |           0.14.0            |
chenych's avatar
chenych committed
22
| torch | 2.9.0+das.opt1.dtk2604.20260206.g275d08c2 |
raojy's avatar
raojy committed
23

raojy's avatar
raojy committed
24
推荐使用镜像: harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220
raojy's avatar
raojy committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

- 挂载地址`-v` 根据实际模型情况修改
```bash
docker run -it \
    --shm-size 200g \
    --network=host \
    --name Qwen3_Omni \
    --privileged \
    --device=/dev/kfd \
    --device=/dev/dri \
    --device=/dev/mkfd \
    --group-add video \
    --cap-add=SYS_PTRACE \
    --security-opt seccomp=unconfined \
    -u root \
    -v /opt/hyhal/:/opt/hyhal/:ro \
    -v /path/your_code_data/:/path/your_code_data/ \
raojy's avatar
raojy committed
42
    harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220 bash
raojy's avatar
raojy committed
43
44
45
```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。

46
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装,vllm 等库需要替换安装:
raojy's avatar
raojy committed
47
```
48
pip uninstall vllm
raojy's avatar
raojy committed
49
pip install vllm-0.15.1+das.opt1.alpha.dtk2604-cp310-cp310-linux_x86_64.whl
50
51
52
53
54
55
56
57
pip install -r requirements.txt
```

> audio功能需要安装vllm-omni库,安装方法如下:
```
git clone http://developer.sourcefind.cn/codes/OpenDAS/vllm-omni.git
cd /your_code_path/vllm-omni
pip install -e . --no-build-isolation
raojy's avatar
raojy committed
58
59
60
61
62
63
64
65
66
67
68
69
70
```

## 数据集
暂无

## 训练
暂无

## 推理
### vllm
#### 单机推理
```bash
## serve启动
raojy's avatar
raojy committed
71
vllm serve Qwen/Qwen3-Omni-30B-A3B-Instruct \
raojy's avatar
raojy committed
72
    --trust-remote-code \
chenych's avatar
chenych committed
73
    --tensor-parallel-size 2 \
74
75
76
77
78
79
80
    --dtype bfloat16 \
    --max-model-len 65536 \
    --gpu-memory-utilization 0.95 \
    --allowed-local-media-path / \
    --port 8001 \
    --served-model-name qwen3-omni

raojy's avatar
raojy committed
81
82

## client访问
83
84
85
86
curl http://localhost:8001/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
    "model": "qwen3-omni",
raojy's avatar
raojy committed
87
    "messages": [
88
89
90
91
92
93
94
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": [
            {"type": "image_url", "image_url": {"url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-Omni/demo/cars.jpg"}},
            {"type": "audio_url", "audio_url": {"url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-Omni/demo/cough.wav"}},
            {"type": "video_url", "video_url": {"url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-Omni/demo/draw.mp4"}},
            {"type": "text", "text": "Analyze this audio, image, and video together."}
        ]}
raojy's avatar
raojy committed
95
    ],
96
97
98
99
100
    "temperature": 0.6,
    "top_p": 0.95,
    "top_k": 20,
    "max_tokens": 16384
    }'
raojy's avatar
raojy committed
101
102
103
```

## 效果展示
104
105
106
107
108
109
- Qwen3-Omni-30B-A3B-Instruct
<div align=center>
    <img src="./doc/results-dcu-instruct.png"/>
</div>

- Qwen3-Omni-30B-A3B-Thinking
raojy's avatar
raojy committed
110
<div align=center>
111
    <img src="./doc/results-dcu-thinking.png"/>
raojy's avatar
raojy committed
112
113
114
115
116
117
118
119
</div>

### 精度
DCU与GPU精度一致,推理框架:vllm。

## 预训练权重
|  模型名称  | 权重大小 | DCU型号  | 最低卡数需求 |         下载地址          |
|:------:|:----:|:----------:|:------:|:---------------------:|
raojy's avatar
raojy committed
120
| Qwen3-Omni-30B-A3B-Instruct | 30B | BW1000 |   2   | [Hugging Face](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) |
121
| Qwen3-Omni-30B-A3B-Thinking | 30B | BW1000 |   2   | [Hugging Face](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Thinking) |
raojy's avatar
raojy committed
122
123
124


## 源码仓库及问题反馈
raojy's avatar
raojy committed
125
- https://developer.sourcefind.cn/codes/modelzoo/qwen3-omni_vllm
raojy's avatar
raojy committed
126
127
128

## 参考资料
- https://github.com/QwenLM/Qwen3-Omni