stable-diffusion.cpp/docs/models/moss_image.md
Wagner Bruna 2c678bcfe9
feat: support for MOSS-Image edit LoRAs (#2203)
Co-authored-by: leejet <leejet714@gmail.com>
2026-11-23 01:05:20 +08:00

7.5 KiB

MOSS-Image

MOSS-Image uses a 5B diffusion transformer, the FLUX.2 VAE, and Qwen3.5 9B as the LLM text encoder. Both Base and SFT are supported. Prompt enhancement is not included. Image editing requires a matching LoRA.

Model files

Component Weights and downloads CLI option Requirement
MOSS-Image Base or SFT Safetensors
gguf:
Base: Download
SFT: Download
--diffusion-model Required
vae Safetensors --vae Use matching VAE
Qwen3.5 9B GGUF --llm Use matching text encoder
tokenizer.json Download --tokenizer Required; match text encoder
Qwen3.5 9B vision projector GGUF --llm_vision Required for vision inputs when the encoder uses separate vision weights
MOSS-Image-Edit-HQ LoRA armV5-moss-edit-lora.safetensors --lora-model-dir HQ editing with SFT
chinoll Moss-Image-Edit LoRA adapter_model.safetensors — Editing with Base or SFT in DGL

Pass the external tokenizer.json with --tokenizer; Qwen3.5 uses a different vocabulary from the embedded Qwen tokenizer.

Inline prompt images require Qwen3.5 vision weights. HQ editing also uses them when available. Pass a separate projector with --llm_vision in the CLI or vision_path on load_text_encoder in DGL.

Usage

Web UI

Follow the Web UI guide to start the server, then select the recipe matching your weights. Fill the component slots below and click Load models. Use the files and compatibility requirements in Model files.

Recipe Component slots
MOSS Image Base (moss-image-base) diffusion_model, llm, tokenizer, vae, tae
MOSS Image SFT (moss-image-sft) diffusion_model, llm, tokenizer, vae, tae

Slot IDs correspond to CLI component options: diffusion_model uses --diffusion-model, llm uses --llm, and model uses -m / --model. Select optional components when required by your checkpoint or task.

DGL

Example Description
Base: text to image MOSS-Image Base.
SFT: text to image MOSS-Image SFT.
Inline images Insert named images into the prompt.
Image editing (HQ) SFT with the armV5 LoRA and a Qwen3.5 vision projector.
Image editing (chinoll) Base or SFT with the chinoll LoRA.

Run a script

Edit paths, prompts and settings in the script's var block, then run from the build directory. Paths inside the script resolve from the working directory.

Windows (PowerShell)

.\bin\Release\sd-cli.exe -M dgl --script ..\docs\dgl\moss_image\moss-image-base-txt2img.dgl

Linux/macOS

./bin/sd-cli -M dgl --script ../docs/dgl/moss_image/moss-image-base-txt2img.dgl

Choose another script from the table to run a different task. Add --check to validate syntax and types without loading weights. See the shared run instructions for build paths and the server's file-access rules.

Legacy CLI

CLI examples use the shared path and shell conventions.

MOSS-Image Base

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\moss_image_base_int8_convrot_attn.safetensors `
  --llm ..\models\text_encoders\Qwen3.5-9B-Q4_K_M.gguf `
  --vae ..\models\vae\flux2_ae.safetensors `
  --tokenizer ..\models\tokenizers\tokenizer_qwen3.5.json `
  -p "a lovely cat holding a sign says 'moss-image.cpp'" `
  --cfg-scale 3.0 `
  -H 1024 `
  -W 1024 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/moss_image_base_int8_convrot_attn.safetensors \
  --llm ../models/text_encoders/Qwen3.5-9B-Q4_K_M.gguf \
  --vae ../models/vae/flux2_ae.safetensors \
  --tokenizer ../models/tokenizers/tokenizer_qwen3.5.json \
  -p "a lovely cat holding a sign says 'moss-image.cpp'" \
  --cfg-scale 3.0 \
  -H 1024 \
  -W 1024 \
  --offload-to-cpu \
  -v

MOSS-Image SFT

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\moss_image_sft_int8_convrot_attn.safetensors `
  --llm ..\models\text_encoders\Qwen3.5-9B-Q4_K_M.gguf `
  --vae ..\models\vae\flux2_ae.safetensors `
  --tokenizer ..\models\tokenizers\tokenizer_qwen3.5.json `
  -p "a lovely cat holding a sign says 'moss-image.cpp'" `
  --cfg-scale 3.0 `
  -H 1024 `
  -W 1024 `
  --offload-to-cpu `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/moss_image_sft_int8_convrot_attn.safetensors \
  --llm ../models/text_encoders/Qwen3.5-9B-Q4_K_M.gguf \
  --vae ../models/vae/flux2_ae.safetensors \
  --tokenizer ../models/tokenizers/tokenizer_qwen3.5.json \
  -p "a lovely cat holding a sign says 'moss-image.cpp'" \
  --cfg-scale 3.0 \
  -H 1024 \
  -W 1024 \
  --offload-to-cpu \
  -v

MOSS-Image Edit

The CLI uses the HQ workflow with SFT. Save the LoRA as models/loras/moss/armV5-moss-edit-lora.safetensors or adjust the LoRA tag below. Pass -r for each reference image.

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  --diffusion-model ..\models\diffusion_models\moss_image_sft_int8_convrot_attn.safetensors `
  --llm ..\models\text_encoders\Qwen3.5-9B-Q4_K_M.gguf `
  --llm_vision ..\models\text_encoders\Qwen3.5-9B-mmproj-BF16.gguf `
  --vae ..\models\vae\flux2_ae.safetensors `
  --tokenizer ..\models\tokenizers\tokenizer_qwen3.5.json `
  --lora-model-dir ..\models\loras `
  -r ..\assets\flux\flux1-dev-q8_0.png `
  -p "change 'flux.cpp' to 'moss.cpp'<lora:moss/armV5-moss-edit-lora:1.0>" `
  --cfg-scale 3.0 `
  -v

Linux/macOS

./bin/sd-cli \
  --diffusion-model ../models/diffusion_models/moss_image_sft_int8_convrot_attn.safetensors \
  --llm ../models/text_encoders/Qwen3.5-9B-Q4_K_M.gguf \
  --llm_vision ../models/text_encoders/Qwen3.5-9B-mmproj-BF16.gguf \
  --vae ../models/vae/flux2_ae.safetensors \
  --tokenizer ../models/tokenizers/tokenizer_qwen3.5.json \
  --lora-model-dir ../models/loras \
  -r ../assets/flux/flux1-dev-q8_0.png \
  -p "change 'flux.cpp' to 'moss.cpp'<lora:moss/armV5-moss-edit-lora:1.0>" \
  --cfg-scale 3.0 \
  -v

Notes and limitations

Use output dimensions divisible by 16. The editing examples cap the reference long edge at 1024 pixels. The discrete scheduler defaults to a flow shift of 5. Use --flow-shift to override it. Prompt weights use (phrase:1.2) syntax.

For text-to-image and HQ editing, the CLI and C API set skip_layers = [22] on the negative predictor. The corresponding DGL examples set the same zero-based layer index.