README.md 3.69 KB
Newer Older
chenych's avatar
chenych committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ERNIE-4.5
## 论文
[ERNIE 4.5 Technical Report](https://ernie.baidu.com/blog/publication/ERNIE_Technical_Report.pdf)

## 模型结构
ERNIE 4.5 的 MoE 实现
<div align=center>
    <img src="./doc/model.png"/>
</div>

## 算法原理
ERNIE 4.5 的架构支持图像、视频和文本输入,并能输出文本。
<div align=center>
    <img src="./doc/methods.png"/>
</div>

## 环境配置
### 硬件需求
chenych's avatar
chenych committed
19
DCU型号:K100_AI,节点数量:1台,卡数:1 张。
chenych's avatar
chenych committed
20
21
22
23
24

`-v 路径``docker_name``imageID`根据实际情况修改

### Docker(方法一)
```bash
chenych's avatar
chenych committed
25
docker pull image.sourcefind.cn:5000/dcu/admin/base/vllm:0.8.5-ubuntu22.04-dtk25.04.1-rc5-das1.6-py3.10-20250705
chenych's avatar
chenych committed
26
27
docker run -it --shm-size 200g --network=host --name {docker_name} --privileged --device=/dev/kfd --device=/dev/dri --device=/dev/mkfd --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root -v /path/your_code_data/:/path/your_code_data/ -v /opt/hyhal/:/opt/hyhal/:ro {imageID} bash

chenych's avatar
chenych committed
28
cd /your_code_path/ernie-4.5_vllm
chenych's avatar
chenych committed
29
30
31
32
33
34
35
36
37
pip install transformers==4.51.3
```

### Dockerfile(方法二)
```bash
cd docker
docker build --no-cache -t ernie:latest .
docker run -it --shm-size 200g --network=host --name {docker_name} --privileged --device=/dev/kfd --device=/dev/dri --device=/dev/mkfd --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root -v /path/your_code_data/:/path/your_code_data/ -v /opt/hyhal/:/opt/hyhal/:ro {imageID} bash

chenych's avatar
chenych committed
38
cd /your_code_path/ernie-4.5_vllm
chenych's avatar
chenych committed
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
pip install transformers==4.51.3
```

### Anaconda(方法三)
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装。
```bash
DTK: 25.04
python: 3.10
vllm: 0.8.5
torch: 2.4.1+das.opt2.dtk2504
deepspeed: 0.14.2+das.opt2.dtk2504
transformers: 4.51.3
```
`Tips:以上dtk驱动、python、torch等DCU相关工具版本需要严格一一对应`

## 数据集


## 训练
暂无

## 推理
### vllm推理方法

#### server
样例模型:[ERNIE-4.5-0.3B-PT](https://huggingface.co/baidu/ERNIE-4.5-0.3B-PT)

server启动
chenych's avatar
chenych committed
67

chenych's avatar
chenych committed
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
```bash
vllm serve baidu/ERNIE-4.5-0.3B-PT --trust-remote-code --port 8001 --served-model-name ERNIE-4.5-0.3B-PT
```

client访问
```bash
curl http://localhost:8001/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "ERNIE-4.5-0.3B-PT",
        "messages": [{"role": "user", "content": "Give me a short introduction to large language model."}],
        "temperature": 0.1
    }'
```

## result
<div align=center>
    <img src="./doc/results-dcu.png"/>
</div>

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

## 应用场景
### 算法类别
对话问答

### 热点应用行业
制造,广媒,家居,教育

## 预训练权重
- [ERNIE-4.5-0.3B-PT](https://huggingface.co/baidu/ERNIE-4.5-0.3B-PT)
- [ERNIE-4.5-0.3B-Base-PT](https://huggingface.co/baidu/ERNIE-4.5-0.3B-Base-PT)
- [ERNIE-4.5-21B-A3B-PT](https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-PT)
- [ERNIE-4.5-21B-A3B-Base-PT](https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-Base-PT)
- [ERNIE-4.5-300B-A47B-PT](https://huggingface.co/baidu/ERNIE-4.5-300B-A47B-PT)
- [ERNIE-4.5-300B-A47B-Base-PT](https://huggingface.co/baidu/ERNIE-4.5-300B-A47B-Base-PT)
- [ERNIE-4.5-VL-28B-A3B-PT](https://huggingface.co/baidu/ERNIE-4.5-VL-28B-A3B-PT)
- [ERNIE-4.5-VL-28B-A3B-Base-PT](https://huggingface.co/baidu/ERNIE-4.5-VL-28B-A3B-Base-PT)
- [ERNIE-4.5-VL-424B-A47B-PT](https://huggingface.co/baidu/ERNIE-4.5-VL-424B-A47B-PT)
- [ERNIE-4.5-VL-424B-A47B-Base-PT](https://huggingface.co/baidu/ERNIE-4.5-VL-424B-A47B-Base-PT)

## 源码仓库及问题反馈
chenych's avatar
chenych committed
111
- https://developer.sourcefind.cn/codes/modelzoo/ernie-4.5_vllm
chenych's avatar
chenych committed
112
113
114

## 参考资料
- https://github.com/PaddlePaddle/ERNIE