HiDream-O1-Image 是一款基于像素级统一 Transformer(UiT)构建的原生统一图像生成基础模型,无需外部 VAE 或独立文本编码器。它能在单一共享令牌空间中原生编码原始像素、文本和特定任务条件,支持文本到图像生成、图像编辑以及主题驱动的个性化创作,分辨率最高可达 2,048 × 2,048。
HiDream-O1-Image-Dev-2604 在 Artificial Analysis 文本到图像竞技场中首次亮相即位列第 8,有望成为新的领先开源文本到图像模型。
Artificial Analysis 文本到图像竞技场,分辨率最高达 2,048 × 2,048。
通用文本到图像生成,分辨率最高达 2,048 × 2,048。
长文本渲染与布局控制——精准、多区域、多语言文本。
主题驱动的个性化创作——在新场景中保持身份/IP 特征。
| 名称 | 脚本 | 推理步数 | HuggingFace仓库 |
|---|---|---|---|
| HiDream-O1-Image | inference.py | 50 | 🤗 HiDream-O1-Image |
| HiDream-O1-Image-Dev | inference.py | 28 | 🤗 HiDream-O1-Image-Dev |
| Prompt Agent | prompt_agent.py | — | 🤗 google/gemma-4-31B-it |
| Web Demo | app.py | — | — |
| HiDream-O1-Image-Dev-2604 | inference.py (dev branch) | 28 | 🤗 HiDream-O1-Image-Dev-2604 |
| Prompt Agent 2604 | prompt_agent_v2.py (dev branch) | — | 🤗 HiDream-ai/Prompt-Refine |
我们在五个广泛使用的评估套件上,将HiDream-O1-Image与最先进的开源和专有模型进行基准测试,涵盖组合生成、密集提示对齐、人类偏好、复杂视觉文本生成和长文本渲染。每个表格中,最佳结果以粗体突出显示,次佳结果以下划线标注。点击下方任意基准可展开或折叠。
| 模型 | 参数数量 | 单物体 | 双物体 | 数量 | 颜色 | 位置 | 属性 | 总体 |
|---|---|---|---|---|---|---|---|---|
| Nano Banana 2.0 | – | 1.00 | 0.96 | 0.71 | 0.84 | 0.86 | 0.65 | 0.83 |
| Seedream-4.0 | – | 1.00 | 0.92 | 0.71 | 0.93 | 0.78 | 0.68 | 0.84 |
| GPT Image 1 [High] | – | 0.99 | 0.92 | 0.85 | 0.92 | 0.75 | 0.61 | 0.84 |
| GPT Image 2 | – | 0.99 | 0.98 | 0.85 | 0.93 | 0.85 | 0.77 | 0.89 |
| PixArt | 43亿 + 6亿 | 0.98 | 0.50 | 0.44 | 0.80 | 0.08 | 0.07 | 0.48 |
| Show-o | 13亿 | 0.95 | 0.52 | 0.49 | 0.82 | 0.11 | 0.28 | 0.53 |
| Emu3-Gen | 80亿 | 0.98 | 0.71 | 0.34 | 0.81 | 0.17 | 0.21 | 0.54 |
| SD3-Medium | 55亿 + 20亿 | 0.98 | 0.74 | 0.63 | 0.67 | 0.34 | 0.36 | 0.62 |
| JanusFlow | 13亿 | 0.97 | 0.59 | 0.45 | 0.83 | 0.53 | 0.42 | 0.63 |
| FLUX.1 [Dev] | 48亿 + 120亿 | 0.98 | 0.81 | 0.74 | 0.79 | 0.22 | 0.45 | 0.66 |
| SD3.5 Large | 55亿 + 81亿 | 0.98 | 0.89 | 0.73 | 0.83 | 0.34 | 0.47 | 0.71 |
| Janus-Pro-7B | 70亿 | 0.99 | 0.89 | 0.59 | 0.90 | 0.79 | 0.66 | 0.80 |
| Z-Image-Turbo | 40亿 + 60亿 | 1.00 | 0.95 | 0.77 | 0.89 | 0.65 | 0.68 | 0.82 |
| FLUX.2 [Dev] | 240亿 + 320亿 | 1.00 | 0.99 | 0.79 | 0.93 | 0.73 | 0.78 | 0.87 |
| Qwen-Image | 70亿 + 200亿 | 0.99 | 0.92 | 0.89 | 0.88 | 0.76 | 0.77 | 0.87 |
| HiDream-O1-Image | 80亿 | 1.00 | 0.99 | 0.79 | 0.89 | 0.93 | 0.78 | 0.90 |
| HiDream-O1-Image-Pro | 2000亿+ | 1.00 | 0.99 | 0.85 | 0.94 | 0.94 | 0.79 | 0.92 |
| 模型 | 参数数量 | 全局 | 实体 | 属性 | 关系 | 其他 | 总体 |
|---|---|---|---|---|---|---|---|
| GPT Image 1 [High] | – | 88.89 | 88.94 | 89.84 | 92.63 | 90.96 | 85.15 |
| GPT Image 2 | – | 87.27 | 91.91 | 90.85 | 91.59 | 91.58 | 85.98 |
| Nano Banana 2.0 | – | 85.17 | 92.55 | 91.16 | 90.45 | 91.08 | 86.90 |
| Seedream-4.0 | – | 87.17 | 92.41 | 92.29 | 93.33 | 95.48 | 88.63 |
| SD v1.5 | 1.2亿 + 8.6亿 | 74.63 | 74.23 | 75.39 | 73.49 | 67.81 | 63.18 |
| PixArt | 43亿 + 6亿 | 74.97 | 79.32 | 78.60 | 82.57 | 76.96 | 71.11 |
| Lumina-Next | 20亿 + 20亿 | 82.82 | 88.65 | 86.44 | 80.53 | 81.82 | 74.63 |
| SDXL | 8.1亿 + 26亿 | 83.27 | 82.43 | 80.91 | 86.76 | 80.41 | 74.65 |
| Hunyuan-DiT | 48亿 + 15亿 | 84.59 | 80.59 | 88.01 | 74.36 | 86.41 | 78.87 |
| Emu3-Gen | 80亿 | 85.21 | 86.68 | 86.84 | 90.22 | 83.15 | 80.60 |
| DALL-E 3 | – | 90.97 | 89.61 | 88.39 | 90.58 | 89.83 | 83.50 |
| FLUX.1 [Dev] | 48亿 + 120亿 | 74.35 | 90.00 | 88.96 | 90.87 | 88.33 | 83.84 |
| SD3 Medium | 55亿 + 20亿 | 87.90 | 91.01 | 88.83 | 80.70 | 88.68 | 84.08 |
| Janus-Pro-7B | 70亿 | 86.90 | 88.90 | 89.40 | 89.32 | 89.48 | 84.19 |
| Z-Image-Turbo | 40亿 + 60亿 | 91.29 | 89.59 | 90.14 | 92.16 | 88.68 | 84.86 |
| HiDream-I1-Full | 135亿 + 170亿 | 76.44 | 90.22 | 89.48 | 93.74 | 91.83 | 85.89 |
| FLUX.2 [Dev] | 240亿 + 320亿 | 92.20 | 91.36 | 93.28 | 93.52 | 89.72 | 87.57 |
| Qwen-Image | 70亿 + 200亿 | 91.32 | 91.56 | 92.02 | 94.31 | 92.73 | 88.32 |
| HiDream-O1-Image | 80亿 | 95.15 | 92.32 | 93.74 | 92.88 | 90.25 | 89.83 |
| HiDream-O1-Image-Pro | 2000亿+ | 94.97 | 95.42 | 92.59 | 90.82 | 89.50 | 90.30 |
| 模型 | 参数数量 | 总体 | 人物 | 艺术 | 设计 | 建筑 | 动物 | 自然风景 | 交通工具 | 产品 | 植物 | 食物 | 科学 | 其他 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Seedream-4.0 | – | 9.32 | 9.83 | 9.20 | 8.83 | 9.95 | 8.99 | 9.40 | 9.58 | 9.12 | 9.26 | 9.75 | 9.11 | 9.51 |
| Nano Banana 2.0 | – | 10.01 | 10.18 | 9.18 | 9.58 | 10.96 | 9.71 | 10.04 | 10.38 | 10.36 | 10.14 | 10.61 | 9.14 | 9.89 |
| GPT Image 2 | – | 10.21 | 10.75 | 9.91 | 10.15 | 10.59 | 10.05 | 10.29 | 10.17 | 10.26 | 10.07 | 10.75 | a10.05 | 10.00 |
| Z-Image-Turbo | 40亿 + 60亿 | 8.35 | 8.98 | 8.29 | 7.65 | 9.26 | 8.51 | 8.33 | 8.81 | 7.83 | 8.46 | 8.64 | 7.93 | 8.57 |
| FLUX.2 [Dev] | 240亿 + 320亿 | 9.28 | 10.23 | 9.56 | 8.80 | 9.73 | 9.43 | 9.21 | 9.44 | 8.93 | 9.23 | 9.82 | 8.67 | 9.11 |
| Qwen-Image | 70亿 + 200亿 | 9.94 | 10.91 | 10.47 | 9.56 | 10.22 | 10.61 | 9.87 | 10.10 | 9.15 | 9.99 | 10.08 | 9.19 | 9.83 |
| HiDream-O1-Image | 80亿 | 10.37 | 10.59 | 10.44 | 10.29 | 11.02 | 10.34 | 10.37 | 10.54 | 10.50 | 10.38 | 10.85 | 9.68 | 10.09 |
| HiDream-O1-Image-Pro | 2000亿+ | 10.47 | 10.63 | 10.51 | 10.33 | 11.11 | 10.08 | 10.45 | 10.37 | 10.75 | 10.29 | 11.13 | 10.09 | 10.39 |
| 模型 | 参数数量 | 2区域 | 3区域 | 4区域 | 5区域 | 平均值 | NED | CLIP分数 |
|---|---|---|---|---|---|---|---|---|
| Nano Banana 2.0 | – | 0.7465 | 0.7720 | 0.8067 | 0.7980 | 0.7875 | 0.8945 | 0.7212 |
| GPT Image 1 [High] | – | 0.8779 | 0.8659 | 0.8731 | 0.8218 | 0.8569 | 0.9478 | 0.7982 |
| Seedream-4.0 | – | 0.8980 | 0.8949 | 0.9044 | 0.9015 | 0.9003 | 0.9511 | 0.8033 |
| GPT Image 2 | – | 0.8904 | 0.8887 | 0.9101 | 0.9044 | 0.9003 | 0.9515 | 0.7798 |
| TextDiffuser-2 | 1.2亿 + 9亿 | 0.5322 | 0.3255 | 0.1787 | 0.0809 | 0.2326 | 0.4353 | 0.6765 |
| RAG-Diffusion | 48亿 + 120亿 | 0.4388 | 0.3316 | 0.2116 | 0.1910 | 0.2648 | 0.4498 | 0.7797 |
| AnyText | 1.23亿 + 12亿 | 0.0513 | 0.1739 | 0.1948 | 0.2249 | 0.1804 | 0.4675 | 0.7432 |
| 3DIS | 8.1亿 + 26亿 | 0.4495 | 0.3959 | 0.3880 | 0.3303 | 0.3813 | 0.6505 | 0.7767 |
| FLUX.1 [Dev] | 48亿 + 120亿 | 0.6089 | 0.5531 | 0.4661 | 0.4316 | 0.4965 | 0.6879 | 0.7401 |
| SD3.5 Large | 55亿 + 81亿 | 0.7293 | 0.6825 | 0.6574 | 0.5940 | 0.6548 | 0.8470 | 0.7797 |
| TextCrafter | 70亿 + 200亿 | 0.7628 | 0.7628 | 0.7406 | 0.6977 | 0.7370 | 0.8679 | 0.7868 |
| Qwen-Image | 70亿 + 200亿 | 0.8370 | 0.8364 | 0.8313 | 0.8158 | 0.8288 | 0.9116 | 0.8017 |
| Z-Image-Turbo | 40亿 + 60亿 | 0.8872 | 0.8662 | 0.8628 | 0.8347 | 0.8585 | 0.9281 | 0.8048 |
| FLUX.2 [Dev] | 240亿 + 320亿 | 0.9261 | 0.8897 | 0.8995 | 0.8732 | 0.8926 | 0.9475 | 0.8104 |
| HiDream-O1-Image | 80亿 | 0.9085 | 0.9159 | 0.9216 | 0.9015 | 0.9128 | 0.9561 | 0.8076 |
| HiDream-O1-Image-Pro | 2000亿+ | 0.9133 | 0.9221 | 0.9365 | 0.9175 | 0.9222 | 0.9628 | 0.8349 |
| 模型 | 参数数量 | LongText-Bench-EN | LongText-Bench-ZH |
|---|---|---|---|
| Seedream-4.0 | – | 0.936 | 0.946 |
| GPT Image 1 [High] | – | 0.956 | 0.619 |
| GPT Image 2 | – | 0.960 | 0.961 |
| Nano Banana 2.0 | – | 0.980 | 0.965 |
| Janus-Pro-7B | 70亿 | 0.019 | 0.006 |
| BLIP3-o | 70亿 + 14亿 | 0.021 | 0.018 |
| Kolors 2.0 | – | 0.258 | 0.329 |
| BAGEL | 70亿 + 70亿 | 0.373 | 0.310 |
| OmniGen2 | 30亿 + 40亿 | 0.561 | 0.059 |
| X-Omni | 70亿 | 0.900 | 0.814 |
| HiDream-I1-Full | 135亿 + 170亿 | 0.543 | 0.024 |
| FLUX.1 [Dev] | 48亿 + 120亿 | 0.607 | 0.005 |
| Z-Image-Turbo | 40亿 + 60亿 | 0.917 | 0.926 |
| FLUX.2 [Dev] | 240亿 + 320亿 | 0.963 | 0.757 |
| Qwen-Image | 70亿 + 200亿 | 0.943 | 0.946 |
| HiDream-O1-Image | 80亿 | 0.979 | 0.978 |
| HiDream-O1-Image-Pro | 2000亿+ | 0.982 | 0.980 |
git clone https://github.com/HiDream-ai/HiDream-O1-Image.git
cd HiDream-O1-Imagepip install -r requirements.txt关于
flash-attn的说明:我们强烈建议安装flash-attn以实现优化的注意力计算。如果您不安装(或无法安装)flash-attn,则必须编辑models/pipeline.py的第 341 行,将"use_flash_attn": True修改为"use_flash_attn": False——否则推理过程将无法导入内核。
HiDream-O1-Image 内置了推理驱动提示词代理(prompt_agent.py),该代理会明确地对布局、主体属性、物理逻辑和文本渲染细节进行推理,然后将原始用户指令重写为一个自包含的英文提示词。它支持两种后端——通过 --backend 选择其一。
该代理会输出一个包含三个字段的 JSON 对象:prompt(重写后的英文提示词)、reasoning(推理过程)和 resolved_knowledge(已解析知识)。将 prompt 字段输入 inference.py,可在复杂、推理密集型请求上获得最佳结果。
huggingface-cli download google/gemma-4-31B-it --local-dir /path/to/gemma-4-31B-itpython prompt_agent.py \
--backend local \
--model_id /path/to/gemma-4-31B-it \
--prompt "李白的静夜思写在古墙上"通过提供 --base_url、--api_key 和 --model_name,使用任何 OpenAI 兼容的端点(OpenAI、Azure、vLLM、SGLang、DeepSeek 等):
python prompt_agent.py \
--backend api \
--base_url https://api.openai.com/v1 \
--api_key $OPENAI_API_KEY \
--model_name deepseek-v4-pro \
--prompt "李白的静夜思写在古墙上"推理需要具备 CUDA 能力的 GPU。以下示例使用未蒸馏模型(--model_type full);有关使用蒸馏模型(--model_type dev)运行相同任务的信息,请参见最后一小节。
根据文本提示生成图像:
python inference.py \
--model_path /path/to/HiDream-O1-Image \
--prompt "medium shot, eye-level, front view. A woman is seated in an ornate bedroom, illuminated by candlelight, with a calm and composed expression. The subject is a young woman with fair skin, light brown hair styled in an updo with loose tendrils framing her face, and blue eyes. She wears a cream-colored satin robe with delicate floral embroidery and lace trim along the neckline. Her ears are adorned with pearl drop earrings. She is seated on a bed with a dark, intricately carved wooden headboard. To her left, a wooden nightstand holds three lit white candles and a candelabra with multiple lit candles in the background. The bed is covered with patterned pillows and a dark, textured blanket. The walls are paneled with dark wood and feature a large, ornate tapestry with muted earth tones. The lighting creates soft highlights on her face and robe, with warm shadows cast across the room." \
--output_image results/t2i.png \
--height 2048 \
--width 2048提供一张参考图像和一条编辑指令:
python inference.py \
--model_path /path/to/HiDream-O1-Image \
--prompt "remove the earphones" \
--ref_images assets/edit/test.jpg \
--output_image results/edit.png \
--keep_original_aspect提供两张或更多定义主体的参考图像,以及一个将它们置于新场景中的提示词:
python inference.py \
--model_path /path/to/HiDream-O1-Image \
--shift 1 \
--prompt "A young boy with blonde hair stands on steps wearing light blue jeans, a white t-shirt with logo, and blue and white sneakers. He wears a brown cord necklace with beads, a black wristwatch with digital display, and carries a yellow fanny pack with white zipper. In his hand is a red boxing glove with white top, a teal plastic toy car, and a plastic toy figure of Captain America. He wears a straw hat with cream band. Natural light illuminates the scene." \
--ref_images assets/IP/1.jpg assets/IP/2.jpg assets/IP/3.jpg assets/IP/4.jpg assets/IP/5.jpg assets/IP/6.jpg assets/IP/7.jpg assets/IP/8.jpg assets/IP/9.jpg assets/IP/10.jpg \
--output_image results/subject.pngpython inference.py \
--model_path /path/to/HiDream-O1-Image \
--shift 1 \
--seed 42 \
--prompt "Create a realistic try-on image of the person wearing the provided clothing." \
--ref_images assets/IP_skeleton/0.face.jpg assets/IP_skeleton/0.bg.jpg assets/IP_skeleton/0.openpose.jpg assets/IP_skeleton/0.part_1.jpg assets/IP_skeleton/0.part_2.jpg assets/IP_skeleton/0.part_3.jpg \
--output_image results/subject.pngpython inference.py \
--model_path /path/to/HiDream-O1-Image \
--shift 1 \
--seed 42 \
--prompt "City council members pose with relaxed smiles on a sunlit terrace, warm approachable mood, golden hour, cinematic soft glow." \
--ref_images assets/IP_layout/0.jpg assets/IP_layout/1.jpg \
--layout_bboxes "[[0.20507812, 0.43945312, 0.48828125, 0.7421875 ], [0.57617188, 0.80078125, 0.08789062, 0.34179688]]" \
--output_image results/ip_layout.png上述所有三个任务都可以通过将 --model_path 切换到开发检查点并设置 --model_type dev 来使用 Dev 模型运行。例如:
python inference.py \
--model_path /path/to/HiDream-O1-Image-Dev \
--prompt "A dog holds a sign that says \"HiDream-O1-Image release.\"" \
--output_image results/t2i_dev.png \
--model_type dev对于编辑任务(精确对应一张参考图像),Dev模型默认使用flow_match调度器。建议在编辑任务中使用flow_match。若要改用flash调度器,请传递--editing_scheduler flash。此标志对full模型或非编辑任务无效。
--model_path:完整HuggingFace模型目录的路径(未蒸馏或已蒸馏)。--prompt:用于生成或编辑任务的文本提示。--ref_images:一张或多张参考图像的路径(可选;以空格分隔)。--output_image:保存生成图像的路径(默认:output.png)。--height / --width:输出图像尺寸(默认:2048 × 2048;内部会自动调整为有效分辨率)。--model_type:full 或 dev(默认:full)。选择推理方案:
full:50步,引导尺度 5.0,偏移 3.0,默认调度器。dev:28步,引导尺度 0.0,偏移 1.0,带有预定义时间步的flash调度器。对于编辑任务(精确对应一张参考图像),默认调度器为flow_match——详见--editing_scheduler。--seed:随机种子(默认:32)。--guidance_scale:引导尺度(默认:5.0)。仅当--model_type为full时有效。--noise_scale_start、--noise_scale_end:控制调度器在每个去噪步骤中注入的噪声尺度;每一步的尺度从noise_scale_start(第一步)到noise_scale_end(最后一步)进行线性插值。详见models/pipeline.py:313(初始噪声)和models/pipeline.py:323-326(每步线性插值)。默认值:7.5、7.5。--noise_clip_std:在调度器步进过程中对添加的噪声应用的每步裁剪阈值(以注入噪声的标准差为单位)。详见models/flash_scheduler.py:350-354。默认值:2.5。--editing_scheduler:当--model_type为dev时,用于编辑任务(精确对应一张参考图像)的调度器。选项:flow_match(默认)或flash。对full模型和非编辑任务无效。--keep_original_aspect:当提供精确一张参考图像时,如果设为True,则将其调整为max_size=2048并使用其尺寸作为目标图像尺寸(保留参考图像的宽高比)。app.py 是一个单文件 Flask Web 用户界面(内嵌 HTML/CSS/JS),可支持所有生成模式。它还集成了推理驱动提示代理。
python app.py \
--model_path /path/to/HiDream-O1-Image \
--host 0.0.0.0 \
--port 7860然后在浏览器中打开 http://localhost:7860。
| 参数 | 默认值 | 描述 |
|---|---|---|
--model_path | $HIDREAM_MODEL_PATH | 检查点目录的路径(HiDream-O1-Image 或 HiDream-O1-Image-Dev)。 |
--model_type | full | full(50 步)或 dev(28 步)。 |
--host | 0.0.0.0 | Flask 服务器的绑定地址。 |
--port | 7860 | Flask 服务器的端口。 |
上述所有四个 CLI 参数也可以通过环境变量进行设置(参见 .env.example):HIDREAM_MODEL_PATH、HIDREAM_MODEL_TYPE、HIDREAM_HOST 和 HIDREAM_PORT。
Web 演示中的 Prompt Agent 面板会从 .env 读取其他环境变量:
| 环境变量 | 使用者 | 描述 |
|---|---|---|
HIDREAM_AGENT_MODEL | 本地 · Gemma 后端 | 本地 Gemma 权重的路径或 HF 仓库 ID。 |
OPENAI_BASE_URL | OpenAI 兼容 API 后端 | UI 中预填充的默认基础 URL。 |
OPENAI_API_KEY | OpenAI 兼容 API 后端 | UI 中预填充的默认 API 密钥。 |
OPENAI_MODEL | OpenAI 兼容 API 后端 | UI 中预填充的默认模型名称。 |
侧边栏包含一个 Prompt Agent 面板,该面板调用与 prompt_agent.py 相同的推理驱动型 Prompt Agent。选择 OpenAI 兼容 API 后端(任何端点、密钥和模型名称)或 本地 · Gemma 后端(在 .env 或环境中设置 HIDREAM_AGENT_MODEL,指向本地 Gemma-4-31B-it 权重)。
当服务器以 --model_type dev 启动时,编辑 选项卡会显示一个 调度器 下拉菜单,包含两个选项:flow_match(默认)和 flash。对于 full 模型以及“文本→图像”/“主体”选项卡,此选择器会隐藏,因为这些情况下调度器是固定的。
本仓库中的代码以及 HiDream-O1-Image 模型均采用 MIT 许可证。
@article{hidreamolimage,
title={HiDream-O1-Image: A Natively Unified Image Generative Foundation Model with Pixel-level Unified Transformer},
author={Cai, Qi and Chen, Jingwen and Gao, Chengmin and Gong, Zijian and Li, Yehao and Mei, Tao and Pan, Yingwei and Peng, Yi and Qiu, Zhaofan and Yao, Ting and Yu, Kai and Zhang, Yiheng and others},
journal={arXiv preprint arXiv:2605.11061},
year={2026}
}