OpenMOSS/MOSS-Image-Base
模型介绍
文件和版本
Pull Requests
讨论
分析

MOSS-Image-Base

MOSS-Image MOSS-Image

Hugging Face · MOSS-Image-Base   Hugging Face · MOSS-Image-SFT   ModelScope · MOSS-Image-Base   ModelScope · MOSS-Image-SFT   GitHub   Hugging Face Spaces · 演示   MOSI API 平台   项目主页   技术报告   arXiv: 2610.23374   在 X 上关注 OpenMOSS   MOSS-Image QQ 交流群:755535143   MOSS-Builders 飞书社区   MOSS-Image Discord 社区

用户指南   ·   中文用户指南   ·   ComfyUI

MOSS-Image-Base and MOSS-Image-SFT

MOSS-Image-Base 是 OpenMOSS 旗下 MOSS-Image 系列中的基础文生图模型。它支持自然语言提示词、标签序列以及 JSON 布局,用于控制文字排版与物体布局。

Base vs. SFT

在本示例中,SFT 产生了更清晰的文本分组和更有序的白板布局。

MOSS-Image-BaseMOSS-Image-SFT
MOSS-Image-BaseMOSS-Image-SFT

快速开始

使用 Python 3.10 或更高版本,以及支持 CUDA 的 NVIDIA GPU。安装与你 CUDA 环境兼容的 PyTorch 2.9 或更高版本,然后执行以下安装:

pip install "diffusers>=0.38" "transformers>=5.3" "accelerate>=1.10" "safetensors>=0.6" "Pillow>=10"
import torch
from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(
    "OpenMOSS-Team/MOSS-Image-Base",
    custom_pipeline="pipeline_moss_image",
    trust_remote_code=True,
    torch_dtype={"default": torch.bfloat16, "vae": torch.float32},
)
pipe.scheduler = type(pipe.scheduler).from_config(pipe.scheduler.config)
pipe.to("cuda")

prompt = '''A wide view of a refrigerator beside a kitchen counter with a fruit bowl. A small sticky note on the refrigerator door is handwritten in Chinese:
"记得买牛奶和鸡蛋!
牛奶两盒,鸡蛋一打。
顺便带一袋面包。"'''

image = pipe(
    prompt,
    height=1024,
    width=1024,
    num_inference_steps=50,
    guidance_scale=3.0,
    uncond_skip_layers=[22],
    generator=torch.Generator("cpu").manual_seed(42),
).images[0]
image.save("refrigerator_note.png")

模型和自定义流水线代码会自动下载并缓存。你也可以将完整的本地模型目录传入 from_pretrained。 Transformer 和文本编码器使用 bfloat16;VAE 和初始噪声使用 float32。内置的 VAE 采用 FLUX.2 小型解码器。

关于 Gradio 界面、CPU 卸载和编译选项,请参阅项目快速入门。 对于 ComfyUI,在 ComfyUI Manager 中搜索 MOSS-Image 即可安装原生插件。官方 ComfyUI 仓库的集成工作正在进行中。 参阅安装与使用指南 和示例工作流。

采样设置

设置默认值
采样器Flow-matching Euler
步数50
CFG3
偏移5
层跳过负向分支,层索引 22(从零起计)
负向提示词空

默认引导策略每步执行两次 Transformer 前向传播。传入 uncond_skip_layers=[] 可禁用负向分支跳过,或设置 negative_prompt 以提供负向提示词。Python API 的图像尺寸必须是 16 的正整数倍。

参阅用户指南 获取分辨率、采样、提示词及 LoRA 训练方面的建议。

提示词增强技能

MOSS-Image 提示词增强器可将 图像构思转化为详细的描述文本或空间 Layout 提示词。它专为具备本地文件和 Python 工具能力的 GPT-6 系列智能体设计。内置脚本可将像素坐标草稿转换为包含整数居中坐标的紧凑 JSON 格式; 该脚本不会调用图像生成服务。

将技能文件夹安装到智能体的 skills 目录中,然后调用 $moss-image-prompt-enhancer,提供你的图像构思、期望的 caption 或 Layout 输出以及画布尺寸。将编译后的结果 粘贴到 MOSS-Image 的正向提示词中;对于 Layout 输出,请使用相同的生成尺寸。

布局到图像生成

传入一个 JSON 布局作为提示词,用于描述场景、渲染文本、对象及其位置。布局使用 summary.caption 和 items,其中 bbox_format: "yxyx" 且 bbox_coord_space: "abs_centralized"。

在 Python API 中,使用 json.dumps(layout, ensure_ascii=False) 序列化布局,并将其传递给 pipe。在 Gradio 中,将 JSON 粘贴到 Prompt 字段,并设置对应的图像尺寸。 请参阅 布局格式与示例。

布局还支持受控编辑和用户友好的布局工具。通过编辑文本、元素描述和边界框,可以以结构化的方式调整图像内容与构图。

Layout control

展示

Examples overview

Examples overview 2

引用

@misc{ai2026mossimagetechnicalreport,
      title={MOSS-Image Technical Report},
      author={MOSI. AI},
      year={2026},
      eprint={2610.23374},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2610.23374},
}

许可证与致谢

模型权重及附带的推理代码基于 Apache License, Version 2.0 发布。

感谢 Diffusers、Qwen 和 FLUX 团队。