README.md 2.92 KB
Newer Older
raojy's avatar
raojy committed
1
# ERNIE-Image
raojy's avatar
raojy committed
2

raojy's avatar
first  
raojy committed
3
## 论文
raojy's avatar
raojy committed
4
[ERNIE-Image](https://yiyan.baidu.com/blog/posts/ernie-image)
raojy's avatar
first  
raojy committed
5
6
7
8
9

## 模型简介
ERNIE-Image是百度文心大模型团队推出的文生图模型,基于 DiT 架构设计,参数量为80亿(8B),只需24GB显存的消费级显卡,即可生成媲美顶级商业模型的复杂、真实图像。在通用图像生成能力方面,ERNIE-Image以40% 的参数超越了大部分全球顶尖模型,与先进模型持平,在多项 benchmark上全面超越其他开源模型,取得世界第一的成绩。ERNIEImage在处理复杂指令方面表现出显著优势,尤其在精准文字渲染和知识密集型生成任务中表现突出。同时,在动漫、二次元、胶片、超现实主义、剪影、老照片等多元风格中均表现突出。

<div align=center>
raojy's avatar
raojy committed
10
    <img src="./doc/33.png"/>
raojy's avatar
first  
raojy committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</div>

## 环境依赖
| 软件 |                    版本                     |
| :------: |:-----------------------------------------:|
| DTK |                   26.04                   |
| python |                  3.10.12                  |
| transformers |                5.5.0                 |
| torch | 2.9.0+das.opt1.dtk2604.20260206.g275d08c2 |
| torchvision | 0.24.0+das.opt1.dtk2604.20260210.gf0277aff |
| pillow | 12.1.1 |
| accelerate | 1.12.0 |

当前推荐使用镜像: harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220

- 挂载地址`-v` 根据实际模型情况修改
```bash
docker run -it \
    --shm-size 200g \
    --network=host \
    --name erinie \
    --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/ \
    harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220 bash
```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。

raojy's avatar
raojy committed
46
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装,transformers库需要替换安装:
raojy's avatar
first  
raojy committed
47
48
49
50
51
52
53
54
55
56
57
58
59
```
pip install transformers==5.5.0
cd diffusers
pip install -e .
```

## 数据集
暂无

## 训练
暂无

## 推理
raojy's avatar
raojy committed
60
### diffusers
raojy's avatar
first  
raojy committed
61
62
63
64
65
66
67
68
69
70
71
72
#### 单机推理
```bash
python run.py
```


## 效果展示
<div align=center>
    <img src="./doc/1.png"/>
</div>

### 精度
raojy's avatar
raojy committed
73
DCU与GPU精度一致,推理框架:diffusers。
raojy's avatar
first  
raojy committed
74
75
76
77

## 预训练权重
|  模型名称  | 权重大小 | DCU型号  | 最低卡数需求 |         下载地址          |
|:------:|:----:|:----------:|:------:|:---------------------:|
raojy's avatar
raojy committed
78
| ERNIE-Image  | 8B | BW1000 |   1   | [Hugging Face](https://huggingface.co/baidu/ERNIE-Image) |
raojy's avatar
first  
raojy committed
79
80

## 源码仓库及问题反馈
raojy's avatar
raojy committed
81
- https://developer.sourcefind.cn/codes/modelzoo/ernie-image_pytorch
raojy's avatar
first  
raojy committed
82
## 参考资料
raojy's avatar
raojy committed
83
- https://yiyan.baidu.com/blog/posts/ernie-image