Tibron commited on
Commit
0ecef01
·
verified ·
1 Parent(s): ad67b33

Update README_zh

Browse files
Files changed (1) hide show
  1. README_zh_CN.md +571 -0
README_zh_CN.md ADDED
@@ -0,0 +1,571 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ pipeline_tag: image-to-image
4
+ ---
5
+
6
+
7
+ [English Documentation](./README.md)
8
+
9
+ <div align="center">
10
+
11
+ <img src="./assets/logo.png" alt="HunyuanImage-3.0 Logo" width="600">
12
+
13
+ # 🎨 HunyuanImage-3.0: 强大的原生多模态图像生成模型
14
+
15
+ </div>
16
+
17
+
18
+ <div align="center">
19
+ <img src="./assets/banner.png" alt="HunyuanImage-3.0 Banner" width="800">
20
+
21
+ </div>
22
+
23
+ <div align="center">
24
+ <a href=https://hunyuan.tencent.com/image target="_blank"><img src=https://img.shields.io/badge/Official%20Site-333399.svg?logo=homepage height=22px></a>
25
+ <a href=https://huggingface.co/tencent/HunyuanImage-3.0 target="_blank"><img src=https://img.shields.io/badge/%F0%9F%A4%97%20Models-d96902.svg height=22px></a>
26
+ <a href=https://github.com/Tencent-Hunyuan/HunyuanImage-3.0 target="_blank"><img src= https://img.shields.io/badge/Page-bb8a2e.svg?logo=github height=22px></a>
27
+ <a href=https://arxiv.org/pdf/2509.23951 target="_blank"><img src=https://img.shields.io/badge/Report-b5212f.svg?logo=arxiv height=22px></a>
28
+ <a href=https://x.com/TencentHunyuan target="_blank"><img src=https://img.shields.io/badge/Hunyuan-black.svg?logo=x height=22px></a>
29
+ <a href=https://docs.qq.com/doc/DUVVadmhCdG9qRXBU target="_blank"><img src=https://img.shields.io/badge/📚-提示词手册-blue.svg?logo=book height=22px></a>
30
+ </div>
31
+
32
+
33
+ <p align="center">
34
+ 👏 加入我们的 <a href="./assets/WECHAT.md" target="_blank">微信</a> 和 <a href="https://discord.gg/ehjWMqF5wY">Discord</a> |
35
+ 💻 <a href="https://hunyuan.tencent.com/modelSquare/home/play?modelId=289&from=/visual">官网试用我们的模型!</a>&nbsp&nbsp
36
+ </p>
37
+
38
+ ## 🔥🔥🔥 最新消息
39
+
40
+ - **2026年1月26日**: 🚀 **[HunyuanImage-3.0-Instruct-Distil](https://huggingface.co/tencent/HunyuanImage-3.0-Instruct-Distil)** - 蒸馏版本用于高效部署(推荐8步采样)。
41
+ - **2026年1月26日**: 🎉 **[HunyuanImage-3.0-Instruct](https://huggingface.co/tencent/HunyuanImage-3.0-Instruct)** - 发布了 **Instruct(带推理能力)**版本,支持智能提示词增强和**图像到图像**生成用于创意编辑。
42
+ - **2025年10月30日**: 🚀 **[HunyuanImage-3.0 vLLM 加速](./vllm_infer/README.md)** - 通过 vLLM 支持实现显著更快的推理速度。
43
+ - **2025年09月28日**: 📖 **[HunyuanImage-3.0 技术报告](https://arxiv.org/pdf/2509.23951)** - 全面的技术文档现已发布。
44
+ - **2025年09月28日**: 🎉 **[HunyuanImage-3.0 开源](https://github.com/Tencent-Hunyuan/HunyuanImage-3.0)** - 推理代码和模型权重现已公开可用。
45
+
46
+
47
+ ## 🧩 社区贡献
48
+
49
+ 如果您在项目中使用或开发了 HunyuanImage-3.0,欢迎告知我们。
50
+
51
+ ## 📑 开源计划
52
+
53
+ - HunyuanImage-3.0 (图像生成模型)
54
+ - [x] 推理代码
55
+ - [x] HunyuanImage-3.0 模型权重
56
+ - [x] HunyuanImage-3.0-Instruct 模型权重(带推理能力)
57
+ - [x] vLLM 支持
58
+ - [x] 蒸馏版本权重
59
+ - [x] 图像到图像生成
60
+ - [ ] 多轮交互能力
61
+
62
+
63
+ ## 🗂️ 目录
64
+ - [🔥🔥🔥 最新消息](#-最新消息)
65
+ - [🧩 社区贡献](#-社区贡献)
66
+ - [📑 开源计划](#-开源计划)
67
+ - [📖 概览](#-概览)
68
+ - [✨ 模型亮点](#-模型亮点)
69
+ - [🚀 使用方法](#-使用方法)
70
+ - [📦 环境配置](#-环境配置)
71
+ - [📥 安装依赖](#-安装依赖)
72
+ - [HunyuanImage-3.0-Instruct](#hunyuanimage-30-instruct-指令推理和图像到图像生成包括编辑和多图像融合)
73
+ - [🔥 使用 Transformers 快速开始](#-使用-transformers-快速开始)
74
+ - [1️⃣ 下载模型权重](#1-下载模型权重)
75
+ - [2️⃣ 使用 Transformers 运行](#2-使用-transformers-运行)
76
+ - [🏠 本地安装和使用](#-本地安装和使用)
77
+ - [1️⃣ 克隆仓库](#1-克隆仓库)
78
+ - [2️⃣ 下载模型权重](#2-下载模型权重)
79
+ - [3️⃣ 运行演示](#3-运行演示)
80
+ - [4️⃣ 命令行参数](#4-命令行参数)
81
+ - [5️⃣ 更少的采样步数](#5-更少的采样步数)
82
+ - [HunyuanImage-3.0 (文本生成图像)](#hunyuanimage-30-文本生成图像)
83
+ - [📥 安装依赖](#-安装依赖-1)
84
+ - [🔥 使用 Transformers 快速开始](#-使用-transformers-快速开始-1)
85
+ - [1️⃣ 下载模型权重](#1-下载模型权重-1)
86
+ - [2️⃣ 使用 Transformers 运行](#2-使用-transformers-运行-1)
87
+ - [🏠 本地安装和使用](#-本地安装和使用-1)
88
+ - [1️⃣ 克隆仓库](#1-克隆仓库-1)
89
+ - [2️⃣ 下载模型权重](#2-下载模型权重-1)
90
+ - [3️⃣ 运行演示](#3-运行演示-1)
91
+ - [4️⃣ 命令行参数](#4-命令行参数-1)
92
+ - [🎨 交互式 Gradio 演示](#-交互式-gradio-演示)
93
+ - [1️⃣ 安装 Gradio](#1-安装-gradio)
94
+ - [2️⃣ 配置环境](#2-配置环境)
95
+ - [3️⃣ 启动 Web 界面](#3-启动-web-界面)
96
+ - [4️⃣ 访问界面](#4-访问界面)
97
+ - [🧱 模型卡片](#-模型卡片)
98
+ - [📊 评估结果](#-评估结果)
99
+ - [HunyuanImage-3.0-Instruct 评估](#hunyuanimage-30-instruct-评估)
100
+ - [HunyuanImage-3.0 评估](#hunyuanimage-30-评估)
101
+ - [🖼️ 展示](#-展示)
102
+ - [HunyuanImage-3.0-Instruct 展示](#hunyuanimage-30-instruct-展示)
103
+ - [📚 引用](#-引用)
104
+ - [🙏 致谢](#-致谢)
105
+ - [🌟🚀 GitHub Star 历史](#-github-star-历史)
106
+
107
+ ---
108
+
109
+ ## 📖 概览
110
+
111
+ **HunyuanImage-3.0** 是一个突破性的原生多模态模型,它在自回归框架内统一了多模态理解和生成任务。它的文生图和图生图能力实现了与领先的闭源模型**相当或更优**的性能。
112
+
113
+
114
+ <div align="center">
115
+ <img src="./assets/framework.png" alt="HunyuanImage-3.0 Framework" width="90%">
116
+ </div>
117
+
118
+ ## ✨ 模型亮点
119
+
120
+ * 🧠 **统一的多模态架构:** HunyuanImage-3.0 突破当前主流的 DiT 架构,采用统一的自回归框架。该设计能更直接、统一地对文本与图像模态进行建模,实现了语义理解与图像生成的高度融合,从而生成效果惊人、语境丰富的图像。
121
+
122
+ * 🏆 **最大规模图像生成MoE模型:** 作为当前开源社区参数规模最大的图像生成 MoE 模型,其拥有64个专家、总参数量达 800 亿,单 token 激活 130 亿参数,显著提升了模型容量与性能表现。
123
+
124
+ * 🎨 **卓越的图像生成质量:** 通过精细的数据集构建与强化学习后训练,我们在语义准确性与视觉表现力间取得最佳平衡。该模型不仅能精准遵循提示词要求,更可生成细节丰富、具有摄影级真实感与艺术美感的图像。
125
+
126
+ * 💭 **智能图像理解与世界知识推理:** 得益于统一的多模态架构,HunyuanImage-3.0 拥有强大的推理能力。它不仅能深度理解用户输入的图像,还能利用其海量的世界知识精准解读用户意图。针对简略的提示词(prompts),它能够自动补全符合语境的细节,从而生成更出色、更完整的视觉作品。
127
+
128
+
129
+ ## 🚀 使用方法
130
+
131
+ ### 📦 环境配置
132
+
133
+ * 🐍 **Python:** 3.12+ (推荐并已测试)
134
+ * ⚡ **CUDA:** 12.8
135
+
136
+ #### 📥 安装依赖
137
+
138
+ ```bash
139
+ # 1. 首先安装 PyTorch (CUDA 12.8 版本)
140
+ pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
141
+
142
+ # 2. 安装 tencentcloud-sdk
143
+ pip install -i https://mirrors.tencent.com/pypi/simple/ --upgrade tencentcloud-sdk-python
144
+
145
+ # 3. 然后安装其他依赖
146
+ pip install -r requirements.txt
147
+ ```
148
+
149
+ 为了**获得多达3倍的推理加速**,请安装以下优化:
150
+
151
+ ```bash
152
+ # FlashInfer 用于优化的 moe 推理。v0.5.0 已测试。
153
+ pip install flashinfer-python==0.5.0
154
+ ```
155
+ > 💡**安装提示:** PyTorch 使用的 CUDA 版本必须与系统的 CUDA 版本匹配,这一点至关重要。
156
+ > FlashInfer 依赖此兼容性在运行时编译内核。
157
+ > 推荐使用 GCC 版本 >=9 来编译 FlashAttention 和 FlashInfer。
158
+
159
+ > ⚡ **性能提示:** 这些优化可以显著加快您的推理速度!
160
+
161
+ > 💡**注意:** 启用 FlashInfer 时,首次推理可能会较慢(约 10 分钟),因为需要编译内核。在同一台机器上的后续推理会快得多。
162
+
163
+ ### HunyuanImage-3.0-Instruct (指令推理和图像到图像生成,包括编辑和多图像融合)
164
+
165
+ #### 🔥 使用 Transformers 快速开始
166
+
167
+ ##### 1️⃣ 下载模型权重
168
+
169
+ ```bash
170
+ # 从 HuggingFace 下载并重命名目录。
171
+ # 注意目录名称不应包含点号,否则使用 Transformers 加载时可能出现问题。
172
+ hf download tencent/HunyuanImage-3.0-Instruct --local-dir ./HunyuanImage-3-Instruct
173
+ ```
174
+
175
+ ##### 2️⃣ 使用 Transformers 运行
176
+
177
+ ```python
178
+ from transformers import AutoModelForCausalLM
179
+
180
+ # 加载模型
181
+ model_id = "./HunyuanImage-3-Instruct"
182
+ # 目前我们无法使用 HF 模型 ID `tencent/HunyuanImage-3.0-Instruct` 直接加载模型
183
+ # 因为名称中包含点号。
184
+
185
+ kwargs = dict(
186
+ attn_implementation="sdpa",
187
+ trust_remote_code=True,
188
+ torch_dtype="auto",
189
+ device_map="auto",
190
+ moe_impl="eager", # 如果已安装 FlashInfer,可使用 "flashinfer"
191
+ moe_drop_tokens=True,
192
+ )
193
+
194
+ model = AutoModelForCausalLM.from_pretrained(model_id, **kwargs)
195
+ model.load_tokenizer(model_id)
196
+
197
+ # 图像到图像生成 (TI2I)
198
+ prompt = "基于图一的logo,参考图二中冰箱贴的材质,制作一个新的冰箱贴"
199
+
200
+ input_img1 = "./assets/demo_instruct_imgs/input_1_0.png"
201
+ input_img2 = "./assets/demo_instruct_imgs/input_1_1.png"
202
+ imgs_input = [input_img1, input_img2]
203
+
204
+ cot_text, samples = model.generate_image(
205
+ prompt=prompt,
206
+ image=imgs_input,
207
+ seed=42,
208
+ image_size="auto",
209
+ use_system_prompt="en_unified",
210
+ bot_task="think_recaption", # 使用 "think_recaption" 进行推理和增强
211
+ infer_align_image_size=True, # 将输出图像大小对齐到输入图像大小
212
+ diff_infer_steps=50,
213
+ verbose=2
214
+ )
215
+
216
+ # 保存生成的图像
217
+ samples[0].save("image_edit.png")
218
+ ```
219
+
220
+ #### 🏠 本地安装和使用
221
+
222
+ ##### 1️⃣ 克隆仓库
223
+
224
+ ```bash
225
+ git clone https://github.com/Tencent-Hunyuan/HunyuanImage-3.0.git
226
+ cd HunyuanImage-3.0/
227
+ ```
228
+
229
+ ##### 2️⃣ 下载模型权重
230
+
231
+ ```bash
232
+ # 从 HuggingFace 下载
233
+ hf download tencent/HunyuanImage-3.0-Instruct --local-dir ./HunyuanImage-3-Instruct
234
+ ```
235
+
236
+ ##### 3️⃣ 运行演示
237
+
238
+ 更多演示在 `run_demo_instruct.sh` 中。
239
+
240
+ ```bash
241
+ export MODEL_PATH="./HunyuanImage-3-Instruct"
242
+ bash run_demo_instruct.sh
243
+ ```
244
+
245
+ ##### 4️⃣ 命令行参数
246
+
247
+ | 参数 | 说明 | 推荐值 |
248
+ |----------------------|------------------------------------------------|-------------|
249
+ | `--prompt` | 输入提示词 | (必填) |
250
+ | `--image` | 要处理的图像。多个图像使用逗号分隔的路径(例如 'img1.png,img2.png') | (必填) |
251
+ | `--model-id` | 模型路径 | (必填) |
252
+ | `--attn-impl` | Attention 实现方式。目前仅支持 'sdpa' | `sdpa` |
253
+ | `--moe-impl` | MoE 实现方式。可选 `eager` 或 `flashinfer` | `flashinfer` |
254
+ | `--seed` | 图像生成的随机种子。使用 None 表示随机种子 | `None` |
255
+ | `--diff-infer-steps` | 推理步数 | `50` |
256
+ | `--image-size` | 图像分辨率。可以是 `auto`、`1280x768` 或 `16:9` | `auto` |
257
+ | `--use-system-prompt` | 系统提示词类型。选项:`None`、`dynamic`、`en_vanilla`、`en_recaption`、`en_think_recaption`、`en_unified`、`custom` | `en_unified` |
258
+ | `--system-prompt` | 自定义系统提示词。当 `--use-system-prompt` 为 `custom` 时使用 | `None` |
259
+ | `--bot-task` | 任务类型。`image` 用于直接生成;`auto` 用于文本;`recaption` 用于重写->图像;`think_recaption` 用于思考->重写->图像 | `think_recaption` |
260
+ | `--save` | 图像保存路径 | `image.png` |
261
+ | `--verbose` | 详细程度 | `2` |
262
+ | `--reproduce` | 是否复现结果 | `True` |
263
+ | `--infer-align-image-size` | 是否将目标图像大小对齐到源图像大小 | `True` |
264
+ | `--max_new_tokens` | 生成的最大 token 数 | `2048` |
265
+ | `--use-taylor-cache` | 采样时使用 Taylor Cache | `False` |
266
+
267
+ ##### 5️⃣ 更少的采样步数
268
+
269
+ 我们推荐使用模型 [HunyuanImage-3.0-Instruct-Distil](https://huggingface.co/tencent/HunyuanImage-3.0-Instruct-Distil),设置 `--diff-infer-steps 8`,同时保持所有其他推荐参数值**不变**。
270
+
271
+ ```bash
272
+ # 从 HuggingFace 下载 HunyuanImage-3.0-Instruct-Distil
273
+ hf download tencent/HunyuanImage-3.0-Instruct-Distil --local-dir ./HunyuanImage-3-Instruct-Distil
274
+
275
+ # 使用 8 步采样运行演示
276
+ export MODEL_PATH="./HunyuanImage-3-Instruct-Distil"
277
+ bash run_demo_instruct_distil.sh
278
+ ```
279
+
280
+ <details>
281
+ <summary> 先前版本(纯文本生成图像) </summary>
282
+
283
+ ### HunyuanImage-3.0 (文本生成图像)
284
+
285
+ #### 📥 安装依赖
286
+
287
+ ```bash
288
+ # 1. 首先安装 PyTorch (CUDA 12.8 版本)
289
+ pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
290
+
291
+ # 2. 安装 tencentcloud-sdk
292
+ pip install -i https://mirrors.tencent.com/pypi/simple/ --upgrade tencentcloud-sdk-python
293
+
294
+ # 3. 然后安装其他依赖
295
+ pip install -r requirements.txt
296
+ ```
297
+
298
+ 为了**获得多达3倍的推理加速**,请安装以下优化:
299
+
300
+ ```bash
301
+ # FlashInfer 用于优化的 moe 推理。v0.5.0 已测试。
302
+ pip install flashinfer-python==0.5.0
303
+ ```
304
+
305
+ #### 🔥 使用 Transformers 快速开始
306
+
307
+ ##### 1️⃣ 下载模型权重
308
+
309
+ ```bash
310
+ # 从 HuggingFace 下载并重命名目录。
311
+ # 注意目录名称不应包含点号,否则使用 Transformers 加载时可能出现问题。
312
+ hf download tencent/HunyuanImage-3.0 --local-dir ./HunyuanImage-3
313
+ ```
314
+
315
+ ##### 2️⃣ 使用 Transformers 运行
316
+
317
+ ```python
318
+ from transformers import AutoModelForCausalLM
319
+
320
+ # 加载模型
321
+ model_id = "./HunyuanImage-3"
322
+ # 目前我们无法使用 HF 模型 ID `tencent/HunyuanImage-3.0` 直接加载模型
323
+ # 因为名称中包含点号。
324
+
325
+ kwargs = dict(
326
+ attn_implementation="sdpa", # 如果已安装 FlashAttention,可使用 "flash_attention_2"
327
+ trust_remote_code=True,
328
+ torch_dtype="auto",
329
+ device_map="auto",
330
+ moe_impl="eager", # 如果已安装 FlashInfer,可使用 "flashinfer"
331
+ )
332
+
333
+ model = AutoModelForCausalLM.from_pretrained(model_id, **kwargs)
334
+ model.load_tokenizer(model_id)
335
+
336
+ # 生成图像
337
+ prompt = "一只棕色和白色相间的小狗奔跑在草地上"
338
+ image = model.generate_image(prompt=prompt, stream=True)
339
+ image.save("image.png")
340
+ ```
341
+
342
+ #### 🏠 本地安装和使用
343
+
344
+ ##### 1️⃣ 克隆仓库
345
+
346
+ ```bash
347
+ git clone https://github.com/Tencent-Hunyuan/HunyuanImage-3.0.git
348
+ cd HunyuanImage-3.0/
349
+ ```
350
+
351
+ ##### 2️⃣ 下载模型权重
352
+
353
+ ```bash
354
+ # 从 HuggingFace 下载
355
+ hf download tencent/HunyuanImage-3.0 --local-dir ./HunyuanImage-3
356
+ ```
357
+
358
+ ##### 3️⃣ 运行演示
359
+
360
+ 预训练检查点不会自动重写或增强输入提示词,为了获得最佳效果,我们目前建议社区伙伴使用 deepseek 来重写提示词。您可以前往[腾讯云](https://cloud.tencent.com/document/product/1772/115963#.E5.BF.AB.E9.80.9F.E6.8E.A5.E5.85.A5)申请 API Key。
361
+
362
+ ```bash
363
+ # 设置环境变量
364
+ export DEEPSEEK_KEY_ID="your_deepseek_key_id"
365
+ export DEEPSEEK_KEY_SECRET="your_deepseek_key_secret"
366
+
367
+ bash run_demo.sh
368
+ ```
369
+
370
+ ##### 4️⃣ 命令行参数
371
+
372
+ | 参数 | 说明 | 推荐值 |
373
+ |----------------------|------------------------------------------------|-------------|
374
+ | `--prompt` | 输入提示词 | (必填) |
375
+ | `--model-id` | 模型路径 | (必填) |
376
+ | `--attn-impl` | Attention 实现方式。可选 `sdpa` 或 `flash_attention_2` | `sdpa` |
377
+ | `--moe-impl` | MoE 实现方式。可选 `eager` 或 `flashinfer` | `flashinfer` |
378
+ | `--seed` | 图像生成的随机种子 | `None` |
379
+ | `--diff-infer-steps` | Diffusion 推理步数 | `50` |
380
+ | `--image-size` | 图像分辨率。可以是 `auto`、`1280x768` 或 `16:9` | `auto` |
381
+ | `--save` | 图像保存路径 | `image.png` |
382
+ | `--verbose` | 详细程度。0: 无日志;1: 记录推理信息。 | `0` |
383
+ | `--rewrite` | 是否启用重写 | `1` |
384
+ | `--sys-deepseek-prompt` | 从 `universal` 或 `text_rendering` 中选择系统提示词 | `universal` |
385
+
386
+ #### 🎨 交互式 Gradio 演示
387
+
388
+ 启动交互式 Web 界面,方便进行文本到图像生成。
389
+
390
+ ##### 1️⃣ 安装 Gradio
391
+
392
+ ```bash
393
+ pip install gradio>=4.21.0
394
+ ```
395
+
396
+ ##### 2️⃣ 配置环境
397
+
398
+ ```bash
399
+ # 设置您的模型路径
400
+ export MODEL_ID="path/to/your/model"
401
+
402
+ # 可选:配置 GPU 使用(默认:0,1,2,3)
403
+ export GPUS="0,1,2,3"
404
+
405
+ # 可选:配置主机和端口(默认:0.0.0.0:443)
406
+ export HOST="0.0.0.0"
407
+ export PORT="443"
408
+ ```
409
+
410
+ ##### 3️⃣ 启动 Web 界面
411
+
412
+ **基础启动:**
413
+ ```bash
414
+ sh run_app.sh
415
+ ```
416
+
417
+ **使用性能优化:**
418
+ ```bash
419
+ # 同时使用两种优化以获得最佳性能
420
+ sh run_app.sh --moe-impl flashinfer --attn-impl flash_attention_2
421
+ ```
422
+
423
+ ##### 4️⃣ 访问界面
424
+
425
+ > 🌐 **Web 界面:** 打开浏览器并访问 `http://localhost:443`(或您配置的端口)
426
+
427
+ </details>
428
+
429
+ ## 🧱 模型卡片
430
+
431
+ | 模型 | 参数量 | 下载地址 | 推荐显存 | 支持功能 |
432
+ |---------------------------| --- | --- | --- | --- |
433
+ | HunyuanImage-3.0 | 总计 80B (激活 13B) | [HuggingFace](https://huggingface.co/tencent/HunyuanImage-3.0) | ≥ 3 × 80 GB | ✅ 文本生成图像
434
+ | HunyuanImage-3.0-Instruct | 总计 80B (激活 13B) | [HuggingFace](https://huggingface.co/tencent/HunyuanImage-3.0-Instruct) | ≥ 8 × 80 GB | ✅ 文本生成图像<br>✅ 文本图像到图像<br>✅ 提示词自动重写 <br>✅ CoT 思考
435
+ | HunyuanImage-3.0-Instruct-Distil | 总计 80B (激活 13B) | [HuggingFace](https://huggingface.co/tencent/HunyuanImage-3.0-Instruct-Distil) | ≥ 8 × 80 GB |✅ 文本生成图像<br>✅ 文本图像到图像<br>✅ 提示词自动重写 <br>✅ CoT 思考 <br>✅ 更少的采样步数(推荐 8 步)
436
+
437
+ 注意事项:
438
+ - 安装性能优化工具(FlashAttention、FlashInfer)以获得更快的推理速度。
439
+ - 基础模型推荐使用多 GPU 推理。
440
+
441
+ ## 📊 评估结果
442
+
443
+ ### HunyuanImage-3.0-Instruct 评估
444
+ * 👥 **GSB (人工评估)**
445
+ 我们采用了 GSB(好/相同/差)评估方法,该方法通常用于从整体图像感知角度评估两个模型之间的相对性能。我们总共使用了 1000+ 个单图像和多图像编辑案例,在一次运行中为所有比较的模型生成相等数量的图像样本。为了公平比较,我们对每个提示词只进行一次推理,避免任何结果筛选。在与基线方法比较时,我们保持了所有选定模型的默认设置。评估由 100 多名专业评估员执行。
446
+
447
+ <p align="center">
448
+ <img src="./assets/gsb_instruct.png" width=60% alt="Human Evaluation with Other Models">
449
+ </p>
450
+
451
+
452
+ ### HunyuanImage-3.0 评估
453
+
454
+ * 🤖 **SSAE (机器评估)**
455
+ SSAE(结构化语义对齐评估)是一种基于先进多模态大语言模型(MLLMs)的图像-文本对齐智能评估指标。我们提取了 12 个类别的 3500 个关键点,然后使用多模态大语言模型通过将生成的图像与这些关键点进行比较,基于图像的视觉内容自动评估和打分。平均图像准确率表示所有关键点的图像级平均分数,而全局准确率直接计算所有关键点的���均分数。
456
+
457
+ <p align="center">
458
+ <img src="./assets/ssae_side_by_side_comparison.png" width=98% alt="Human Evaluation with Other Models">
459
+ </p>
460
+
461
+ <p align="center">
462
+ <img src="./assets/ssae_side_by_side_heatmap.png" width=98% alt="Human Evaluation with Other Models">
463
+ </p>
464
+
465
+
466
+ * 👥 **GSB (人工评估)**
467
+
468
+ 我们采用了 GSB(好/相同/差)评估方法,该方法通常用于从整体图像感知角度评估两个模型之间的相对性能。我们总共使用了 1000 个文本提示词,在一次运行中为所有比较的模型生成相等数量的图像样本。为了公平比较,我们对每个提示词只进行一次推理,避免任何结果筛选。在与基线方法比较时,我们保持了所有选定模型的默认设置。评估由 100 多名专业评估员执行。
469
+
470
+ <p align="center">
471
+ <img src="./assets/gsb.png" width=98% alt="Human Evaluation with Other Models">
472
+ </p>
473
+
474
+ ## 🖼️ 展示
475
+
476
+ 我们的模型可以遵循复杂指令生成高质量、富有创意的图像。
477
+
478
+ <div align="center">
479
+ <img src="./assets/banner_all.jpg" width=100% alt="HunyuanImage 3.0 Demo">
480
+ </div>
481
+
482
+ 文本生成图像的展示,请点击以下链接:
483
+
484
+ - [HunyuanImage-3.0](./Hunyuan-Image3.md)
485
+
486
+ ### HunyuanImage-3.0-Instruct 展示
487
+
488
+ HunyuanImage-3.0-Instruct 展示了在智能图像生成和编辑方面的强大能力。以下展示突出了其核心功能:
489
+
490
+ * 🧠 **智能视觉理解与推理(CoT Think)**: 模型执行结构化思考,分析用户输入的图像和提示词,将用户的意图和编辑任务扩展为结构化、全面的指令,从而带来更好的图像生成和编辑表现。
491
+
492
+ 将复杂的提示词和编辑任务分解为详细的视觉组件,包括主体、构图、光照、色彩搭配和风格。
493
+
494
+ * ✏️ **提示词自动重写**: 自动将稀疏或模糊的提示词增强为专业级、细节丰富的描述,更准确地捕捉用户意图。
495
+
496
+ * 🎨 **文本生成图像(T2I)**: 从文本提示词生成高质量图像,具有出色的提示词遵循度和照片级真实感。
497
+
498
+ * 🖼️ **图像到图像(TI2I)**: 支持创意图像编辑,包括添加元素、移除对象、修改风格和无缝背景替换,同时保留关键视觉元素。
499
+
500
+ * 🔀 **多图像融合**: 智能组合多个参考图像(最多3个参考图输入),创建融合来自不同来源的视觉元素的连贯合成图像。
501
+
502
+
503
+ **展示 1: 详细的思考和推理过程**
504
+
505
+ <div align="center">
506
+ <img src="./assets/pg_instruct_imgs/cot_ti2i.gif" alt="HunyuanImage-3.0-Instruct Showcase 1" width="90%">
507
+ </div>
508
+
509
+ **展示 2: 具有复杂场景理解的创意 T2I 生成**
510
+
511
+ > Prompt: 3D 毛绒质感拟人化马,暖棕浅棕肌理,穿藏蓝西装、白衬衫,戴深棕手套;疲惫带期待,坐于电脑前,旁置印 "HAPPY AGAIN" 的马克杯。橙红渐变背景,配超大号藏蓝粗体 "马上下班",叠加米黄 "Happy New Year" 并标 "(2026)"。橙红为主,藏蓝米黄撞色,毛绒温暖柔和。
512
+
513
+ <div align="center">
514
+ <img src="./assets/pg_instruct_imgs/image0.png" alt="HunyuanImage-3.0-Instruct Showcase 2" width="75%">
515
+ </div>
516
+
517
+ **展示 3: 精确图像编辑与元素保留**
518
+
519
+ <div align="center">
520
+ <img src="./assets/pg_instruct_imgs/image1.png" alt="HunyuanImage-3.0-Instruct Showcase 3" width="85%">
521
+ </div>
522
+
523
+ **展示 4: 风格转换与主题增强**
524
+
525
+ <div align="center">
526
+ <img src="./assets/pg_instruct_imgs/image2.png" alt="HunyuanImage-3.0-Instruct Showcase 4" width="85%">
527
+ </div>
528
+
529
+
530
+ **展示 5: 高级风格转换与产品效果图生成**
531
+
532
+ <div align="center">
533
+ <img src="./assets/pg_instruct_imgs/image3.png" alt="HunyuanImage-3.0-Instruct Showcase 5" width="85%">
534
+ </div>
535
+
536
+
537
+ **展示 6: 多图像融合与创意合成**
538
+
539
+ <div align="center">
540
+ <img src="./assets/pg_instruct_imgs/image4.png" alt="HunyuanImage-3.0-Instruct Showcase 6" width="85%">
541
+ </div>
542
+
543
+ ## 📚 引用
544
+
545
+ 如果您在研究中发现 HunyuanImage-3.0 有用,请引用我们的工作:
546
+
547
+ ```bibtex
548
+ @article{cao2025hunyuanimage,
549
+ title={HunyuanImage 3.0 Technical Report},
550
+ author={Cao, Siyu and Chen, Hangting and Chen, Peng and Cheng, Yiji and Cui, Yutao and Deng, Xinchi and Dong, Ying and Gong, Kipper and Gu, Tianpeng and Gu, Xiusen and others},
551
+ journal={arXiv preprint arXiv:2509.23951},
552
+ year={2025}
553
+ }
554
+ ```
555
+
556
+ ## 🙏 致谢
557
+
558
+ 我们衷心感谢以下开源项目和社区的宝贵贡献:
559
+
560
+ * 🤗 [Transformers](https://github.com/huggingface/transformers) - 最先进的 NLP 库
561
+ * 🎨 [Diffusers](https://github.com/huggingface/diffusers) - 扩散模型库
562
+ * 🌐 [HuggingFace](https://huggingface.co/) - AI 模型中心和社区
563
+ * ⚡ [FlashAttention](https://github.com/Dao-AILab/flash-attention) - 内存高效的注意力机制
564
+ * 🚀 [FlashInfer](https://github.com/flashinfer-ai/flashinfer) - 优化的推理引擎
565
+
566
+ ## 🌟🚀 GitHub Star 历史
567
+
568
+ [![GitHub stars](https://img.shields.io/github/stars/Tencent-Hunyuan/HunyuanImage-3.0?style=social)](https://github.com/Tencent-Hunyuan/HunyuanImage-3.0)
569
+ [![GitHub forks](https://img.shields.io/github/forks/Tencent-Hunyuan/HunyuanImage-3.0?style=social)](https://github.com/Tencent-Hunyuan/HunyuanImage-3.0)
570
+
571
+ [![Star History Chart](https://api.star-history.com/svg?repos=Tencent-Hunyuan/HunyuanImage-3.0&type=Date)](https://www.star-history.com/#Tencent-Hunyuan/HunyuanImage-3.0&Date)