Skip to content
Back to search

MOSS-Image

Official repository for MOSS-Image, a 5B-parameter base DiT model with high-quality text rendering, layout generation, and efficient fine-tuning.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/openmoss--moss-image/badge.svg)](/listings/openmoss--moss-image)

HTML

<a href="/listings/openmoss--moss-image"><img src="/api/listings/openmoss--moss-image/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

<a id="installation"></a>

🛠️ Installation

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

Apple Silicon / MPS

[Apple silicon Mac setup and limitations](docs/macos.md) · M1 Max / 32GB

<a id="python"></a>

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

<a id="gradio"></a>

🎨 Gradio

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

<a id="sampling-settings"></a>

🎛️ Sampling settings

| Setting | Default | | --- | --- | | Sampler | Flow-matching Euler | | Steps | 50 | | CFG | 3 | | Shift | 5 | | Layer skipping | Negative-branch skipping at layer 22 | | Negative prompt (Python API) | Empty |

See the [user guide](USERGUIDE.md) for sampling and prompt recommendations.

<a id="memory-and-performance"></a>

⚡ Memory and performance

Select Memory mode in Gradio's Advanced settings:

| Mode | Behavior | | --- | --- | | GPU resident | Keep the entire model on GPU | | Component | Move model components between CPU and GPU as needed | | Sequential · fallback | Lower memory use with slower inference |

If GPU memory is insufficient, select Sequential or reduce image size. Compile DiT is disabled by default and unavailable in Sequential mode.

<a id="layout-generation"></a>

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 362 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. <p>
  3. <img src="assets/lockup-light.svg#gh-light-mode-only" alt="MOSS-Image" width="520">
  4. <img src="assets/lockup-dark.svg#gh-dark-mode-only" alt="MOSS-Image" width="520">
  5. </p>
  6. <p>
  7. <a href="https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base"><img alt="Hugging Face · MOSS-Image-Base" src="https://img.shields.io/badge/🤗%20Hugging%20Face-MOSS--Image--Base-ffc107?style=flat-square"></a>
  8. &nbsp;
  9. <a href="https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT"><img alt="Hugging Face · MOSS-Image-SFT" src="https://img.shields.io/badge/🤗%20Hugging%20Face-MOSS--Image--SFT-ffc107?style=flat-square"></a>
  10. &nbsp;
  11. <a href="https://huggingface.co/Comfy-Org/MOSS-Image"><img alt="ComfyUI Models" src="https://img.shields.io/badge/ComfyUI-Models-ffc107?style=flat-square"></a>
  12. &nbsp;
  13. <a href="https://modelscope.cn/models/openmoss/MOSS-Image-Base"><img alt="ModelScope · MOSS-Image-Base" src="assets/modelscope-base-badge.svg"></a>
  14. &nbsp;
  15. <a href="https://modelscope.cn/models/openmoss/MOSS-Image-SFT"><img alt="ModelScope · MOSS-Image-SFT" src="assets/modelscope-sft-badge.svg"></a>
  16. &nbsp;
  17. <a href="https://huggingface.co/spaces/OpenMOSS-Team/MOSS-Image"><img alt="Hugging Face Spaces · Demo" src="https://img.shields.io/badge/🤗%20Spaces-Demo-4f46e5?style=flat-square"></a>
  18. &nbsp;
  19. <a href="https://platform.mosi.cn/?utm_source=github&amp;utm_medium=readme&amp;utm_campaign=imageapi"><img alt="MOSI API Platform" src="https://img.shields.io/badge/🔌%20MOSI-API%20Platform-0f766e?style=flat-square"></a>
  20. &nbsp;
  21. <a href="https://openmoss.github.io/MOSS-Image/"><img alt="Homepage" src="https://img.shields.io/badge/🌐%20Project-Homepage-2563eb?style=flat-square"></a>
  22. &nbsp;
  23. <a href="paper/MOSS_Image_Technical_Report.pdf"><img alt="Technical Report" src="https://img.shields.io/badge/📄%20Paper-Technical_Report-b31b1b?style=flat-square"></a>
  24. &nbsp;
  25. <a href="https://arxiv.org/abs/2610.23374"><img alt="arXiv: 2610.23374" src="https://img.shields.io/badge/arXiv-2610.23374-b31b1b?style=flat-square&amp;logo=arxiv&amp;logoColor=white"></a>
  26. &nbsp;
  27. <a href="https://x.com/Open_MOSS"><img alt="Follow OpenMOSS on X" src="https://img.shields.io/badge/Follow-OpenMOSS-000000?style=flat-square&amp;logo=x&amp;logoColor=white"></a>
  28. &nbsp;
  29. <a href="https://qm.qq.com/q/hphM7VhaDu"><img alt="MOSS-Image QQ 交流群:755535143" src="https://img.shields.io/badge/QQ-755535143-12B7F5?style=flat-square&amp;logo=qq&amp;logoColor=white"></a>
  30. &nbsp;
  31. <a href="https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=7a3m2007-815f-409b-9c3d-a4129f5c058e"><img alt="MOSS-Builders Feishu Community" src="assets/feishu-builders-badge.svg"></a>
  32. &nbsp;
  33. <a href="https://discord.gg/nXFWEyvbb"><img alt="MOSS-Image Discord Community" src="https://img.shields.io/badge/Discord-Community-5865F2?style=flat-square&amp;logo=discord&amp;logoColor=white"></a>
  34. </p>
  35. <p>
  36. <strong>English</strong> &nbsp; | &nbsp; <a href="README_ZH.md">简体中文</a>
  37. </p>
  38. </div>
  39. ## News
  40. - **[2026-10-20]** 🚀 The **MOSS-Image** series is now available on the [MOSI API Platform](https://platform.mosi.cn/?utm_source=github&utm_medium=readme&utm_campaign=imageapi). Try it in the Playground or integrate it through the API.
  41. - **[2026-10-19]** 📄 The [MOSS-Image Technical Report](https://arxiv.org/abs/2610.23374) is now available on arXiv. If you find our work useful, please support us with an [upvote on Hugging Face Papers](https://huggingface.co/papers/2610.23374)! 🤗
  42. - **[2026-10-18]** 🛠️ [KohakuMossTrainer](https://github.com/KohakuBlueleaf/KohakuMossTrainer) has been released, offering full fine-tuning and LyCORIS training (including LoRA) for **MOSS-Image-Base** and **MOSS-Image-SFT**. It features extensive optimizer support, mixed-precision training (BF16/FP16/FP8/MXFP8/INT8), multi-GPU training (DDP/FSDP/pipeline parallelism), optimized kernels, and CPU offloading, enabling adapter training with as little as **6GB VRAM**. It supports Windows, Linux, NVIDIA GPUs (SM70–SM120), and Intel Arc GPUs. See the [GitHub repository](https://github.com/KohakuBlueleaf/KohakuMossTrainer) for details.
  43. - **[2026-10-16]** 🚀 MOSS-Image has day-0 support in [SGLang](https://docs.sglang.io/cookbook/diffusion/OpenMOSS/MOSS-Image), [vLLM-Omni](https://recipes.vllm.ai/OpenMOSS-Team/MOSS-Image-Base), and [ComfyUI](https://huggingface.co/Comfy-Org/MOSS-Image).
  44. - **[2026-10-16]** 🎉 We are introducing **MOSS-Image-Base** and **MOSS-Image-SFT**! Code and model weights are publicly available.
  45. **Our key highlights:**
  46. - 📐 **Layout control:** Control the placement of text and visual elements.
  47. - ✍️ **Strong text rendering:** Generate clear, accurate text within images.
  48. - 📜 **Long-prompt support:** Accept text prompts of up to 4K tokens.
  49. - 🎨 **Versatile visual styles:** Create high-quality anime and photorealistic images.
  50. - 🛠️ **Easy to fine-tune:** Adapt the base model to custom tasks and domains.
  51. - ⚡ **Compact and efficient:** Efficient image generation with a 5B backbone.
  52. - 🖥️ **Heterogeneous GPU training**: Trained on alternative GPU platforms.
  53. <a id="community-projects"></a>
  54. ## Community projects
  55. - [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) now supports full fine-tuning and LoRA training for **MOSS-Image-Base** and **MOSS-Image-SFT**. See the [training documentation](https://github.com/modelscope/DiffSynth-Studio/blob/main/docs/en/Model_Details/MOSS-Image.md#model-training) and [example scripts](https://github.com/modelscope/DiffSynth-Studio/tree/main/examples/moss_image/model_training).
  56. - [MOSS-Image-SFT-DeBand](https://huggingface.co/MATLOWAI/MOSS-Image-SFT-DeBand) by **MATLOWAI** provides community LoRAs to reduce vertical color banding in **MOSS-Image-SFT**, together with ComfyUI preset workflows. See the model card for examples, settings, and the trade-offs between stripe reduction and changes to image details.
  57. - [MOSS-Image-SFT-8-steps-dmd](https://huggingface.co/lodestones/MOSS-Image-SFT-8-steps-dmd) by **lodestones** is a community 8-step DMD distillation of **MOSS-Image-SFT**, with LoRA adapters for ComfyUI. See the model card for the latest checkpoints and usage recommendations.
  58. - [MOSS-Image-FP16-fixed](https://huggingface.co/KBlueLeaf/MOSS-Image-FP16-fixed) by **KBlueLeaf** provides FP16-compatible transformer weights for **MOSS-Image-Base** and **MOSS-Image-SFT**, using residual-stream rescaling to improve overflow headroom. Diffusers and ComfyUI formats are available; see the model card for loading instructions and adapter compatibility.
  59. - [ComfyUI-Spectrum-MOSS](https://github.com/Rkkss/ComfyUI-Spectrum-MOSS) by **Rkkss** adds Spectrum-style hidden-state forecasting to accelerate MOSS-Image sampling in ComfyUI, with manual and experimental adaptive nodes. See the repository for recommended sampling settings and examples.
  60. - [mossimage.cpp](https://github.com/mossimage-cpp/mossimage.cpp) by **mossimage-cpp** is a native C++/CUDA inference engine for **MOSS-Image-Base** and **MOSS-Image-SFT**, with no PyTorch or Python at run time. It plans memory against the GPU it finds and streams the model when it does not fit. See the repository for speed, memory measurements and supported GPUs.
  61. - [moss-image-layout-editor](https://github.com/moss-image-community/moss-image-layout-editor) by **moss-image-community** is a browser-based visual editor for layout drafts: draw text, object, and character boxes on a canvas, edit their text in place, and copy a prompt compiled the same way as the prompt-enhancer skill's `compile_prompt.py` (the official test cases are ported and pass). It runs entirely in the browser and makes no generation calls; try the [live demo](https://moss-image-community.github.io/moss-image-layout-editor/).
  62. <a id="user-guide"></a>
  63. ## User guide
  64. Start with the **[English user guide](USERGUIDE.md)** or **[中文用户指南](USERGUIDE_ZH.md)**
  65. for recommended inference settings, prompt examples, layout input formats, and
  66. LoRA training guidance.
  67. <a id="comfyui"></a>
  68. ## ComfyUI
  69. MOSS-Image is supported natively in [ComfyUI](https://github.com/Comfy-Org/ComfyUI/pull/17095). Update to ComfyUI master/nightly with MOSS-Image support and install its dependencies, then use the built-in loaders with [ComfyUI-format weights](https://huggingface.co/Comfy-Org/MOSS-Image). No MOSS-Image plugin is required for this workflow.
  70. The repository plugin remains available for loading a local Hugging Face / Diffusers directory and for existing plugin workflows.
  71. [Installation and usage](comfyui/README.md) · [HF loader plugin workflow](comfyui/moss-image/example_workflows/moss-image.json)
  72. <a id="prompt-enhancer"></a>
  73. ## Prompt enhancer skill
  74. The [MOSS-Image Prompt Enhancer](skills/moss-image-prompt-enhancer/SKILL.md) turns
  75. image ideas into detailed captions or spatial Layout prompts. It is designed for
  76. GPT-6-family agents with local file and Python tools. The bundled script converts
  77. pixel-coordinate drafts into compact JSON with integer centered coordinates;
  78. it does not call an image-generation service.
  79. Install the [skill folder](skills/moss-image-prompt-enhancer) in your agent's skills
  80. directory, then invoke `$moss-image-prompt-enhancer` with your image idea, desired
  81. caption or Layout output, and any canvas dimensions. Paste the compiled result
  82. into MOSS-Image's positive prompt; for Layout, use the same generation dimensions.
  83. ![MOSS-Image-Base and MOSS-Image-SFT](assets/teaser.webp)
  84. ## Contents
  85. - [News](#news)
  86. - [Community projects](#community-projects)
  87. - [User guide](#user-guide)
  88. - [ComfyUI](#comfyui)
  89. - [Prompt enhancer skill](#prompt-enhancer)
  90. - [Models](#models)
  91. - [Quick start](#quick-start)
  92. - [Installation](#installation)
  93. - [Python](#python)
  94. - [Gradio](#gradio)
  95. - [Sampling settings](#sampling-settings)
  96. - [Memory and performance](#memory-and-performance)
  97. - [Layout-to-image generation](#layout-generation)
  98. - [Showcase](#showcase)
  99. - [Citation](#citation)
  100. - [License and acknowledgements](#license)
  101. - [Star History](#star-history)
  102. <a id="models"></a>
  103. ## 🤗 Models
  104. | Model | Description |
  105. | --- | --- |
  106. | [MOSS-Image-Base](https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base) · [ModelScope](https://modelscope.cn/models/openmoss/MOSS-Image-Base) | Base text-to-image model |
  107. | [MOSS-Image-SFT](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT) · [ModelScope](https://modelscope.cn/models/openmoss/MOSS-Image-SFT) | Fine-tuned from MOSS-Image-Base on curated data |
  108. ### Base vs. SFT
  109. In this example, SFT produces clearer text grouping and a more organized whiteboard layout.
  110. | MOSS-Image-Base | MOSS-Image-SFT |
  111. | --- | --- |
  112. | ![MOSS-Image-Base](assets/comparison/base.webp) | ![MOSS-Image-SFT](assets/comparison/sft.webp) |
  113. <!-- MOSS-Image-Base uses a 42-layer diffusion transformer, a Qwen3.5-9B text encoder,
  114. and a FLUX.2 VAE. -->
  115. <a id="quick-start"></a>
  116. ## 🚀 Quick start
  117. <a id="installation"></a>
  118. ### 🛠️ Installation
  119. ```bash
  120. git clone https://github.com/OpenMOSS/MOSS-Image.git
  121. cd MOSS-Image
  122. python -m venv .venv
  123. source .venv/bin/activate
  124. pip install -r requirements.txt
  125. ```
  126. ### Apple Silicon / MPS
  127. [Apple silicon Mac setup and limitations](docs/macos.md) · M1 Max / 32GB
  128. <a id="python"></a>
  129. ### 🐍 Python
  130. ```python
  131. import torch
  132. from diffusers import DiffusionPipeline
  133. pipe = DiffusionPipeline.from_pretrained(
  134. "OpenMOSS-Team/MOSS-Image-Base",
  135. custom_pipeline="pipeline_moss_image",
  136. trust_remote_code=True,
  137. torch_dtype={"default": torch.bfloat16, "vae": torch.float32},
  138. )
  139. pipe.scheduler = type(pipe.scheduler).from_config(pipe.scheduler.config)
  140. pipe.to("cuda")
  141. image = pipe(
  142. "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顺便带一袋面包。”",
  143. height=1456,
  144. width=1456,
  145. num_inference_steps=50,
  146. guidance_scale=3.0,
  147. uncond_skip_layers=[22],
  148. generator=torch.Generator("cpu").manual_seed(42),
  149. ).images[0]
  150. image.save("refrigerator_note.png")
  151. ```
  152. <a id="gradio"></a>
  153. ### 🎨 Gradio
  154. ```bash
  155. pip install -e '.[ui]'
  156. python gradio_app.py --model OpenMOSS-Team/MOSS-Image-Base
  157. ```
  158. <a id="sampling-settings"></a>
  159. ### 🎛️ Sampling settings
  160. | Setting | Default |
  161. | --- | --- |
  162. | Sampler | Flow-matching Euler |
  163. | Steps | 50 |
  164. | CFG | 3 |
  165. | Shift | 5 |
  166. | Layer skipping | Negative-branch skipping at layer 22 |
  167. | Negative prompt (Python API) | Empty |
  168. See the [user guide](USERGUIDE.md) for sampling and prompt recommendations.
  169. <a id="memory-and-performance"></a>
  170. ### ⚡ Memory and performance
  171. Select Memory mode in Gradio's Advanced settings:
  172. | Mode | Behavior |
  173. | --- | --- |
  174. | GPU resident | Keep the entire model on GPU |
  175. | Component | Move model components between CPU and GPU as needed |
  176. | Sequential · fallback | Lower memory use with slower inference |
  177. | Low memory | Keep DiT weights in CPU RAM; load text encoder/VAE weights from disk as needed |
  178. If GPU memory is insufficient, select Sequential or reduce image size.
  179. For lower GPU and system memory use, select the `minimal` profile (Low memory mode):
  180. ```bash
  181. python gradio_app.py --profile minimal --model OpenMOSS-Team/MOSS-Image-Base
  182. ```
  183. The `auto` profile selects `minimal` below 12 GiB of GPU budget. Keep the model files
  184. on an SSD: DiT stays in CPU RAM, while the text encoder and VAE load weights as needed.
  185. Measured peak usage for one 1024×1024 image with 50 steps:
  186. | Resource | Peak usage |
  187. | --- | --- |
  188. | PyTorch GPU memory allocated / reserved | 3.65 / 3.85 GiB |
  189. | Task system RAM, including file cache | 14.00 GiB |
  190. Compile DiT is disabled by default and unavailable in Sequential and Low memory modes.
  191. <a id="layout-generation"></a>
  192. ## 📐 Layout-to-image generation
  193. MOSS-Image uses JSON layout inputs to control text placement and object arrangement
  194. in complex text-to-image compositions. The image below was generated by MOSS-Image
  195. using layout control.
  196. Layouts can also support controlled editing and user-friendly layout tools.
  197. By editing text, element descriptions, and bounding boxes, users can adjust
  198. image content and composition in a structured way.
  199. [![Layout bounding boxes](assets/showcase/layout-bboxes.webp)](assets/showcase/layout-bboxes.svg)
  200. Paste the layout JSON into Gradio’s Prompt field to specify the scene, text,
  201. objects, and their positions. The following example uses a `summary`/`items` layout for a **1024×1024**
  202. canvas. Save it as `layout.json`:
  203. ```json
  204. {
  205. "summary": {
  206. "meta": ["poster"],
  207. "canvas": "single",
  208. "caption": "A minimalist travel poster with a cream background, a blue mountain illustration, and the title EXPLORE at the top."
  209. },
  210. "items": [
  211. {
  212. "label": "text",
  213. "caption": "Large dark-blue uppercase title centered at the top.",
  214. "text": "EXPLORE",
  215. "bbox": [-416, -384, -288, 384]
  216. },
  217. {
  218. "label": "object",
  219. "caption": "A flat blue mountain illustration in the lower center.",
  220. "bbox": [-192, -288, 384, 288]
  221. }
  222. ],
  223. "bbox_coord_space": "abs_centralized",
  224. "bbox_format": "yxyx"
  225. }
  226. ```
  227. - `summary.caption` describes the overall scene and style.
  228. - `items` describes individual elements: `label`, `caption`, and `bbox`, with
  229. `text` for the words to render.
  230. - `bbox_format: "yxyx"` specifies `[y_min, x_min, y_max, x_max]`.
  231. - `bbox_coord_space: "abs_centralized"` uses pixel coordinates relative to the
  232. canvas center. On a 1024×1024 canvas, each axis runs from −512 to +512;
  233. x increases to the right and y increases downward. For a canvas of width W
  234. and height H, subtract W/2 from ordinary x coordinates and H/2 from y coordinates.
  235. Keep the coordinates consistent with the requested output dimensions. In Gradio,
  236. paste the JSON into the prompt field and set the matching width and height. With
  237. the Python API, pass `json.dumps(layout, ensure_ascii=False)` as the prompt string.
  238. <a id="showcase"></a>
  239. ## 🖼️ Showcases
  240. ![Examples overview](assets/showcase/overview.webp)
  241. ![Examples overview 2](assets/showcase/overview2.webp)
  242. <a id="citation"></a>
  243. ## 📝 Citation
  244. If you use MOSS-Image in your research, please cite our technical report:
  245. ```bibtex
  246. @misc{ai2026mossimagetechnicalreport,
  247. title={MOSS-Image Technical Report},
  248. author={MOSI. AI},
  249. year={2026},
  250. eprint={2610.23374},
  251. archivePrefix={arXiv},
  252. primaryClass={cs.CV},
  253. url={https://arxiv.org/abs/2610.23374},
  254. }
  255. ```
  256. <a id="license"></a>
  257. ## 📄 License and acknowledgements
  258. The standalone pipeline code is provided under the [Apache License 2.0](LICENSE).
  259. We thank the Diffusers, Qwen and FLUX teams.
  260. <a id="star-history"></a>
  261. ## ⭐ Star History
  262. <a href="https://www.star-history.com/?repos=OpenMOSS%2FMOSS-Image&amp;type=date">
  263. <picture>
  264. <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=OpenMOSS/MOSS-Image&amp;type=date&amp;theme=dark" />
  265. <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=OpenMOSS/MOSS-Image&amp;type=date" />
  266. <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=OpenMOSS/MOSS-Image&amp;type=date" />
  267. </picture>
  268. </a>

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.