Clone the repository, install the documented dependencies, and run the base model's Python inference path to generate an image with the default 50-step Euler sampler. The output will show whether MOSS-Image's text rendering and layout control meet your needs before you commit resources to LoRA training.
What MOSS-Image lets you test
MOSS-Image-Base accepts natural-language prompts, tag sequences, and JSON layout inputs. Natural-language prompts support English (the primary training language), Chinese, and other languages; you can embed line breaks to guide text placement. Tag sequences follow a recommended order: Quality → Score → Meta → Year → Character → Series → Artist → General. JSON layouts let you specify a scene caption, individual text and object descriptions, and bounding boxes in absolute pixel coordinates centered on the canvas.
The base model has not been distilled or post-trained for inference parameters; it preserves the full training signal to simplify community LoRA work. The supervised fine-tuned variant (MOSS-Image-SFT) produces clearer text grouping and more organized layouts in the team's published examples.
Check the prerequisites and output constraints
You need Python 3.10 or later, an NVIDIA GPU with CUDA support, and a PyTorch 2.9 or later build compatible with your CUDA environment. The model card lists diffusers>=0.38, transformers>=5.3, accelerate>=1.10, safetensors>=0.6, and Pillow>=10 as the required packages.
The model recommends outputs with 1M, 1.5M, or 2M total pixels and can extrapolate from 0.25M (512×512) to 4M (2K). Image dimensions must be positive multiples of 16; invalid dimensions raise an error. The default settings use 50 inference steps, CFG 3.0, shift 5.0, the Euler sampler, and negative-branch skipping at zero-indexed layer 22.
Generate a baseline image with Python
Clone the repository and create a virtual environment:
git clone https://github.com/OpenMOSS/MOSS-Image.git
cd MOSS-Image
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtSave the documented inference script to test_moss.py:
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")Run the script:
python test_moss.pyThe model and custom pipeline code download automatically and are cached. The transformer and text encoder use bfloat16; the VAE and initial noise use float32. The bundled VAE uses the FLUX.2 small decoder.
Probe text rendering
The model can render text and insert line breaks automatically, but the result may not always match your expectations. To improve text accuracy or control line breaks precisely, insert \n or actual line breaks directly into the prompt—the refrigerator example above demonstrates this technique.
For short prompts the documentation recommends increasing CFG above the default 3.0. Long prompts of up to 4K tokens are supported; a value of 3.0 is generally sufficient for these. The recommended negative tags are nsfw, worst quality, bad anatomy, watermark, jpeg artifact.
Probe composition with JSON layout input
Pass a JSON layout as the prompt to control text placement and object arrangement. Save this script to test_layout.py:
import json
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")
layout = {
"summary": {
"meta": ["product card"],
"canvas": "single",
"caption": "A clean product card on white background with a headline at top-left, price label at bottom-left, and product area on the right."
},
"items": [
{
"label": "text",
"caption": "Bold black headline in sans-serif.",
"text": "Premium Wireless\nHeadphones",
"bbox": [-600, -400, -400, 100]
},
{
"label": "text",
"caption": "Large price in dark gray.",
"text": "$299",
"bbox": [400, -400, 550, -150]
},
{
"label": "object",
"caption": "Product photo of headphones centered on right half.",
"bbox": [-400, 50, 400, 450]
}
],
"bbox_coord_space": "abs_centralized",
"bbox_format": "yxyx"
}
image = pipe(
json.dumps(layout, ensure_ascii=False),
width=1024,
height=1456,
num_inference_steps=50,
guidance_scale=3.0,
uncond_skip_layers=[22],
generator=torch.Generator("cpu").manual_seed(100),
).images[0]
image.save("product_card.png")Run the script:
python test_layout.pysummary.caption describes the overall scene and style. items holds each element's label ("text" or "object"), caption, and bbox; for text elements include text with the words to render. bbox_format: "yxyx" specifies [y_min, x_min, y_max, x_max]. This layout targets a 1024-pixel-wide by 1456-pixel-tall canvas. On that canvas, x runs from −512 to +512 and y runs from −728 to +728. For a canvas of width W and height H, subtract W/2 from ordinary x coordinates and H/2 from y coordinates.
Keep the coordinates consistent with the requested output dimensions. With the Python API, pass json.dumps(layout, ensure_ascii=False) as the prompt string and set matching width and height parameters.
Build your own comparison rubric
The sources do not establish text-rendering or layout quality against independent benchmarks and do not provide a documented evaluation rubric. You can build your own comparison by specifying expected text and placement, generating images under identical settings (steps, CFG, shift, seed), and recording which elements appear correctly. Choose a failure threshold for your project—for example, if fewer than two of three headline characters are readable, mark that prompt as failed.
Observe the post-training constraint
If post-training MOSS-Image-Base yourself, keep the text encoder frozen—do not fine-tune it.
Understand what the sources omit
The user guide provides a captioning prompt and VLM recommendations (Gemma 4, Qwen 3.5 27B, or Qwen 3.5 35B-A3B) but does not provide a complete LoRA training procedure, dataset requirements, or compute costs.
FAQ
Can I use MOSS-Image commercially?
Yes. The model weights and bundled inference code are released under the Apache License 2.0, which permits commercial use, modification, and distribution. You must preserve copyright and license notices, mark modified files, and include a copy of the license with any redistributed Work or Derivative Works.
Which interface should I use for repeated evaluations?
The repository includes a Gradio interface. Install with pip install -e '.[ ui]', then run python gradio_app.py --model OpenMOSS-Team/MOSS-Image-Base. Gradio offers memory-mode controls (GPU resident, Component, or Sequential offload) and makes it easier to paste JSON layouts and adjust sampling settings without editing code.
How do I disable negative-branch skipping?
Pass uncond_skip_layers=[] to the pipe call. This removes the documented layer-22 skipping and uses both branches at every layer.
Generate at least three images per prompt
Use different seed values to identify consistent rendering patterns and judge whether layout deviations are acceptable for your use case.
Verification status: Supported by official documentation only under the conditions below; not reproduced in a test environment by IGPROD. Checked 2026-10-20.
Applies to: Python 3.10.
Conditions:
- The documented Python quick start requires Python 3.10 or later, a CUDA-capable NVIDIA GPU, and a compatible PyTorch 2.9 or later build.
- Python API image dimensions must be positive multiples of 16.
- JSON layout coordinates must match the requested output dimensions.
- The user guide recommends keeping the text encoder frozen when post-training MOSS-Image-Base.
Related guides
- gpu-unlock for Nvidia 3000-series GPUs: more FP16/BF16 throughput on the card you fine-tune on.
Sources: