YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

MOSS-Image β€” EntroPack Pre-Quantized Models

We provide pre-quantized weight packages produced by EntroPack for MOSS-Image (Base and SFT, from openmoss/MOSS-Image-Base and openmoss/MOSS-Image-SFT), which can be used with the quantization features of DiffSynth-Studio. Use them with ComfyUI through DiffSynth-ComfyUI.

The packages run with as little as 4 GB of VRAM.

Base is provided at three levels, SFT additionally ships a 3.5-bit variant, and the 3.5-bit and 4.5-bit DiTs use mixed quantization. Base and SFT share the same text encoder packages:

  • 3.5bit (SFT only, lowest VRAM) β€” mixed-bit: the quantization-sensitive layers keep 5.0 bpp, while the remaining layers use 3.2516 bpp (weighted target 3.5 bpp);
  • 4.5bit (balanced) β€” mixed-bit: the quantization-sensitive layers keep 5.0 bpp, while the remaining layers use 4.4172 bpp (weighted target 4.5 bpp);
  • 6bit (highest precision) β€” uniform entropy coding at 6 bits per weight;
  • int8_6bit (fastest inference) β€” weights are first INT8 W8A8-quantized, then entropy-coded by EntroPack down to 6-bit storage; the forward pass uses INT8 GEMM, which delivers a faster inference speed than the BF16 GEMM used by the other levels.

All packages are entropy-coded from the original BF16 weights directly. Every *.safetensors ships with a same-named *.json that records its quantization config. actual bpp = 8 Γ— Ξ£ storage bytes / Ξ£ numel is measured on the package artifacts.

Preview

All previews are generated with the same prompt and seed; bf16 is the full-precision reference.

SFT

bf16 (reference) 6bit int8@6
4.5bit 3.5bit

Base

bf16 (reference) 6bit 4.5bit int8@6

DiT

SFT

name file actual bpp size
dit_3.5bit (mixed) models/MOSS-Image-SFT/dit_3.5bit.safetensors 3.526 2.24 GB
dit_4.5bit (mixed) models/MOSS-Image-SFT/dit_4.5bit.safetensors 4.545 2.89 GB
dit_6bit models/MOSS-Image-SFT/dit_6bit.safetensors 6.055 3.85 GB
dit_int8_6bit (INT8 GEMM) models/MOSS-Image-SFT/dit_int8_6bit.safetensors 6.063 3.85 GB

Base

name file actual bpp size
dit_4.5bit (mixed) models/MOSS-Image-Base/dit_4.5bit.safetensors 4.545 2.89 GB
dit_6bit models/MOSS-Image-Base/dit_6bit.safetensors 6.055 3.85 GB
dit_int8_6bit (INT8 GEMM) models/MOSS-Image-Base/dit_int8_6bit.safetensors 6.063 3.85 GB

Text Encoder

The text encoder packages are shared by Base and SFT.

name file actual bpp size
text_encoder_4.5bit models/text_encoder_4.5bit.safetensors 4.552 5.97 GB
text_encoder_6bit models/text_encoder_6bit.safetensors 6.070 7.29 GB
text_encoder_int8_6bit (INT8 GEMM) models/text_encoder_int8_6bit.safetensors 6.075 7.29 GB

Usage

Install

# DiffSynth-Studio
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio && pip install -e .

# EntroPack (pick the extra matching your CUDA version: cuda13 / cuda12)
git clone https://github.com/modelscope/entropack.git
cd entropack && pip install -e '.[cuda13]'

Example scripts

  • Inference: standard / low VRAM β€” defaults to SFT 4.5bit; switch dit_package / base_model_id together to use Base or another level
  • LoRA training: train / validation β€” defaults to SFT; replace MOSS-Image-SFT with MOSS-Image-Base in the dataset and model paths to train on Base

dit_package and text_encoder_package are chosen independently: any combination works (e.g. dit_int8_6bit with text_encoder_4.5bit). The 6-bit packages are pre-registered in DiffSynth-Studio, so they load with a plain ModelConfig; the helper below registers any package's json sidecar before loading:

import json

import torch

from diffsynth.configs import MODEL_CONFIGS
from diffsynth.pipelines.moss_image import MOSSImagePipeline, ModelConfig

prequant_model_id = "DiffSynth-Studio/MOSS-Image-EntroPack"
base_model_id = "openmoss/MOSS-Image-SFT"
dit_package = "models/MOSS-Image-SFT/dit_4.5bit.safetensors"
text_encoder_package = "models/text_encoder_4.5bit.safetensors"


def make_package(pattern):
    package = ModelConfig(model_id=prequant_model_id, origin_file_pattern=pattern)
    package.download_if_necessary()
    sidecar = ModelConfig(model_id=prequant_model_id, origin_file_pattern=pattern.replace(".safetensors", ".json"))
    sidecar.download_if_necessary()
    with open(sidecar.path) as handle:
        entry = json.load(handle)
    if not any(config.get("model_hash") == entry["model_hash"] for config in MODEL_CONFIGS):
        MODEL_CONFIGS.append(entry)
    return package


pipe = MOSSImagePipeline.from_pretrained(
    torch_dtype=torch.bfloat16,
    device="cuda",
    model_configs=[
        make_package(dit_package),
        make_package(text_encoder_package),
        ModelConfig(model_id=base_model_id, origin_file_pattern="vae/diffusion_pytorch_model.safetensors", computation_dtype=torch.float32),
    ],
    tokenizer_config=ModelConfig(model_id=base_model_id, origin_file_pattern="tokenizer/"),
)

image = pipe(
    prompt="a cat sitting on a windowsill",
    height=1024, width=1024,
    seed=42, num_inference_steps=50, cfg_scale=3.0,
)
image.save("image.jpg")
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support