Text-to-Image
Diffusers
English
Polish
quantization
torchao
diffusion-transformer
moss-image-sft
fp8wo
Instructions to use WiktorMatuszek/MOSS-Image-SFT-FP8-WO-Core with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use WiktorMatuszek/MOSS-Image-SFT-FP8-WO-Core with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("WiktorMatuszek/MOSS-Image-SFT-FP8-WO-Core", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
File size: 3,149 Bytes
9f3f38f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/usr/bin/env python3
"""Strict immutable provenance gates for interchangeable MOSS-SFT components.
The combined pipeline always uses original OpenMOSS MOSS-Image-SFT architecture,
tokenizer, scheduler and sampler. Component paths are local staged weight folders
and must have a matching complete source-revision receipt; never select a model
based only on a filename, a loose remote branch, or an unrelated Qwen version.
"""
from pathlib import Path
import hashlib
import json
import torch
REV="fc5de0d56fc910cbca6f6625a70f5f582b26deb1"
def sha(path):
h=hashlib.sha256()
with Path(path).open("rb") as f:
for piece in iter(lambda:f.read(4*1024*1024),b""):
h.update(piece)
return h.hexdigest()
def inspect_qwen(root,verify_sha=True):
root=Path(root).resolve()
manifest=root/"COMPLETE_ENCODER.json"
if not manifest.is_file():raise RuntimeError("Missing full encoder export receipt")
m=json.loads(manifest.read_text())
if (m.get("status")!="COMPLETE_RELOADED_REAL_TORCHAO_FP8WO_ENCODER"
or m.get("source_revision")!=REV or m.get("converted_linear_weights")!=248
or m.get("qwen_text_encoder_stored_shards")!=4
or m.get("quantization")!="Float8WeightOnlyConfig"):
raise RuntimeError("Not the validated original-Qwen3.5 FP8 weight-only encoder")
enc=root/"text_encoder"
assert_file=enc/"config.json"
if not assert_file.is_file() or sha(assert_file)!=m["config_sha256"]:
raise RuntimeError("Encoder architecture config changed")
total=0
for x in m["shards"]:
p=enc/x["file"]
if not p.is_file() or p.stat().st_size!=x["bytes"]:
raise RuntimeError("Incomplete stored Qwen FP8WO shard: "+x["file"])
if verify_sha and sha(p)!=x["sha256"]:
raise RuntimeError("Encoder stored shard SHA-256 mismatch: "+x["file"])
total+=x["bytes"]
if total!=m["total_text_encoder_bytes"]:
raise RuntimeError("Qwen FP8WO total size mismatch")
index=json.loads((enc/"pytorch_model.bin.index.json").read_text())
if len(index["weight_map"])!=m["source_keys"]:
raise RuntimeError("Qwen weight shard index incomplete")
return m
def inspect_vae(root,verify_sha=True):
root=Path(root).resolve()
p=root/"COMPLETE_VAE.json"
if not p.is_file():raise RuntimeError("Missing VAE precision export receipt")
m=json.loads(p.read_text())
if (m.get("status")!="COMPLETE_DTYPE_CAST_FROM_PINNED_ORIGINAL"
or m.get("source_revision")!=REV or m.get("dtype") not in ("fp16","bf16")):
raise RuntimeError("Not an original Flux2 VAE precision checkpoint")
vae=root/"vae"/"diffusion_pytorch_model.safetensors"
config=root/"vae"/"config.json"
if not vae.is_file() or vae.stat().st_size!=m["output_bytes"]:
raise RuntimeError("VAE weights incomplete")
if not config.is_file() or sha(config)!=m["config_sha256"]:
raise RuntimeError("VAE config changed")
if verify_sha and sha(vae)!=m["output_sha256"]:
raise RuntimeError("VAE weights SHA-256 mismatch")
return (m,torch.float16 if m["dtype"]=="fp16" else torch.bfloat16)
|