--- license: other license_name: s-lab-license-1.0 license_link: LICENSE library_name: pytorch pipeline_tag: image-to-image base_model: wusize/Harmon-0_5B tags: - harmon - masked-autoregressive - unified-multimodal - component-extraction --- # Harmon-0.5B complete visual MAR and VAE components All **684 trained non-language tensor entries** selected from the [official fixed Harmon-0.5B checkpoint](https://huggingface.co/wusize/Harmon-0_5B/tree/481ab555997c222ca2794020ed4ad57e33b2707d): `mar.*`, `vae.*`, `proj_in.*`, and `proj_out.*`. The VAE, shared MAR encoder, masked decoder, learned positions/buffer, diffusion prediction/sampling head and both language-space projections are retained. Original tensor names, dtypes and values are preserved. The Qwen language model is excluded. Install `requirements.txt` in a dedicated environment. The native timm blocks are tested with `timm==1.0.8`. ```python from huggingface_hub import snapshot_download import sys, torch folder = snapshot_download('gatilin/harmon_0_5b_visual_mar_codec') sys.path.insert(0, folder) from component import load_model visual = load_model(folder) rgb = torch.zeros(1, 3, 64, 64) # RGB NCHW in [-1, 1] with torch.inference_mode(): z = visual.encode(rgb) # [B,H/16,W/16,16], native VAE mode * 0.2325 reconstruction = visual.decode(z) tokens = z.flatten(1, 2) mask = torch.zeros(tokens.shape[:2]) features = visual.mar.forward_mae_encoder( tokens, mask, visual.mar.fake_latent, image_shape=z.shape[1:3]) ``` The native VAE scaling factor is **0.2325**. `decode` preserves caller input while retaining the original arithmetic. MAR's native masks, learned buffer/positions and diffusion head remain directly accessible. `proj_in` maps MAR features to the 896-dimensional language space; `proj_out` maps language hidden states back. Complete language-conditioned generation requires the trained Qwen backbone, original buffer reordering and masked generation schedule; this package is not a standalone text-to-image model. `validation.json` records **18 passed CPU float32 checks**: all source tensor hashes, strict loading, native scale, square and rectangular VAE encode/decode, finite reconstructions, masked MAR encoder/decoder geometry, both projections, diffusion prediction/variance outputs, the original 100-step sampling head and classifier-free-guidance sampling. Sampling covers two token conditions, not a complete image-quality or VQA benchmark. Re-run with `python validate.py`. Native files come from the pinned official HF repository, with their URLs and original hashes in `code_provenance.json`. The documented portability changes allocate sampling noise and timestep tensors on the input device instead of hardcoded CUDA. Native sampler equations and probability distributions are unchanged. The excluded full-model file remains a source reference. **Non-commercial terms:** the official model card and project specify **S-Lab License 1.0**, reproduced in `LICENSE`; retain its conditions and disclaimer. This is not an Apache/MIT weight release. Original component attributions and licenses are retained separately where applicable. Source-range mapping, per-tensor SHA-256 and executed validation are included; the selected safetensors are an extraction, not the original full checkpoint file.