update README
Browse files- README.md +6 -4
 - README_CN.md +243 -0
 
    	
        README.md
    CHANGED
    
    | 
         @@ -12,6 +12,7 @@ pipeline_tag: text-to-image 
     | 
|
| 12 | 
         
             
            extra_gated_eu_disallowed: true
         
     | 
| 13 | 
         
             
            ---
         
     | 
| 14 | 
         | 
| 
         | 
|
| 15 | 
         
             
            [中文阅读](./README_CN.md)
         
     | 
| 16 | 
         | 
| 17 | 
         
             
            <p align="center">
         
     | 
| 
         @@ -26,7 +27,7 @@ extra_gated_eu_disallowed: true 
     | 
|
| 26 | 
         | 
| 27 | 
         
             
            <div align="center">
         
     | 
| 28 | 
         
             
              <a href=https://github.com/Tencent-Hunyuan/HunyuanImage-2.1 target="_blank"><img src=https://img.shields.io/badge/Code-black.svg?logo=github height=22px></a>
         
     | 
| 29 | 
         
            -
              <a href="https:// 
     | 
| 30 | 
         
             
                <img src="https://img.shields.io/badge/Demo%20Page-blue" height="22px"></a>
         
     | 
| 31 | 
         
             
              <a href=https://huggingface.co/tencent/HunyuanImage-2.1 target="_blank"><img src=https://img.shields.io/badge/%F0%9F%A4%97%20Models-d96902.svg height=22px></a>
         
     | 
| 32 | 
         
             
              <a href="#" target="_blank"><img src="https://img.shields.io/badge/Report-Coming%20Soon-blue" height="22px"></a>
         
     | 
| 
         @@ -37,7 +38,7 @@ extra_gated_eu_disallowed: true 
     | 
|
| 37 | 
         | 
| 38 | 
         
             
            -----
         
     | 
| 39 | 
         | 
| 40 | 
         
            -
            This repo contains PyTorch model definitions, pretrained weights and inference/sampling code for our HunyuanImage-2.1. You can find more visualizations on our [project page](https://hunyuan.tencent.com).
         
     | 
| 41 | 
         | 
| 42 | 
         | 
| 43 | 
         
             
            ## 🔥🔥🔥 Latest Updates
         
     | 
| 
         @@ -211,7 +212,7 @@ pip install flash-attn==2.7.3 --no-build-isolation 
     | 
|
| 211 | 
         | 
| 212 | 
         
             
            ## 🧱 Download Pretrained Models
         
     | 
| 213 | 
         | 
| 214 | 
         
            -
            The details of download pretrained models are shown [here]( 
     | 
| 215 | 
         | 
| 216 | 
         
             
            ## 🔑 Usage
         
     | 
| 217 | 
         | 
| 
         @@ -230,7 +231,7 @@ image = pipe( 
     | 
|
| 230 | 
         
             
                width=2048,
         
     | 
| 231 | 
         
             
                height=2048,
         
     | 
| 232 | 
         
             
                use_reprompt=True,  # Enable prompt enhancement
         
     | 
| 233 | 
         
            -
                use_refiner= 
     | 
| 234 | 
         
             
                # For the distilled model, use 8 steps for faster inference.
         
     | 
| 235 | 
         
             
                # For the non-distilled model, use 50 steps for better quality
         
     | 
| 236 | 
         
             
                num_inference_steps=8 if "distilled" in model_name else 50, 
         
     | 
| 
         @@ -268,3 +269,4 @@ We would like to thank the following open-source projects and communities for th 
     | 
|
| 268 | 
         
             
               <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Tencent-Hunyuan/HunyuanImage-2.1&type=Date" />
         
     | 
| 269 | 
         
             
             </picture>
         
     | 
| 270 | 
         
             
            </a>
         
     | 
| 
         | 
| 
         | 
|
| 12 | 
         
             
            extra_gated_eu_disallowed: true
         
     | 
| 13 | 
         
             
            ---
         
     | 
| 14 | 
         | 
| 15 | 
         
            +
             
     | 
| 16 | 
         
             
            [中文阅读](./README_CN.md)
         
     | 
| 17 | 
         | 
| 18 | 
         
             
            <p align="center">
         
     | 
| 
         | 
|
| 27 | 
         | 
| 28 | 
         
             
            <div align="center">
         
     | 
| 29 | 
         
             
              <a href=https://github.com/Tencent-Hunyuan/HunyuanImage-2.1 target="_blank"><img src=https://img.shields.io/badge/Code-black.svg?logo=github height=22px></a>
         
     | 
| 30 | 
         
            +
              <a href="https://huggingface.co/spaces/tencent/HunyuanImage-2.1" target="_blank">
         
     | 
| 31 | 
         
             
                <img src="https://img.shields.io/badge/Demo%20Page-blue" height="22px"></a>
         
     | 
| 32 | 
         
             
              <a href=https://huggingface.co/tencent/HunyuanImage-2.1 target="_blank"><img src=https://img.shields.io/badge/%F0%9F%A4%97%20Models-d96902.svg height=22px></a>
         
     | 
| 33 | 
         
             
              <a href="#" target="_blank"><img src="https://img.shields.io/badge/Report-Coming%20Soon-blue" height="22px"></a>
         
     | 
| 
         | 
|
| 38 | 
         | 
| 39 | 
         
             
            -----
         
     | 
| 40 | 
         | 
| 41 | 
         
            +
            This repo contains PyTorch model definitions, pretrained weights and inference/sampling code for our HunyuanImage-2.1. You can find more visualizations on our [project page](https://hunyuan.tencent.com/image/en?tabIndex=0).
         
     | 
| 42 | 
         | 
| 43 | 
         | 
| 44 | 
         
             
            ## 🔥🔥🔥 Latest Updates
         
     | 
| 
         | 
|
| 212 | 
         | 
| 213 | 
         
             
            ## 🧱 Download Pretrained Models
         
     | 
| 214 | 
         | 
| 215 | 
         
            +
            The details of download pretrained models are shown [here](checkpoints-download.md).
         
     | 
| 216 | 
         | 
| 217 | 
         
             
            ## 🔑 Usage
         
     | 
| 218 | 
         | 
| 
         | 
|
| 231 | 
         
             
                width=2048,
         
     | 
| 232 | 
         
             
                height=2048,
         
     | 
| 233 | 
         
             
                use_reprompt=True,  # Enable prompt enhancement
         
     | 
| 234 | 
         
            +
                use_refiner=False,  # Refiner is not supported yet; coming soon.
         
     | 
| 235 | 
         
             
                # For the distilled model, use 8 steps for faster inference.
         
     | 
| 236 | 
         
             
                # For the non-distilled model, use 50 steps for better quality
         
     | 
| 237 | 
         
             
                num_inference_steps=8 if "distilled" in model_name else 50, 
         
     | 
| 
         | 
|
| 269 | 
         
             
               <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Tencent-Hunyuan/HunyuanImage-2.1&type=Date" />
         
     | 
| 270 | 
         
             
             </picture>
         
     | 
| 271 | 
         
             
            </a>
         
     | 
| 272 | 
         
            +
             
     | 
    	
        README_CN.md
    ADDED
    
    | 
         @@ -0,0 +1,243 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            <p align="center">
         
     | 
| 2 | 
         
            +
              <img src="./assets/logo.png"  height=100>
         
     | 
| 3 | 
         
            +
            </p>
         
     | 
| 4 | 
         
            +
             
     | 
| 5 | 
         
            +
            # 混元图像 2.1:一种用于高分辨率(2K)文本到图像生成的高效扩散模型
         
     | 
| 6 | 
         
            +
             
     | 
| 7 | 
         
            +
            <div align="center">
         
     | 
| 8 | 
         
            +
              <a href=https://github.com/Tencent-Hunyuan/HunyuanImage-2.1 target="_blank"><img src=https://img.shields.io/badge/Code-black.svg?logo=github height=22px></a>
         
     | 
| 9 | 
         
            +
              <a href="https://huggingface.co/spaces/tencent/HunyuanImage-2.1" target="_blank">
         
     | 
| 10 | 
         
            +
                <img src="https://img.shields.io/badge/Demo%20Page-blue" height="22px"></a>
         
     | 
| 11 | 
         
            +
              <a href=https://huggingface.co/tencent/HunyuanImage-2.1 target="_blank"><img src=https://img.shields.io/badge/%F0%9F%A4%97%20Models-d96902.svg height=22px></a>
         
     | 
| 12 | 
         
            +
              <a href="#" target="_blank"><img src="https://img.shields.io/badge/Report-Coming%20Soon-blue" height="22px"></a>
         
     | 
| 13 | 
         
            +
              <a href= https://hunyuan-promptenhancer.github.io/ target="_blank"><img src=https://img.shields.io/badge/PromptEnhancer-bb8a2e.svg?logo=github height=22px></a>
         
     | 
| 14 | 
         
            +
              <a href=https://x.com/TencentHunyuan target="_blank"><img src=https://img.shields.io/badge/Hunyuan-black.svg?logo=x height=22px></a>
         
     | 
| 15 | 
         
            +
            </div>
         
     | 
| 16 | 
         
            +
             
     | 
| 17 | 
         
            +
            ----
         
     | 
| 18 | 
         
            +
             
     | 
| 19 | 
         
            +
             
     | 
| 20 | 
         
            +
            本仓库包含我们关于混元图像 2.1 的 PyTorch 模型定义、预训练权重,以及推理/采样代码。更多可视化示例请访问我们的<a href="https://hunyuan.tencent.com/image/en?tabIndex=0">项目主页</a>。
         
     | 
| 21 | 
         
            +
             
     | 
| 22 | 
         
            +
             
     | 
| 23 | 
         
            +
            ## 🔥🔥🔥 最新动态
         
     | 
| 24 | 
         
            +
             
     | 
| 25 | 
         
            +
            - 2025 年 9 月 8 日:🚀 发布混元图像 2.1 的推理代码与模型权重。
         
     | 
| 26 | 
         
            +
             
     | 
| 27 | 
         
            +
            ## 🎥 示例
         
     | 
| 28 | 
         
            +
             
     | 
| 29 | 
         
            +
            <div align="center">
         
     | 
| 30 | 
         
            +
              <img src="./assets/show_cases.png" width=100% alt="HunyuanImage 2.1 Demo">
         
     | 
| 31 | 
         
            +
            </div>
         
     | 
| 32 | 
         
            +
             
     | 
| 33 | 
         
            +
             
     | 
| 34 | 
         
            +
            ## 目录
         
     | 
| 35 | 
         
            +
            - [🔥🔥🔥 最新动态](#-最新动态)
         
     | 
| 36 | 
         
            +
            - [🎥 示例](#-示例)
         
     | 
| 37 | 
         
            +
            - [目录](#目录)
         
     | 
| 38 | 
         
            +
            - [摘要](#摘要)
         
     | 
| 39 | 
         
            +
            - [混元图像 2.1 整体流程](#混元图像-21-整体流程)
         
     | 
| 40 | 
         
            +
            - [🎉 关键特性](#-关键特性)
         
     | 
| 41 | 
         
            +
            - [提示词增强演示](#提示词增强示例)
         
     | 
| 42 | 
         
            +
            - [📈 对比](#-对比)
         
     | 
| 43 | 
         
            +
            - [📜 系统要求](#-系统要求)
         
     | 
| 44 | 
         
            +
            - [🛠️ 依赖与安装](#-依赖与安装)
         
     | 
| 45 | 
         
            +
            - [🧱 模型下载](#-模型下载)
         
     | 
| 46 | 
         
            +
            - [🔑 使用](#-使用)
         
     | 
| 47 | 
         
            +
            - [🔗 BibTeX](#-bibtex)
         
     | 
| 48 | 
         
            +
            - [致谢](#致谢)
         
     | 
| 49 | 
         
            +
            - [Github Star 历史](#github-star-历史)
         
     | 
| 50 | 
         
            +
             
     | 
| 51 | 
         
            +
            ---
         
     | 
| 52 | 
         
            +
             
     | 
| 53 | 
         
            +
            ## 摘要
         
     | 
| 54 | 
         
            +
             
     | 
| 55 | 
         
            +
            我们提出了混元图像 2.1(HunyuanImage-2.1),这是一个能够生成 2K(2048 × 2048)分辨率图像的高效文本到图像模型。通过利用大规模数据集和涉及多个专家模型的结构化标注,我们显著增强了文本-图像对齐能力。该模型采用高表达性的 VAE,具有(32 × 32)的空间压缩比,大幅降低了计算成本。
         
     | 
| 56 | 
         
            +
             
     | 
| 57 | 
         
            +
            我们的架构包含两个阶段:
         
     | 
| 58 | 
         
            +
            1. **基础文本到图像模型**:第一阶段是一个文本到图像模型,利用两个文本编码器:一个多模态大语言模型(MLLM)来改善图像-文本对齐,以及一个多语言、字符感知编码器来增强各种语言的文本渲染。该阶段具有 170 亿参数的单流和双流 Diffusion Transformer。为了优化美学和结构连贯性,我们应用了人类反馈强化学习(RLHF)。
         
     | 
| 59 | 
         
            +
            2. **精修模型**:第二阶段引入了一个精修模型,进一步提升了图像质量和清晰度。
         
     | 
| 60 | 
         
            +
             
     | 
| 61 | 
         
            +
            此外,我们开发了 PromptEnhancer 模块来进一步提升模型性能,并采用 MeanFlow 蒸馏进行高效推理。混元图像 2.1 展现了强大的语义对齐和跨场景泛化能力,提升了文本与图像之间的一致性,增强了对场景细节、人物姿态和表情的控制,并能够生成具有不同描述的多个物体。
         
     | 
| 62 | 
         
            +
             
     | 
| 63 | 
         
            +
            ## 混元图像 2.1 整体流程
         
     | 
| 64 | 
         
            +
             
     | 
| 65 | 
         
            +
            ### 训练数据和标注
         
     | 
| 66 | 
         
            +
             
     | 
| 67 | 
         
            +
            结构化标注在短、中、长和超长级别提供分层语义信息,显著增强了模型对复杂语义的响应能力。创新性地引入了 OCR 专家模型和 IP RAG 来解决通用 VLM 标注器在密集文本和世界知识描述方面的不足,而双向验证策略确保了标注的准确性。
         
     | 
| 68 | 
         
            +
             
     | 
| 69 | 
         
            +
            ### 文本到图像模型架构
         
     | 
| 70 | 
         
            +
             
     | 
| 71 | 
         
            +
            <p align="center">
         
     | 
| 72 | 
         
            +
              <img src="./assets/framework_overall.png" width=100% alt="HunyuanImage 2.1 Architecture">
         
     | 
| 73 | 
         
            +
            </p>
         
     | 
| 74 | 
         
            +
             
     | 
| 75 | 
         
            +
            **核心组件:**
         
     | 
| 76 | 
         
            +
            * **高压缩 VAE 与 REPA 训练加速**:
         
     | 
| 77 | 
         
            +
              * 具有 32× 压缩率的 VAE 大幅减少了 DiT 模型的输入 token 数量。其特征空间与 DINOv2 特征对齐,便于高压缩 VAE 的训练。这显著提高了推理效率,使得HunyuanImage 2.1 生成 2K 图像的时间与其他模型生成 1K 图像的时间相同。
         
     | 
| 78 | 
         
            +
              * 多桶、多分辨率 REPA 损失将 DiT 特征与高维语义特征空间对齐,加速模型收敛。
         
     | 
| 79 | 
         
            +
            * **双文本编码器**:
         
     | 
| 80 | 
         
            +
              * 采用视觉-语言多模态编码器来更好地理解场景描述、人物动作和详细要求。
         
     | 
| 81 | 
         
            +
              * 引入多语言 ByT5 文本编码器,专门用于文本生成和多语言表达。
         
     | 
| 82 | 
         
            +
            * **网络**:具有 170 亿参数的单流和双流 Diffusion Transformer。
         
     | 
| 83 | 
         
            +
             
     | 
| 84 | 
         
            +
            ### 人类反馈强化学习
         
     | 
| 85 | 
         
            +
            **两阶段后训练与强化学习**:监督微调(SFT)和强化学习(RL)在两个后训练阶段中顺序应用。我们引入了奖励分布对齐算法,创新性地将高质量图像作为选定样本,确保稳定和改进的强化学习结果。
         
     | 
| 86 | 
         
            +
             
     | 
| 87 | 
         
            +
            ### 改写模型
         
     | 
| 88 | 
         
            +
            <p align="center">
         
     | 
| 89 | 
         
            +
              <img src="./assets/framework_prompt_rewrite.png" width=90% alt="HunyuanImage 2.1 Architecture">
         
     | 
| 90 | 
         
            +
            </p>
         
     | 
| 91 | 
         
            +
             
     | 
| 92 | 
         
            +
            * **首个系统性工业级改写模型**:SFT 训练结构化地重写用户文本指令以丰富视觉表达,而 GRPO 训练采用细粒度语义 AlignEvaluator 奖励模型来大幅提升从重写文本生成的图像语义。AlignEvaluator 涵盖 6 个主要类别和 24 个细粒度评估点。PromptEnhancer 支持中英文重写,并在增强开源和专有文本到图像模型的语义方面展现了通用适用性。
         
     | 
| 93 | 
         
            +
             
     | 
| 94 | 
         
            +
            ### 模型蒸馏
         
     | 
| 95 | 
         
            +
            我们提出了一种基于 MeanFlow 的新型蒸馏方法,解决了标准均值流训练固有的不稳定性和低效率的关键挑战。这种方法能够仅用少量采样步骤生成高质量图像。据我们所知,这是 MeanFlow 在工业级模型上的首次成功应用。
         
     | 
| 96 | 
         
            +
             
     | 
| 97 | 
         
            +
             
     | 
| 98 | 
         
            +
            ## 🎉 关键特性
         
     | 
| 99 | 
         
            +
             
     | 
| 100 | 
         
            +
            - 高质量生成:可生成超高清(2K)图像,具电影级构图
         
     | 
| 101 | 
         
            +
            - 多语言支持:原生支持中文与英文提示词
         
     | 
| 102 | 
         
            +
            - 先进架构:基于多模态的先进单双流结合的 DiT(Diffusion Transformer)骨干网络
         
     | 
| 103 | 
         
            +
            - 字形感知:结合 ByT5 的文本渲染能力,提升嵌字/文本生成准确性
         
     | 
| 104 | 
         
            +
            - 灵活的宽高比:支持多种图像宽高比(1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3)
         
     | 
| 105 | 
         
            +
            - 提示词增强:自动重写提示词,提高描述精度与画面质量
         
     | 
| 106 | 
         
            +
             
     | 
| 107 | 
         
            +
            ## 提示词增强示例
         
     | 
| 108 | 
         
            +
            为了提升生成图像的质量和细节,我们引入了提示词增强模型。该模型能够自动丰富用户提供的文本提示,添加丰富的描述性细节。
         
     | 
| 109 | 
         
            +
            <p align="center">
         
     | 
| 110 | 
         
            +
              <img src="./assets/reprompt.png" width=100% alt="Human Evaluation with Other Models">
         
     | 
| 111 | 
         
            +
            </p>
         
     | 
| 112 | 
         
            +
             
     | 
| 113 | 
         
            +
             
     | 
| 114 | 
         
            +
            ## 📈 对比
         
     | 
| 115 | 
         
            +
             
     | 
| 116 | 
         
            +
            ### SSAE 评测
         
     | 
| 117 | 
         
            +
            SSAE(结构化语义对齐评估)是一种基于先进多模态大语言模型(MLLMs)的图文对齐智能评测指标。我们在 12 个类别中共提取了 3500 个关键要点,然后利用多模态大语言模型,基于图像的视觉内容,将生成的图像与这些关键要点进行比对,自动完成评估与打分。平均图像准确率(Mean Image Accuracy)表示以图像为单位在所有关键要点上的平均得分,而全局准确率(Global Accuracy) 则直接对所有关键要点的平均得分进行计算。
         
     | 
| 118 | 
         
            +
             
     | 
| 119 | 
         
            +
             
     | 
| 120 | 
         
            +
            <p align="center">
         
     | 
| 121 | 
         
            +
            <table>
         
     | 
| 122 | 
         
            +
            <thead>
         
     | 
| 123 | 
         
            +
            <tr>
         
     | 
| 124 | 
         
            +
                <th rowspan="2">模型</th>  <th rowspan="2">开源</th> <th rowspan="2">平均图像准确率</th> <th rowspan="2">全局准确率</th> <th colspan="4" style="text-align: center;">主体</th> <th colspan="3" style="text-align: center;">次要主体</th> <th colspan="2" style="text-align: center;">场景</th> <th colspan="3" style="text-align: center;">其他</th>
         
     | 
| 125 | 
         
            +
            </tr>
         
     | 
| 126 | 
         
            +
            <tr>
         
     | 
| 127 | 
         
            +
                <th>名词</th> <th>关键属性</th> <th>其他属性</th> <th>动作</th> <th>名词</th> <th>属性</th> <th>动作</th> <th>名词</th> <th>属性</th> <th>镜头</th> <th>风格</th> <th>构图</th>
         
     | 
| 128 | 
         
            +
            </tr>
         
     | 
| 129 | 
         
            +
            </thead>
         
     | 
| 130 | 
         
            +
            <tbody>
         
     | 
| 131 | 
         
            +
            <tr>
         
     | 
| 132 | 
         
            +
                <td>FLUX-dev</td> <td>✅</td> <td>0.7122</td> <td>0.6995</td> <td>0.7965</td> <td>0.7824</td> <td>0.5993</td> <td>0.5777</td> <td>0.7950</td> <td>0.6826</td> <td>0.6923</td> <td>0.8453</td> <td>0.8094</td> <td>0.6452</td> <td>0.7096</td> <td>0.6190</td>
         
     | 
| 133 | 
         
            +
            </tr>
         
     | 
| 134 | 
         
            +
            <tr>
         
     | 
| 135 | 
         
            +
                <td>Seedream-3.0</td> <td>❌</td> <td>0.8827</td> <td>0.8792</td> <td>0.9490</td> <td>0.9311</td> <td>0.8242</td> <td>0.8177</td> <td>0.9747</td> <td>0.9103</td> <td>0.8400</td> <td>0.9489</td> <td>0.8848</td> <td>0.7582</td> <td>0.8726</td> <td>0.7619</td>
         
     | 
| 136 | 
         
            +
            </tr>
         
     | 
| 137 | 
         
            +
            <tr>
         
     | 
| 138 | 
         
            +
                <td>Qwen-Image</td> <td>✅</td> <td>0.8854</td> <td>0.8828</td> <td>0.9502</td> <td>0.9231</td> <td>0.8351</td> <td>0.8161</td> <td>0.9938</td> <td>0.9043</td> <td>0.8846</td> <td>0.9613</td> <td>0.8978</td> <td>0.7634</td> <td>0.8548</td> <td>0.8095</td>
         
     | 
| 139 | 
         
            +
            </tr>
         
     | 
| 140 | 
         
            +
            <tr>
         
     | 
| 141 | 
         
            +
                <td>GPT-Image</td>  <td>❌</td> <td> 0.8952</td> <td>0.8929</td> <td>0.9448</td> <td>0.9289</td> <td>0.8655</td> <td>0.8445</td> <td>0.9494</td> <td>0.9283</td> <td>0.8800</td> <td>0.9432</td> <td>0.9017</td> <td>0.7253</td> <td>0.8582</td> <td>0.7143</td>
         
     | 
| 142 | 
         
            +
            </tr>
         
     | 
| 143 | 
         
            +
            <tr>
         
     | 
| 144 | 
         
            +
                <td><strong>HunyuanImage 2.1</strong></td> <td>✅</td> <td><strong>0.8888</strong></td> <td><strong>0.8832</strong></td> <td>0.9339</td> <td>0.9341</td> <td>0.8363</td> <td>0.8342</td> <td>0.9627</td> <td>0.8870</td> <td>0.9615</td> <td>0.9448</td> <td>0.9254</td> <td>0.7527</td> <td>0.8689</td> <td>0.7619</td>
         
     | 
| 145 | 
         
            +
            </tr>
         
     | 
| 146 | 
         
            +
            </tbody>
         
     | 
| 147 | 
         
            +
            </table>
         
     | 
| 148 | 
         
            +
            </p>
         
     | 
| 149 | 
         
            +
             
     | 
| 150 | 
         
            +
            从 SSAE 的评估结果上看,我们的模型在语义对齐上目前达到了开源模型上最优的效果,并且非常接近闭源商业模型 (GPT-Image) 的效果。
         
     | 
| 151 | 
         
            +
             
     | 
| 152 | 
         
            +
            ### GSB 评测
         
     | 
| 153 | 
         
            +
             
     | 
| 154 | 
         
            +
            <p align="center">
         
     | 
| 155 | 
         
            +
              <img src="./assets/gsb.png" width=70% alt="Human Evaluation with Other Models">
         
     | 
| 156 | 
         
            +
            </p>
         
     | 
| 157 | 
         
            +
            我们采用了 GSB 评测方法,该方法常用于从整体图像感知角度评估两个模型之间的相对性能。我们共使用了 1000 条文本提示,并生成等数量的图像样本。为保证公平比较,我们仅进行一次推理,避免任何挑选结果的行为。与基线方法比较时,我们对所��选定模型均保持默认设置。评测由 100 多位专业评审完成。
         
     | 
| 158 | 
         
            +
            从结果来看,HunyuanImage 2.1 相对于 Seedream3.0(闭源)的相对胜率为 -1.36%,相对于 Qwen-Image(开源)为 2.89%。GSB 评测结果表明,作为开源模型的 HunyuanImage 2.1,其图像生成质量已达到可与闭源商业模型(Seedream3.0)相媲美的水平,同时相较于同类开源模型(Qwen-Image)展现出一定优势。这充分验证了 HunyuanImage 2.1 在文生图任务中的技术先进性和实践价值。
         
     | 
| 159 | 
         
            +
             
     | 
| 160 | 
         
            +
            ## 📜 系统要求
         
     | 
| 161 | 
         
            +
             
     | 
| 162 | 
         
            +
             
     | 
| 163 | 
         
            +
            **硬件和操作系统要求:**
         
     | 
| 164 | 
         
            +
            - 支持 CUDA 的 NVIDIA GPU。
         
     | 
| 165 | 
         
            +
              - **最低要求:** 59 GB 显存用于 2048x2048 图像生成(batch size = 1)。
         
     | 
| 166 | 
         
            +
            - 支持的操作系统:Linux。
         
     | 
| 167 | 
         
            +
             
     | 
| 168 | 
         
            +
             
     | 
| 169 | 
         
            +
            > **注意:** 上述内存要求是在启用模型 CPU offloading 的情况下测量的。如果您的 GPU 有足够的显存,可以禁用 CPU offloading 以提高推理速度。
         
     | 
| 170 | 
         
            +
             
     | 
| 171 | 
         
            +
            ## 🛠️ 依赖与安装
         
     | 
| 172 | 
         
            +
             
     | 
| 173 | 
         
            +
            1. 克隆仓库:
         
     | 
| 174 | 
         
            +
            ```bash
         
     | 
| 175 | 
         
            +
            git clone https://github.com/Tencent-Hunyuan/HunyuanImage-2.1.git
         
     | 
| 176 | 
         
            +
            cd HunyuanImage-2.1
         
     | 
| 177 | 
         
            +
            ```
         
     | 
| 178 | 
         
            +
             
     | 
| 179 | 
         
            +
            2. 安装依赖:
         
     | 
| 180 | 
         
            +
            ```bash
         
     | 
| 181 | 
         
            +
            pip install -r requirements.txt
         
     | 
| 182 | 
         
            +
            pip install flash-attn==2.7.3 --no-build-isolation
         
     | 
| 183 | 
         
            +
            ```
         
     | 
| 184 | 
         
            +
             
     | 
| 185 | 
         
            +
            ## 🧱 模型下载
         
     | 
| 186 | 
         
            +
             
     | 
| 187 | 
         
            +
            模型的下载与说明请参考[这里](ckpts/checkpoints-download.md)。
         
     | 
| 188 | 
         
            +
             
     | 
| 189 | 
         
            +
            ## 🔑 使用
         
     | 
| 190 | 
         
            +
             
     | 
| 191 | 
         
            +
            ```python
         
     | 
| 192 | 
         
            +
            import torch
         
     | 
| 193 | 
         
            +
            from hyimage.diffusion.pipelines.hunyuanimage_pipeline import HunyuanImagePipeline
         
     | 
| 194 | 
         
            +
             
     | 
| 195 | 
         
            +
            # 支持的 model_name:hunyuanimage-v2.1, hunyuanimage-v2.1-distilled
         
     | 
| 196 | 
         
            +
            model_name = "hunyuanimage-v2.1-distilled"
         
     | 
| 197 | 
         
            +
            pipe = HunyuanImagePipeline.from_pretrained(model_name=model_name, torch_dtype='bf16')
         
     | 
| 198 | 
         
            +
            pipe = pipe.to("cuda")
         
     | 
| 199 | 
         
            +
             
     | 
| 200 | 
         
            +
            prompt = "A cute, cartoon-style anthropomorphic penguin plush toy with fluffy fur, standing in a painting studio, wearing a red knitted scarf and a red beret with the word “Tencent” on it, holding a paintbrush with a focused expression as it paints an oil painting of the Mona Lisa, rendered in a photorealistic photographic style."
         
     | 
| 201 | 
         
            +
            image = pipe(
         
     | 
| 202 | 
         
            +
                prompt=prompt,
         
     | 
| 203 | 
         
            +
                width=2048,
         
     | 
| 204 | 
         
            +
                height=2048,
         
     | 
| 205 | 
         
            +
                use_reprompt=True,  # 启用提示词增强
         
     | 
| 206 | 
         
            +
                use_refiner=False,  # 精修(Refiner)功能暂不支持,后续上线
         
     | 
| 207 | 
         
            +
                # 对于蒸馏版模型,建议使用 8 步以加快推理速度;
         
     | 
| 208 | 
         
            +
                # 对于非蒸馏版模型,建议使用 50 步以获得更高画质
         
     | 
| 209 | 
         
            +
                num_inference_steps=8 if "distilled" in model_name else 50, 
         
     | 
| 210 | 
         
            +
                guidance_scale=3.25,
         
     | 
| 211 | 
         
            +
                shift=4,
         
     | 
| 212 | 
         
            +
                seed=649151,
         
     | 
| 213 | 
         
            +
            )
         
     | 
| 214 | 
         
            +
             
     | 
| 215 | 
         
            +
            image.save("generated_image.png")
         
     | 
| 216 | 
         
            +
            ```
         
     | 
| 217 | 
         
            +
             
     | 
| 218 | 
         
            +
            ## 🔗 BibTeX
         
     | 
| 219 | 
         
            +
             
     | 
| 220 | 
         
            +
            如果本项目对你的研究或应用有帮助,请引用:
         
     | 
| 221 | 
         
            +
             
     | 
| 222 | 
         
            +
            ```BibTeX
         
     | 
| 223 | 
         
            +
            @misc{HunyuanImage-2.1,
         
     | 
| 224 | 
         
            +
              title={HunyuanImage 2.1: An Efficient Diffusion Model for High-Resolution (2K) Text-to-Image Generation},
         
     | 
| 225 | 
         
            +
              author={Tencent Hunyuan Team},
         
     | 
| 226 | 
         
            +
              year={2025},
         
     | 
| 227 | 
         
            +
              howpublished={\url{https://github.com/Tencent-Hunyuan/HunyuanImage-2.1}},
         
     | 
| 228 | 
         
            +
            }
         
     | 
| 229 | 
         
            +
            ```
         
     | 
| 230 | 
         
            +
             
     | 
| 231 | 
         
            +
            ## 致谢
         
     | 
| 232 | 
         
            +
             
     | 
| 233 | 
         
            +
            感谢以下开源项目与社区为开放研究和探索所做的贡献:[Qwen](https://huggingface.co/Qwen)、
         
     | 
| 234 | 
         
            +
            [FLUX](https://github.com/black-forest-labs/flux)、[diffusers](https://github.com/huggingface/diffusers) 与 [HuggingFace](https://huggingface.co)。
         
     | 
| 235 | 
         
            +
             
     | 
| 236 | 
         
            +
            ## Github Star 历史
         
     | 
| 237 | 
         
            +
            <a href="https://star-history.com/#Tencent-Hunyuan/HunyuanImage-2.1&Date">
         
     | 
| 238 | 
         
            +
             <picture>
         
     | 
| 239 | 
         
            +
               <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Tencent-Hunyuan/HunyuanImage-2.1&type=Date&theme=dark" />
         
     | 
| 240 | 
         
            +
               <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Tencent-Hunyuan/HunyuanImage-2.1&type=Date" />
         
     | 
| 241 | 
         
            +
               <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Tencent-Hunyuan/HunyuanImage-2.1&type=Date" />
         
     | 
| 242 | 
         
            +
             </picture>
         
     | 
| 243 | 
         
            +
            </a>
         
     |