|
Download README.md from Enhan/CHARM-H-Rec: direct link, hf CLI and curl.
- Browser
- Download file 2.42 kB
-
https://huggingface.co/Enhan/CHARM-H-Rec/resolve/main/README.md
- Command line
-
hf download hf://Enhan/CHARM-H-Rec/README.md
-
curl -L -o README.md https://huggingface.co/Enhan/CHARM-H-Rec/resolve/main/README.md
2.42 kB
| tags: | |
| - image-generation | |
| - class-conditional | |
| - autoregressive | |
| - imagenet | |
| - pytorch | |
| # CHARM-H w/ Rec. | |
| [Paper: CHARM: Compressible Hilbert Order Autoregressive Model for Image Generation](https://arxiv.org/abs/2612.03308) | |
| 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](https://huggingface.co/Enhan/CHARM-H-Rec/resolve/main/charm-h-rec-256.safetensors) | 1.64 | | |
| | 512 x 512 | [charm-h-rec-512.safetensors](https://huggingface.co/Enhan/CHARM-H-Rec/resolve/main/charm-h-rec-512.safetensors) | 1.87 | | |
| You also need the [CHARM inference code](https://huggingface.co/Enhan/CHARM-H-Rec/resolve/main/CHARM-H-inference-source.tar.gz) | |
| and the upstream [MaskGIT-f16 decoder weights](https://huggingface.co/fun-research/TiTok/blob/main/maskgit-vqgan-imagenet-f16-256.bin). | |
| 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`). | |
| ```bash | |
| 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 | |
| ```text | |
| 2bd2d8dd6af69b3e85f9f4986b1443e84d5ddf74ee00e5eb0183a692be4a6ad0 charm-h-rec-256.safetensors | |
| 6739dec67354df9c283944c38f027b1b27e2574d1654d436cbe6603f44a9a6d4 charm-h-rec-512.safetensors | |
| 424e7f2b11d1d63691ae3fbab74cf6c417ecbe0d8f86187b71f3538c7b56f6d2 maskgit-vqgan-imagenet-f16-256.bin | |
| ``` | |