Archive of AI

Source Snapshot / 2024-05-14-hunyuan-dit-open-source-3

Tencent-Hunyuan/HunyuanDiT

Linked event: 2024-05-14 · Tencent Hunyuan Open-Sources Native Bilingual Chinese-English Diffusion Transformer Text-to-Image Model Hunyuan-DiT

Publisher
Hugging Face
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / dc5015183f5e4896
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

[来源关键摘录] Hunyuan-DiT 在 Hugging Face 托管的官方模型权重与 Diffusers 集成页面。

[正文前段节选] Hugging Face

Search models, datasets, users... ⌘K

Tencent-Hunyuan

Tencent Hunyuan 406

arxiv: 2405.08748

arxiv: 2403.08857

License: tencent-hunyuan-community

Model card Files Files and versions

Copy to bucket

Use this model

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

This repo contains PyTorch model definitions, pre-trained weights and inference/sampling code for our paper exploring Hunyuan-DiT. You can find more visualizations on our project page.

Zhimin Li*, Jianwei Zhang*, Qin Lin, Jiangfeng Xiong, Yanxin Long, Xinchi Deng, Yingfang Zhang, Xingchao Liu, Minbin Huang, Zedong Xiao, Dayou Chen, Jiajun He, Jiahao Li, Wenyue Li, Chen Zhang, Rongwei Quan, Jianxiang Lu, Jiabin Huang, Xiaoyan Yuan, Xiaoxiao Zheng, Yixuan Li, Jihong Zhang, Chao Zhang, Meng Chen, Jie Liu, Zheng Fang, Weiyan Wang, Jinbao Xue, Yangyu Tao, JianChen Zhu, Kai Liu, Sihuan Lin, Yifu Sun, Yun Li, Dongdong Wang, Zhichao Hu, Xiao Xiao, Yan Chen, Yuhong Liu, Wei Liu, Di Wang, Yong Yang, Jie Jiang, Qinglin Lu‡

Tencent Hunyuan

DialogGen:Multi-modal Interactive Dialogue System for Multi-turn Text-to-Image Generation

Minbin Huang*, Yanxin Long*, Xinchi Deng, Ruihang Chu, Jiangfeng Xiong, Xiaodan Liang, Hong Cheng, Qinglin Lu†, Wei Liu

Chinese University of Hong Kong, Tencent Hunyuan, Shenzhen Campus of Sun Yat-sen University

🔥🔥🔥 Tencent Hunyuan Bot

Welcome to Tencent Hunyuan Bot, where you can explore our innovative products! Just input the suggested prompts below or any other imaginative prompts containing drawing-related keywords to activate the Hunyuan text-to-image generation feature. You can use simple prompts as well as multi-turn language interactions to create the picture. Unleash your creativity and create any picture you desire, all for free!

draw a pig in a suit

生成一幅画,赛博朋克风,跑车

generate a painting, cyberpunk style, sports car

📑 Open-source Plan

Hunyuan-DiT (Text-to-Image Model)

Distillation Version (Coming soon ⏩️)

TensorRT Version (Coming soon ⏩️)

Training (Coming later ⏩️)

DialogGen (Prompt Enhancement Model)

Web Demo (Gradio)

🎉 Hunyuan-DiT Key Features

Chinese-English Bilingual DiT Architecture

Multi-turn Text2Image Generation

📈 Comparisons

🎥 Visualization

📜 Requirements

🛠 Dependencies and Installation

🧱 Download Pretrained Models

Using Gradio

Using Command Line

More Configurations

We present Hunyuan-DiT, a text-to-image diffusion transformer with fine-grained understanding of both English and Chinese. To construct Hunyuan-DiT, we carefully designed the transformer structure, text encoder, and positional encoding. We also build from scratch a whole data pipeline to update and evaluate data for iterative model optimization. For fine-grained language understanding, we train a Multimodal Large Language Model to refine the captions of the images. Finally, Hunyuan-DiT can perform multi-round multi-modal dialogue with users, generating and refining images according to the context.

Through our carefully designed holistic human evaluation protocol with more than 50 professional human evaluators, Hunyuan-DiT sets a new state-of-the-art in Chinese-to-image generation compared with other open-source models.

Hunyuan-DiT is a diffusion model in the latent space, as depicted in figure below. Following the Latent Diffusion Model, we use a pre-trained Variational Autoencoder (VAE) to compress the images into low-dimensional latent spaces and train a diffusion model to learn the data distribution with diffusion models. Our diffusion model is parameterized with a transformer. To encode the text prompts, we leverage a combination of pre-trained bilingual (English and Chinese) CLIP and multilingual T5 encoder.

Understanding natural language instructions and performing multi-turn interaction with users are important for a

text-to-image system. It can help build a dynamic and iterative creation process that bring the user’s idea into reality

step by step. In this section, we will detail how we empower Hunyuan-DiT with the ability to perform multi-round

conversations and image generation. We train MLLM to understand the multi-round user dialogue

and output the new text prompt for image generation.

In order to comprehensively compare the generation capabilities of HunyuanDiT and other models, we constructed a 4-dimensional test set, including Text-Image Consistency, Excluding AI Artifacts, Subject Clarity, Aesthetic. More than 50 professional evaluators performs the evaluation.

Model Open Source Text-Image Consistency (%) Excluding AI Artifacts (%) Subject Clarity (%) Aesthetics (%) Overall (%)

SDXL ✔ 64.3 60.6 91.1 76.3 42.7

PixArt-α ✔ 68.3 60.9 93.2 77.5 45.5

Playground 2.5 ✔ 71.9 70.8 94.9 83.3 54.3

SD 3 ✘ 77.1 69.3 94.6 82.5 56.7

MidJourney v6✘ 73.5 80.2 93.5 87.2 63.3

DALL-E 3✘ 83.9 80.3 96.5 89.4 71.0

Hunyuan-DiT✔ 74.2 74.3 95.4 86.6 59.0

Chinese Elements

Long Text Input

This repo consists of DialogGen (a prompt enhancement model) and Hunyuan-DiT (a text-to-image model).

The following table shows the requirements for running the models (The TensorRT version will be updated soon):

DialogGen + Hunyuan-DiT

An NVIDIA GPU with CUDA support is required.

We have tested V100 and A100 GPUs.

Minimum: The minimum GPU memory required is 11GB.

Recommended: We recommend using a GPU with 32GB of memory for better generation quality.

Tested operating system: Linux

🛠️ Dependencies and Installation

Begin by cloning the repository:

git clone https://github.com/tencent/HunyuanDiT

cd HunyuanDiT

We provide an environment.yml file for setting up a Conda environment.

Conda's installation instructions are available here.

# 1. Prepare conda environment

conda env create -f environment.yml

# 2. Activate the environment

conda activate HunyuanDiT

# 3. Install pip dependencies

python -m pip install -r requirements.txt

# 4. (Optional) Install flash attention v2 for acceleration (requires CUDA 11.6 or above)

python -m pip install git+https://github.com/Dao-AILab/flash-attention.git@v2.1.2.post3

To download the model, first install the huggingface-cli. (Detailed instructions are available here.)

python -m pip install "huggingface_hub[cli]"

Then download the model using the following commands:

# Create a directory named 'ckpts' where the model will be saved, fulfilling the prerequisites for running the demo.

# Use the huggingface-cli tool to download the model.

# The download time may vary from 10 minutes to 1 hour depending on network conditions.

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

Note:If an No such file or directory: 'ckpts/.huggingface/.gitignore.lock' like error occurs during the download process, you can ignore the error and retry the command by executing huggingface-cli download Tencent-Hunyuan/HunyuanDiT --local-dir ./ckpts

All models will be automatically downloaded. For more information about the model, visit the Hugging Face repository here.

Download URL

sdxl-vae-fp16-fix

Make sure you have activated the conda environment before running the following command.

# By default, we start a Chinese UI.

python app/hydit_app.py

# Using Flash Attention for acceleration.

python app/hydit_app.py --infer-mode fa

# You can disable the enhancement model if the GPU memory is insufficient.

# The enhancement will be unavailable until you restart the app without the `--no-enhance` flag.

python app/hydit_app.py --no-enhance

# Start with English UI

python app/hydit_app.py --lang en

We provide 3 modes to quick start:

# Prompt Enhancement + Text-to-Image. Torch mode

python sample_t2i.py --prompt "渔舟唱晚"

# Only Text-to-Image. Torch mode

python sample_t2i.py --prompt "渔舟唱晚" --no-enhance

# Only Text-to-Image. Flash Attention mode

python sample_t2i.py --infer-mode fa --prompt "渔舟唱晚"

# Generate an image with other image sizes.

python sample_t2i.py --prompt "渔舟唱晚" --image-size 1280 768

More example prompts can be found in example_prompts.txt

[...内容已截断,完整版请查看原文或 Wayback 快照]