欢迎来到 LLaDA-Image 官方仓库,这是一个用于高质量图像生成与编辑的统一模型。
具备自然光照、逼真细节与连贯场景的写实图像生成。
跨多种视觉风格的高质量文本渲染与创意海报生成。
指令驱动的图像编辑,在忠实保留内容的基础上实现精准视觉修改。
LLaDA-Image 是一个具备竞争力的 60 亿参数开源统一图像生成与编辑模型家族。它包括 LLaDA-Image——用于高质量文生图与指令引导编辑的 50 步 Base 模型,以及 LLaDA-Image-Turbo——用于快速生成与编辑的 4 步蒸馏模型。两种变体均支持实用级文生图、VQ 条件生成、参考图编辑以及中英文文字渲染。
本仓库提供 LLaDA-Image 模型家族的模型权重以及基于 Diffusers 的推理代码。
| 模型 | 描述 | 采样步数 | Hugging Face(模型权重) | ModelScope(模型权重) |
|---|---|---|---|---|
| LLaDA-Image | 用于高保真文生图与指令引导编辑的基础模型。 | 50 | BF16: inclusionAI/LLaDA-Image FP8: inclusionAI/LLaDA-Image-FP8 | BF16: inclusionAI/LLaDA-Image FP8: inclusionAI/LLaDA-Image-FP8 |
| LLaDA-Image-Turbo | 用于快速生成与编辑的蒸馏模型。 | 4 | BF16: inclusionAI/LLaDA-Image-Turbo FP8: inclusionAI/LLaDA-Image-Turbo-FP8 | BF16: inclusionAI/LLaDA-Image-Turbo FP8: inclusionAI/LLaDA-Image-Turbo-FP8 |
该实现适用于 Python 3.11、PyTorch 2.8、Transformers 4.57.6 和 Diffusers 0.39.0。
git clone https://github.com/inclusionAI/LLaDA-Image.git
cd LLaDA-Image
conda create -n llada-image python=3.11 -y
conda activate llada-image
pip install -r requirements.txt该流水线可接收提示词,编辑时还可传入一个可选的参考图像。
请使用 Base 检查点进行高保真生成与编辑。其推荐采样配置为 50 步。
import torch
from src import LLaDAImagePipeline
# Load the pipeline. The model is downloaded from Hugging Face on first use.
pipe = LLaDAImagePipeline.from_pretrained(
"inclusionAI/LLaDA-Image",
torch_dtype=torch.bfloat16,
device="cuda",
)
# Generate an image.
prompt = (
"A cinematic photograph of a red fox standing in fresh snow, "
"soft winter light, detailed fur, shallow depth of field"
)
negative_prompt = ""
image = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
generation_mode="text",
height=1024,
width=1024,
num_inference_steps=50,
guidance_scale=5.0,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("llada-image-base.png")使用 Turbo 检查点进行快速生成和编辑。其推荐的采样配置为 4 步。
[!NOTE] 在 LLaDA-Image-Turbo 推理过程中,可以尝试将
scheduler/scheduler_config.json中的stochastic_sampling设置为false,在某些情况下可能获得更清晰的细节。
import torch
from src import LLaDAImagePipeline
# Load the distilled Turbo checkpoint.
pipe = LLaDAImagePipeline.from_pretrained(
"inclusionAI/LLaDA-Image-Turbo",
torch_dtype=torch.bfloat16,
device="cuda",
)
prompt = "A quiet observatory above a sea of clouds at sunrise, golden light, wide-angle photograph"
image = pipe(
prompt=prompt,
generation_mode="text",
height=1024,
width=1024,
num_inference_steps=4,
guidance_scale=1.0,
generator=torch.Generator("cuda").manual_seed(42),
).images[0]
image.save("llada-image-turbo.png")两个检查点均支持以下模式。文本生成和 VQ 条件生成要求高度与宽度均可被 16 整除;图像编辑要求尺寸可被 32 整除。
VQ 条件生成 会使用 LLaDA2 模型根据提示词生成图像 VQ tokens,随后由 SigVQ 在扩散前进行嵌入。请勿在 VQ 模式下提供输入图像。
image = pipe(
prompt="A quiet observatory above a sea of clouds at sunrise",
generation_mode="vq",
height=1024,
width=1024,
num_inference_steps=50, # Use 4 for LLaDA-Image-Turbo.
guidance_scale=5.0, # Use 1.0 for few-step inference.
generator=torch.Generator("cuda").manual_seed(42),
).images[0]图像编辑需要一张参考图像:
from diffusers.utils import load_image
reference_image = load_image("/path/to/input.png")
image = pipe(
prompt="Turn it into a watercolor painting",
image=reference_image,
generation_mode="editing",
height=1024,
width=1024,
num_inference_steps=50, # Use 4 for LLaDA-Image-Turbo.
guidance_scale=5.0, # Use 1.0 for few-step inference.
generator=torch.Generator("cuda").manual_seed(43),
).images[0]如果你在研究或应用中发现 LLaDA-Image 有帮助,请考虑引用我们的工作。
@article{LLaDAImage,
title = {LLaDA-Image: Building Strong Image Generators with Fully Open Training Recipes},
author = {Chuyan Chen and Haoxing Chen and Kun Chen and Zhenglin Cheng and Long Cui and Ruishan Fang and Zhangxuan Gu and Zhicheng Huang and Zhenzhong Lan and Yuanting Lei and Haoquan Li and Jianguo Li and Rongchuan Li and Sidu Li and Tao Lin and Deyuan Liu and Jiacheng Liu and Lin Liu and Yuxuan Lou and Zhisheng Lu and Yuxin Ma and Shuheng Shen and Peng Sun and Chaoyang Wang and Hongjun Wang and Xiaomei Wang and Yongxin Wang and Chengzhang Wu and Hongru Wu and Jun Xie},
journal = {arXiv preprint arXiv:2609.03796},
year = {2026}
}