dmvae / README.md
Davidwang215's picture
Add d32 64ep LightningDiT inference weights and sampling option
3098ff9 verified
|
Raw History Blame Contribute Delete
2.05 kB
---
license: apache-2.0
library_name: pytorch
pipeline_tag: unconditional-image-generation
tags:
- image-generation
- vae
- diffusion
- safetensors
---
# DM-VAE inference weights
Matched ImageNet-256 DM-VAE tokenizers and LightningDiT-XL/1 generators.
| Variant | VAE | LightningDiT |
| --- | --- | --- |
| f16d32 | [50ep](vae/dmvae-f16d32-50ep.safetensors) | [64ep](lightningdit/lightningdit-f16d32-64ep.safetensors), [400ep](lightningdit/lightningdit-f16d32-400ep.safetensors) |
| f16d64 | [50ep](vae/dmvae-f16d64-50ep.safetensors) | [400ep](lightningdit/lightningdit-f16d64-400ep.safetensors) |
Use each generator with the tokenizer and channel normalization in its matching `configs/d32.json` or `configs/d64.json`. Weights retain their original tensor precision.
## Inference
Install the [DM-VAE inference code](https://github.com/ustcchx/DM-VAE) and download this repository:
```bash
git clone https://github.com/ustcchx/DM-VAE.git
cd DM-VAE
python -m pip install -e ".[hub]" safetensors
hf download Davidwang215/dmvae --local-dir weights/dmvae
python weights/dmvae/inference.py --variant d32 --dit-epochs 64 --classes 207 --device cuda --precision bf16 --output samples/d32-64ep
python weights/dmvae/inference.py --variant d32 --classes 207 --device cuda --precision bf16 --output samples/d32
python weights/dmvae/inference.py --variant d64 --classes 207 --device cuda --precision bf16 --output samples/d64
```
The loader verifies the SHA-256 of both weight files and loads each architecture strictly. The JSON files provide the matching architecture and latent-channel statistics. `inference.py` supports IG_TS sampling and optional interval CFG with `--cfg`.
For direct use in Python:
```python
import sys
import torch
sys.path.insert(0, "weights/dmvae")
from inference import load_pair
vae, dit, means, scales = load_pair("weights/dmvae", "d32", "cuda", torch.bfloat16)
```
Select the f16d32 64ep generator with `--dit-epochs 64`. The default is 400ep. Both f16d32 generators use the same f16d32 50ep VAE and channel normalization.