README.md 2.22 KB
Newer Older
lijian6's avatar
lijian6 committed
1
2
3
4
5
6
7
8
9
10
11
12
# HunyuanDiT

## 论文

**Hunyuan-DiT : A Powerful Multi-Resolution Diffusion Transformer with Fine-Grained Chinese Understanding**

* https://arxiv.org/pdf/2405.08748

## 模型结构

模型基于`transformer decoder`结构,在`DiT`基础上重新设计了`Time Embedding`以及`positional Embedding`的添加方式,`Text Prompt`通过两个`text encoder`进行编码,其余与DiT一致。

lijian6's avatar
lijian6 committed
13
![alt text](docs/model_structure.png)
lijian6's avatar
lijian6 committed
14
15
16
17
18


## 算法原理
使用`self-attention`捕获图像内部的结构信息,使用`cross attention`对齐文本与图像。

lijian6's avatar
lijian6 committed
19
![alt text](docs/alg.png)
lijian6's avatar
lijian6 committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41


## 环境配置

### Docker(方法一)
    
    docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.1.0-ubuntu20.04-dtk24.04.1-py3.10

    docker run --shm-size 10g --network=host --name=hunyuan --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v 项目地址(绝对路径):/home/ -v /opt/hyhal:/opt/hyhal:ro -it <your IMAGE ID> bash

### Dockerfile(方法二)

    docker build -t <IMAGE_NAME>:<TAG> .

    docker run --shm-size 10g --network=host --name=hunyuan --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v 项目地址(绝对路径):/home/ -v /opt/hyhal:/opt/hyhal:ro -it <your IMAGE ID> bash

## 数据集



## 推理

lijian6's avatar
lijian6 committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
### 安装diffuser和依赖

```
git clone https://developer.hpccube.com/codes/modelzoo/hunyuandit_diffusers.git
cd hunyuandit_diffusers
git submodule init && git submodule update

1. 卸载apex
pip uninstall apex
2. 安装diffusers
cd diffusers
python3 setup.py install
cd ..

```

lijian6's avatar
lijian6 committed
58
59
### 模型下载

lijian6's avatar
lijian6 committed
60
模型快速下载中心:[AIModels](http://113.200.138.88:18080/aimodels), 本项目模型链接:[stable-diffusion-3-medium-diffusers](http://113.200.138.88:18080/aimodels/HunyuanDiT)
lijian6's avatar
lijian6 committed
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

### 运行

    export HY_USE_XFORMERS=1
    python SD-HunyuanDit.py

## result

![img](./docs/result.png)

### 精度



## 应用场景

### 算法类别

`AIGC`

### 热点应用行业

`零售,广媒,电商`

## 源码仓库及问题反馈

* https://developer.hpccube.com/codes/modelzoo/hunyuandit_diffusers

## 参考资料

* https://hf-mirror.com/Tencent-Hunyuan/HunyuanDiT-Diffusers