# hunyuanDit模型

## 镜像获取

http://112.11.119.100:18000/download/hy_dit_latest_perf.tar.gz

```Bash
#启动脚本参考
docker run -it  --network=host --name=dit-test  --privileged --device=/dev/kfd --device=/dev/dri --ipc=host  --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined  --ulimit stack=-1:-1 --ulimit memlock=-1:-1 -v /usr/local/hyhal/:/usr/local/hyhal/:ro  -v /opt/hyhal:/opt/hyhal:ro  -v /XXX:/XXX 35fc64dac8b5  /bin/bash
```

## 优化后代码下载地址

http://112.11.119.100:18000/download/HunyuanDiT.tar.gz

## 数据集准备

```Python
# 1 Install dependencies 
cd HunyuanDiT
pip install -e ./IndexKits


# 2 Data download
wget -O ./dataset/data_demo.zip https://dit.hunyuan.tencent.com/download/HunyuanDiT/data_demo.zip
unzip ./dataset/data_demo.zip -d ./dataset
mkdir ./dataset/porcelain/arrows ./dataset/porcelain/jsons


# 3 Data conversion 
python ./hydit/data_loader/csv2arrow.py ./dataset/porcelain/csvfile/image_text.csv ./dataset/porcelain/arrows 1

# Single Resolution Data Preparation
idk base -c dataset/yamls/porcelain.yaml -t dataset/porcelain/jsons/porcelain.json
```

## 模型下载

```Markdown
python -m pip install "huggingface_hub[cli]"

mkdir ckpts

huggingface-cli download Tencent-Hunyuan/HunyuanDiT-v1.2 --local-dir ./ckpts
```

也可以直接直接下载这里的文件，将整个文件夹重命名为ckpts

https://modelscope.cn/models/dengcao/HunyuanDiT-v1.2/files

## 模型运行

rocblas-install-0530为优化代码tar.gz压缩包下载得到

```Python
HunyuanDiT-xiafy/hydit/run_g.sh
中的rocblas路径改为rocblas-install-0530实际路径，
示例如下：
export LD_LIBRARY_PATH=/public/tengcent-hy/HunyuanDiT-xiafy/rocblas-install-0530/lib:$LD_LIBRARY_PATH


#运行模型 可以再run.sh中修改使用DUC数量，默认8卡
bash run.sh
```
