Views
No views yet
Cosmos3OmniTransformer.1# Verify the checkpoint loads correctly
2python load_checkpoint.py --verify
3
4# Generate a single frame (smoke test)
5python load_checkpoint.py \
6 --prompt "A robotic arm in a kitchen" \
7 --steps 8 --frames 1
8
9# Generate a multi-frame video (quality)
10python load_checkpoint.py \
11 --prompt "A robotic arm in a kitchen" \
12 --steps 35 --frames 57 \
13 --height 480 --width 640transformer/
config.json # Cosmos3OmniTransformer config (action_gen=False)
diffusion_pytorch_model.safetensors # FP8 weights + blockwise scales (~18.8 GB)
modelopt_state.pt # Structural sidecar (~670 KB, quantizer topology)
quantization_config.json # Recipe, block size, scale layout documentation
quantizer_map_diff.json # INV-2 validation result
load_checkpoint.py # Standalone loader
README.md # This filemodelopt_state.pt sidecar contains only the quantizer structure (which modules have quantizers, their configs). It does NOT contain model weights. It uses pickle format (weights_only=False on load) and should only be trusted from this locally-produced checkpoint.1import torch, glob
2import modelopt.torch.opt as mto
3from diffusers import Cosmos3OmniPipeline, Cosmos3OmniTransformer, UniPCMultistepScheduler
4from safetensors.torch import load_file
5
6CKPT = "dist/Cosmos3-Nano-FP8-Blockwise"
7
8# 1. Build skeleton
9cfg = {**Cosmos3OmniTransformer.load_config(f"{CKPT}/transformer/config.json"), "action_gen": False}
10transformer = Cosmos3OmniTransformer.from_config(cfg).to(torch.bfloat16)
11
12# 2. Restore quantizer structure from sidecar
13state = torch.load(f"{CKPT}/transformer/modelopt_state.pt", weights_only=False)
14restored = mto.restore_from_modelopt_state(transformer, state)
15if restored:
16 transformer = restored
17
18# 3. Load weights + scales from safetensors
19tensors = {}
20for shard in sorted(glob.glob(f"{CKPT}/transformer/*.safetensors")):
21 tensors.update(load_file(shard))
22transformer.load_state_dict(tensors, strict=True)
23
24# 4. Build pipeline
25pipe = Cosmos3OmniPipeline.from_pretrained(
26 CKPT, transformer=transformer, torch_dtype=torch.bfloat16, enable_safety_checker=False
27)
28pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=10.0)
29pipe = pipe.to("cuda")
30
31# 5. Generate under autocast
32with torch.autocast("cuda", torch.bfloat16):
33 result = pipe(prompt="...", num_frames=57, height=480, width=640, num_inference_steps=35,
34 generator=torch.Generator("cpu").manual_seed(123))| Case | Improved? | LPIPS Delta |
|---|---|---|
| EC-01 (t2v) | No | -0.056 |
| EC-02 (sound/MoE) | Yes | +0.069 |
| EC-03 (i2v) | Yes | +0.010 |
| EC-05 (hard) | Yes | +0.029 |
| EC-06 (OOD) | Yes | +0.025 |
docs/reports/phase_2_quality_report.md for the full comparison.UniPCMultistepScheduler(flow_shift=10.0)CUBLAS_WORKSPACE_CONFIG=:4096:8torch.autocast("cuda", torch.bfloat16)"cpu" (not "cuda")