MOSS-Image-Base 与 SFT
MOSS-Image-Base 是基础文生图模型,MOSS-Image-SFT 基于精选数据由 MOSS-Image-Base 微调而来。
它是什么 · 主要能力 · 怎么上手
它是什么
MOSS-Image-Base 是基础文生图模型。MOSS-Image-SFT 基于精选数据由 MOSS-Image-Base 微调而来。独立流水线代码按 Apache License 2.0 提供。
核心信息
以下信息由程序从官方接口读取,不经模型改写。
- 许可证
- Apache-2.0
- 语言
- Python
- 维护方
- OpenMOSS
- 核验日期
主要能力
布局控制被列为用于控制文字和视觉元素的摆放位置。
项目 README 列出支持最多 4K 个 token 的文本提示词。
MOSS-Image 使用 JSON 布局输入来控制文字位置和物体排布。
在 README 的一个示例中,SFT 生成的文字分组更清晰,白板版面也更有条理。
ComfyUI 原生支持 MOSS-Image。
在 ComfyUI 中,需要更新到带有 MOSS-Image 支持的 ComfyUI master/nightly 并安装其依赖,然后使用内置加载器加载 ComfyUI 格式权重。
这套 ComfyUI 流程不需要 MOSS-Image 插件。
MOSS-Image Prompt Enhancer 把图像想法转成详细的描述文字,或带空间信息的 Layout 提示词。
它面向带有本地文件和 Python 工具的 GPT-6 系列智能体。
Prompt Enhancer 附带的脚本把像素坐标草稿转换成紧凑的 JSON,其中使用整数的居中坐标。
这个附带脚本不调用图像生成服务。
项目的英文用户指南和中文用户指南是了解推荐推理设置、提示词示例、布局输入格式和 LoRA 训练指引的起点。
mossimage.cpp由 mossimage-cpp 提供,是面向 MOSS-Image-Base 和 MOSS-Image-SFT 的原生 C++/CUDA 推理引擎,运行时没有 PyTorch 或 Python。mossimage.cpp会根据它找到的 GPU 规划内存,在模型放不下时以流式方式加载模型。速度、内存测量和支持的 GPU 见
mossimage.cpp仓库;该引擎运行时没有 PyTorch 或 Python。
怎么上手
采样设置中,Steps 列为 50。
在 Gradio 的 Advanced settings 中可以选择 Memory mode。
GPU resident 模式把整个模型保留在 GPU 上。
Component 模式按需在 CPU 和 GPU 之间移动模型组件。
README 把 Sequential 模式标为 fallback,并描述为内存占用更低、推理更慢。
Low memory 模式把 DiT 权重保留在 CPU 内存中,按需从磁盘加载文本编码器和 VAE 的权重。
如果 GPU 内存不足,可以选择 Sequential 或减小图像尺寸。
auto配置在 GPU 预算低于 12 GiB 时选择minimal。Compile DiT 默认禁用,在 Sequential 和 Low memory 模式下不可用。
README 报告了生成一张 1024×1024 图像、50 步时测得的峰值占用。
在该测量中,PyTorch GPU 显存的 allocated / reserved 为 3.65 / 3.85 GiB。
布局示例中,
summary.caption字段描述整体场景和风格。items字段描述各个元素:label、caption和bbox,其中text给出要渲染的文字。bbox_format设为 yxyx 时,指定的顺序是 [y_min, x_min, y_max, x_max]。bbox_coord_space设为 abs_centralized 时,使用相对于画布中心的像素坐标。在 1024×1024 的画布上,每个坐标轴从 −512 延伸到 +512。
沿这些坐标轴,x 向右增大,y 向下增大。
坐标应与所请求的输出尺寸保持一致。
在 Gradio 中,把 JSON 粘贴到提示词字段,并设置相匹配的宽度和高度。
git clone https://github.com/OpenMOSS/MOSS-Image.git
cd MOSS-Image
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtimport 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")
image = pipe(
"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:“\n记得买牛奶和鸡蛋!\n牛奶两盒,鸡蛋一打。\n顺便带一袋面包。”",
height=1456,
width=1456,
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")pip install -e '.[ui]'
python gradio_app.py --model OpenMOSS-Team/MOSS-Image-Basepython gradio_app.py --profile minimal --model OpenMOSS-Team/MOSS-Image-Base{
"summary": {
"meta": ["poster"],
"canvas": "single",
"caption": "A minimalist travel poster with a cream background, a blue mountain illustration, and the title EXPLORE at the top."
},
"items": [
{
"label": "text",
"caption": "Large dark-blue uppercase title centered at the top.",
"text": "EXPLORE",
"bbox": [-416, -384, -288, 384]
},
{
"label": "object",
"caption": "A flat blue mountain illustration in the lower center.",
"bbox": [-192, -288, 384, 288]
}
],
"bbox_coord_space": "abs_centralized",
"bbox_format": "yxyx"
}来源
本页内容整理自以下官方来源,点击可核对原文。
- GitHub READMEhttps://github.com/OpenMOSS/MOSS-Image抓取于
核验日期 ·
本页由 AI 依据上述官方来源整理,并经自动核对,未经本站实测。 发现错误?告诉我们。
