CHARM-H-Rec / README.md
Enhan's picture
Link the CHARM paper and remove sign-in instructions for public downloads
f5cc865 verified
|
Raw History Blame Contribute Delete
2.42 kB
metadata
tags:
  - image-generation
  - class-conditional
  - autoregressive
  - imagenet
  - pytorch

CHARM-H w/ Rec.

Paper: CHARM: Compressible Hilbert Order Autoregressive Model for Image Generation

Class-conditional ImageNet generation with CHARM-H in fixed Hilbert order and recursive KV cache compression. Choose the generator for the output resolution:

Output Generator ImageNet FID
256 x 256 charm-h-rec-256.safetensors 1.64
512 x 512 charm-h-rec-512.safetensors 1.87

You also need the CHARM inference code and the upstream MaskGIT-f16 decoder weights. Both resolutions use this same decoder, including the 512 model. It is not included in the generator weights. No ImageNet data or training code is required.

Generate an image

Install PyTorch for your hardware and the Hugging Face CLI (hf).

hf download Enhan/CHARM-H-Rec CHARM-H-inference-source.tar.gz --local-dir .
tar -xzf CHARM-H-inference-source.tar.gz
python -m pip install ./charm-inference

# Set RES=512 instead to generate a 512 x 512 image.
RES=256
hf download Enhan/CHARM-H-Rec "charm-h-rec-${RES}.safetensors" --local-dir weights
hf download fun-research/TiTok maskgit-vqgan-imagenet-f16-256.bin --local-dir weights

python -m charm --model "charm-h-rec-${RES}" \
  --weights "weights/charm-h-rec-${RES}.safetensors" \
  --decoder weights/maskgit-vqgan-imagenet-f16-256.bin \
  --class-id 88 --seed 42 --output "samples/${RES}"

The example writes an RGB PNG. Class IDs range from 0 to 999. The CLI defaults to CUDA and chooses a backend automatically. For CPU inference, add --device cpu --backend sdpa. See the inference package README for sampling options and attribution.

SHA-256

2bd2d8dd6af69b3e85f9f4986b1443e84d5ddf74ee00e5eb0183a692be4a6ad0  charm-h-rec-256.safetensors
6739dec67354df9c283944c38f027b1b27e2574d1654d436cbe6603f44a9a6d4  charm-h-rec-512.safetensors
424e7f2b11d1d63691ae3fbab74cf6c417ecbe0d8f86187b71f3538c7b56f6d2  maskgit-vqgan-imagenet-f16-256.bin