HuggingFace镜像/MOSS-Image-Base-GGUF
模型介绍
文件和版本
分析

这是 OpenMOSS 发布的 51 亿参数文生图 Transformer 模型 MOSS-Image-Base 的 GGUF 量化版本。
unsloth/MOSS-Image-Base-GGUF 采用 Unsloth Dynamic 2.0 方法:UD- 文件使用混合精度,每层的量化类型基于实测敏感度扫描和图像生成过程中采集的重要性矩阵来确定。

  • 支持在 Unsloth Studio 以及包含 MOSS-Image 支持的 stable-diffusion.cpp(master-975 或更新版本)中运行,兼容 CPU、Mac 和 GPU。
  • 这些文件仅包含 Transformer 部分。VAE 和 tokenizer 未做修改,请从 unsloth/MOSS-Image-Base-FP8 中获取(该仓库完整保留了上游 diffusers 的目录结构)。文本编码器可直接使用 unsloth/Qwen3.5-9B-GGUF 中的 Qwen3.5-9B-Q8_0.gguf。

推荐: 对于大多数机器,MOSS-Image-Base-UD-Q4_K_XL.gguf(3.42 GB)是最佳选择:LPIPS 为 0.179,而 Q4_K_M 为 0.293。若希望输出更接近 bf16 精度,可使用 UD-Q5_K_XL(0.138)或 UD-Q6_K_XL(0.102);Q8_0(0.081)最为接近。在 CUDA GPU 上,Unsloth Studio 默认使用 unsloth/MOSS-Image-Base-FP8 中的 INT8-ConvRot 文件(LPIPS 0.096)。

UD-Q4_K_XLQ8_0

在 Unsloth Studio 中使用

在 Images 选项卡中选择 MOSS-Image-Base,然后从本仓库中选择一个 GGUF 文件。Unsloth Studio 会调用其内置的 stable-diffusion.cpp 引擎来运行 MOSS-Image 的 GGUF 模型,并自动为你下载 VAE、tokenizer 以及 Qwen3.5-9B 文本编码器。默认参数:1024x1024、50 步、CFG 3、shift 5。

配合 stable-diffusion.cpp 使用

hf download unsloth/MOSS-Image-Base-GGUF MOSS-Image-Base-UD-Q4_K_XL.gguf --local-dir moss
hf download unsloth/Qwen3.5-9B-GGUF Qwen3.5-9B-Q8_0.gguf --local-dir moss
hf download unsloth/MOSS-Image-Base-FP8 vae/diffusion_pytorch_model.safetensors tokenizer/tokenizer.json --local-dir moss

./sd-cli --diffusion-model moss/MOSS-Image-Base-UD-Q4_K_XL.gguf \
  --llm moss/Qwen3.5-9B-Q8_0.gguf \
  --vae moss/vae/diffusion_pytorch_model.safetensors \
  --tokenizer moss/tokenizer/tokenizer.json \
  --cfg-scale 3.0 --steps 50 -H 1024 -W 1024 -s 42 \
  -p "a storefront sign that says \"UNSLOTH\" in bold clean letters, daytime, sharp focus" -o moss.png

文件与精度

以 bf16 变换器为基准,使用 LPIPS(alex,越低越好)和 SSIM 进行评估:相同的提示词、随机种子、初始噪声和 bf16 文本嵌入,分辨率 1024x1024,50 步推理,CFG 值为 3,共 12 条提示词(8 条通用提示词加 4 条留出集:一张特写人像、一块带文字的门面招牌、一双手正在折纸、一段较长的场景描述)。相同 bf16 推理重复生成的结果得分为 0。MOSS-Image 对微小的数值变化非常敏感:仅改变某一层中单个 bf16 舍入步骤,就会导致生成结果的 LPIPS 平均变化 0.053 到 0.063,因此接近该量级的差异属于构图偏移,而非质量损失。本表中的 GGUF 权重已反量化至参考推理管线中,因此该数据仅反映权重本身的差异。

文件大小每权重位数LPIPS vs bf16(均值)LPIPS vs bf16(最大值)SSIM vs bf16
MOSS-Image-Base-UD-Q3_K_XL.gguf2.84 GB4.470.2800.4360.736
MOSS-Image-Base-Q4_K_M.gguf3.20 GB5.040.2930.4150.731
MOSS-Image-Base-UD-Q4_K_XL.gguf3.42 GB5.380.1790.4180.826
MOSS-Image-Base-UD-Q5_K_XL.gguf3.95 GB6.220.1380.4270.863
MOSS-Image-Base-UD-Q6_K_XL.gguf4.53 GB7.130.1020.3390.889
MOSS-Image-Base-Q8_0.gguf5.48 GB8.630.0810.3770.917
MOSS-Image-Base-BF16.gguf10.17 GB16.000.0000.0001.000

MOSS-Image-Base

MOSS-Image-Base and MOSS-Image-SFT

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

Base 与 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 small 解码器。

关于 Gradio 界面、CPU 卸载及编译选项,请参考项目快速上手指南。 如需使用 ComfyUI,请在 ComfyUI Manager 中搜索 MOSS-Image 以安装原生插件。该插件正在整合至 ComfyUI 官方仓库中。 详见安装与使用指南及示例工作流。

采样参数

参数默认值
采样器Flow-matching Euler
步数50
CFG3
Shift5
层跳过负向分支,层索引 22(从零开始)
负向提示词空

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

有关分辨率、采样、提示词及 LoRA 训练的建议,请参阅用户指南。

布局转图像生成

传入 JSON 格式布局作为提示词,即可描述场景、渲染文本、物体及其位置。布局使用 summary.caption 和 items 字段,bbox_format: "yxyx",bbox_coord_space: "abs_centralized"。

通过 Python API 时,使用 json.dumps(layout, ensure_ascii=False) 序列化布局并传入 pipe。在 Gradio 中,将 JSON 粘贴到提示词输入框中,并设置对应的图像尺寸。 详见布局格式与示例。

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

布局控制

效果展示

示例概览

示例概览 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 团队。