File size: 2,053 Bytes
4919e39
 
d302357
 
 
 
 
 
 
4919e39
d302357
 
 
 
 
 
 
3098ff9
d302357
 
 
 
 
 
 
 
 
 
 
 
 
3098ff9
d302357
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3098ff9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
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.