商业产业 Hacker News AI 2026-10-17T01:57 正文 ok 835 words

MOSS-Image:具备原生布局控制的文生图模型

英文标题:🔶 Moss-Image: Text-to-Image Generation with Native Layout Control

OpenMOSS 发布 MOSS-Image-Base,并提供代码与模型权重;该系列包括基础模型及基于精选数据微调的 MOSS-Image-SFT。模型采用 50 亿参数骨干网络,支持最长 4K token 提示词、文本渲染、动漫与写实风格生成,以及通过 JSON 描述对象、文字和边界框的原生布局控制。模型权重采用 Apache-2.0 许可,并通过统一的 Diffusers Python 管线和 Gradio 界面提供推理能力。对于开发者而言,MOSS-Image 提供了可用于结构化海报、信息图和受控视觉设计生成的开源布局到图像工作流。
打开原文相关 3 · 机会 0
media3.0 KB media9.6 KB media428.1 KB media2.5 KB media5.4 KB media1.1 MB media4.4 MB media831.3 KB media99.6 KB media149.2 KB

中文

MOSS-Image

MOSS-Image:具备原生布局控制的文生图

OpenMOSS 团队

MOSS-Image-Base 和 MOSS-Image-SFT 预览图

MOSS-Image 是 OpenMOSS 推出的文生图模型系列,包括基础模型和经过精选数据微调的模型。除自然语言提示词外,MOSS-Image 还支持原生的文本驱动布局生成:可在 JSON 提示词中指定对象、渲染文字及其空间位置。该系列结合了紧凑的 50 亿参数骨干网络、最长 4K token 的提示词、出色的文本渲染能力,以及多样化的动漫与写实风格。Python 和 Gradio 接口共用同一套 Diffusers 管线。

新闻

2026 年 10 月 16 日 —— 正式推出 MOSS-Image-Base,代码和模型权重现已可用。

支持布局控制、强大的文本渲染、最长 4K token 的提示词、动漫与写实风格,并配备专为高效生成和微调设计的 50 亿参数骨干网络。训练使用异构 GPU 平台。

特性

文生图生成

通过统一的推理接口,使用 MOSS-Image-Base 或 MOSS-Image-SFT 根据自然语言描述生成图像。

原生布局控制

使用结构化 JSON 提示词指定场景、其中的对象和文字。边界框用于描述各个元素的位置和尺寸。

紧凑且可适配的骨干网络

50 亿参数骨干网络支持最长 4K token 的提示词,并支持针对自定义任务和领域进行微调。模型权重采用 Apache-2.0 许可。

展示案例

文字、插画、摄影和视觉设计,均按照项目展示案例的方式编排。打开任一图像即可查看其完整分辨率。

布局到图像生成

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

MOSS-Image 通过与文生图相同的提示词接口接收布局规范。下方生成结果展示了布局控制能力;随后给出的 JSON 示例描述了一张包含标题和山脉插画的旅行海报。

带标注边界框的生成布局控制示例 项目 README 中的布局控制结果。打开图示可查看矢量标注。

输入布局 1024 × 1024

−512 +512

文字 EXPLORE

对象 蓝色山脉插画

边界框可视化 · 仅为输入规范

结构化提示词 复制 JSON

{
  "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"
}

坐标遵循 [y_min, x_min, y_max, x_max] 格式,以相对于画布中心的像素为单位。该图示展示的是输入布局,而非模型生成结果。运行此布局示例。

将上方 JSON 粘贴到 Gradio 的 Prompt 字段中,并将宽度和高度设为 1024。使用下方 Python 管线时,加载 JSON 并将其作为提示词传入:

import json
from pathlib import Path

layout = json.loads(Path("layout.json").read_text())
image = pipe(
    json.dumps(layout, ensure_ascii=False),
    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("layout.png")

模型

这两个检查点共享相同的架构和采样接口。

权重:Apache-2.0。管线代码和第三方组件保留各自的许可证。

Base 与 SFT 对比

在这一示例中,SFT 可生成更清晰的文本分组和更有条理的白板布局。

MOSS-Image-Base 由 MOSS-Image-Base 生成的白板 MOSS-Image-SFT 由 MOSS-Image-SFT 生成的白板

快速开始

使用 Python 3.10+ 和 NVIDIA GPU。在独立的 Python 环境中,先安装与 CUDA 环境兼容的 PyTorch 版本,然后运行:

安装 复制命令

git clone https://github.com/OpenMOSS/MOSS-Image.git
cd MOSS-Image
python -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt

Python · Diffusers 复制 Python

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")
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")

有关提示词、布局输入和 LoRA 训练指引,请参阅英文用户指南或中文用户指南。

在本地运行 Gradio

pip install -e '.[ui]'
python gradio_app.py --model OpenMOSS-Team/MOSS-Image-Base

高级设置提供 GPU 常驻、Component 和 Sequential 内存模式。如果内存不足,请选择 Sequential 模式或降低图像尺寸。默认禁用 Compile DiT,且 Sequential 模式下无法使用该功能。

推荐采样设置

采样器 Flow-matching Euler

步数 / CFG / shift 50 / 3 / 5

层跳过 在第 22 层跳过负向分支

负面提示词 Python API 中保持为空

提示词增强器

借助 MOSS-Image Prompt Enhancer skill,可将图像创意转化为详细描述或空间布局提示词。该工具专为具备本地文件和 Python 工具的 GPT-6 系列 Agent 设计。

附带的脚本可将像素坐标草稿转换为使用整数中心坐标的紧凑 JSON。它会准备提示词,但不会调用图像生成服务。

  1. 在 Agent 的 skills 目录中安装skill 文件夹。
  2. 使用图像创意、描述文本或 Layout 输出需求,以及画布尺寸,调用 $moss-image-prompt-enhancer。
  3. 将编译结果粘贴至 MOSS-Image 的正向提示词中。对于 Layout 提示词,请使用与草稿相同的生成尺寸。

Prompt Enhancer 使用说明 ↗

引用

如果你在研究中使用 MOSS-Image,请引用该项目仓库。

BibTeX 复制引用

@misc{mossimage2026,
  title = {MOSS-Image},
  author = {{OpenMOSS Team}},
  year = {2026},
  howpublished = {\url{https://github.com/OpenMOSS/MOSS-Image}}
}

English / 原文

MOSS-Image

MOSS-Image: Text-to-Image Generation

with Native Layout Control

OpenMOSS Team

MOSS-Image-Base and MOSS-Image-SFT teaser

MOSS-Image is a text-to-image model family from OpenMOSS, comprising a base model and a curated-data fine-tuned model. In addition to natural-language prompts, MOSS-Image supports native text-driven layout generation: objects, rendered text, and their spatial positions can be specified in a JSON prompt. The family combines a compact 5B backbone, prompts of up to 4K tokens, strong text rendering, and versatile anime and photorealistic styles. Python and Gradio interfaces use a shared Diffusers pipeline.

News

October 16, 2026 — Introducing MOSS-Image-Base , with code and model weights available.

Layout control, strong text rendering, prompts of up to 4K tokens, anime and photorealistic styles, and a 5B backbone designed for efficient generation and fine-tuning. Training uses heterogeneous GPU platforms.

Features

Text-to-Image Generation

Generate images from natural-language descriptions with MOSS-Image-Base or MOSS-Image-SFT, using a shared inference interface.

Native Layout Control

Specify a scene, its objects, and text with a structured JSON prompt. Bounding boxes describe the position and size of individual elements.

Compact, Adaptable Backbone

A 5B backbone supports prompts of up to 4K tokens and fine-tuning for custom tasks and domains. Model weights are licensed under Apache-2.0.

Showcases

Text, illustration, photography and visual design, composed as in the project showcase. Open either image to explore it at full resolution.

Layout-to-Image Generation

Layouts also support controlled editing and user-friendly layout tools. Edit text, element descriptions and bounding boxes to adjust image content and composition in a structured way.

MOSS-Image accepts layout specifications through the same prompt interface used for text-to-image generation. The generated result below illustrates layout control; the JSON example that follows describes a travel poster with a title and a mountain illustration.

Generated layout-control example with annotated bounding boxes Layout-control result from the project README. Open the figure for the vector annotations.

Input layout1024 × 1024

−512+512

textEXPLORE

objectBlue mountain
illustration

Bounding-box visualization · input specification only

Structured promptCopy JSON

{
  "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"
}

Coordinates follow [y_min, x_min, y_max, x_max] and are measured in pixels relative to the canvas center. The diagram visualizes the input layout, not a model-generated result. Run this layout example

Paste the JSON above into Gradio’s Prompt field and set width and height to 1024. With the Python pipeline below, load the JSON and pass it as the prompt:

import json
from pathlib import Path

layout = json.loads(Path("layout.json").read_text())
image = pipe(
    json.dumps(layout, ensure_ascii=False),
    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("layout.png")

Models

The two checkpoints share the same architecture and sampling interface.

Weights: Apache-2.0. The pipeline code and third-party components retain their respective licenses.

Base vs. SFT

In this example, SFT produces clearer text grouping and a more organized whiteboard layout.

MOSS-Image-BaseWhiteboard generated by MOSS-Image-Base MOSS-Image-SFTWhiteboard generated by MOSS-Image-SFT

Quick Start

Use Python 3.10+ and an NVIDIA GPU. In a dedicated Python environment, install a PyTorch build compatible with your CUDA environment, then run:

InstallationCopy commands

git clone https://github.com/OpenMOSS/MOSS-Image.git
cd MOSS-Image
python -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt

Python · DiffusersCopy Python

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")
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")

For prompts, layout inputs and LoRA training guidance, see the English user guide or 中文用户指南.

Run Gradio locally

pip install -e '.[ui]'
python gradio_app.py --model OpenMOSS-Team/MOSS-Image-Base

Advanced settings offer GPU resident, Component, and Sequential memory modes. If memory is insufficient, select Sequential or reduce image size. Compile DiT is disabled by default and unavailable in Sequential mode.

Recommended sampling settings

Sampler Flow-matching Euler

Steps / CFG / shift 50 / 3 / 5

Layer skipping Negative-branch skipping at layer 22

Negative prompt Empty in the Python API

Prompt Enhancer

Turn image ideas into detailed captions or spatial Layout prompts with the MOSS-Image Prompt Enhancer skill, designed for GPT-6-family agents with local file and Python tools.

The bundled script converts pixel-coordinate drafts into compact JSON with integer centered coordinates. It prepares prompts without calling an image-generation service.

  1. Install the skill folder in your agent’s skills directory.
  2. Invoke $moss-image-prompt-enhancer with your image idea, caption or Layout output requirements, and canvas dimensions.
  3. Paste the compiled result into MOSS-Image’s positive prompt. For Layout prompts, use the same generation dimensions as the draft.

Prompt Enhancer instructions ↗

Citation

If you use MOSS-Image in your research, please cite the project repository.

BibTeXCopy citation

@misc{mossimage2026,
  title = {MOSS-Image},
  author = {{OpenMOSS Team}},
  year = {2026},
  howpublished = {\url{https://github.com/OpenMOSS/MOSS-Image}}
}