b-rosel 9r4n4y commited on
Commit
f563015
·
0 Parent(s):

Duplicate from 9r4n4y/PiD_upscaler_image_restoration_tutorial_video

Browse files

Co-authored-by: official <9r4n4y@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ figures/teaser.jpg filter=lfs diff=lfs merge=lfs -text
37
+ tutorial.webm filter=lfs diff=lfs merge=lfs -text
38
+ tutorial.mp4 filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ tags:
4
+ - super-resolution
5
+ - diffusion
6
+ - pixel-diffusion-decoder
7
+ - vae-decoder
8
+ pipeline_tag: image-to-image
9
+ base_model:
10
+ - nvidia/PixelDiT-1300M-1024px
11
+ - Tongyi-MAI/Z-Image
12
+ - black-forest-labs/FLUX.1-dev
13
+ - black-forest-labs/FLUX.2-dev
14
+ - nyu-visionx/Scale-RAE-Qwen7B_DiT9.8B
15
+ ---
16
+
17
+ # PiD — Pixel Diffusion Decoder
18
+
19
+ # tutorial video
20
+
21
+ <video controls autoplay muted loop width="100%">
22
+ <source src="https://huggingface.co/9r4n4y/PiD_upscaler_image_restoration_tutorial_video/resolve/main/tutorial.mp4" type="video/webm">
23
+ Your browser does not support the video tag.
24
+ </video>
25
+
26
+ ---
27
+
28
+ <p align="center">
29
+ <img src="figures/teaser.jpg" alt="PiD teaser" width="100%">
30
+ </p>
31
+
32
+
33
+ **[Paper](https://arxiv.org/abs/2605.23902), [Project Page](https://research.nvidia.com/labs/sil/projects/pid/)**
34
+
35
+ [Yifan Lu](https://yifanlu0227.github.io/),
36
+ [Qi Wu](https://wilsoncernwq.github.io/),
37
+ [Jay Zhangjie Wu](https://zhangjiewu.github.io/),
38
+ [Zian Wang](https://www.cs.toronto.edu/~zianwang/),
39
+ [Huan Ling](https://www.cs.toronto.edu/~linghuan/),
40
+ [Sanja Fidler](https://www.cs.utoronto.ca/~fidler/),
41
+ [Xuanchi Ren](https://xuanchiren.com/) <br>
42
+
43
+
44
+ PiD reformulates the latent-to-pixel decoder as a conditional pixel-space
45
+ diffusion model, unifying decoding and upsampling into a single generative
46
+ module. It denoises directly in high-resolution pixel space and produces a
47
+ super-resolved image in one pass. This repository hosts the released decoder
48
+ checkpoints, plus the encoder/decoder ("VAE") weights they depend on.
49
+
50
+ All `PiD_*` checkpoints in this repo are **4-step distilled**. The non-`PiD_*`
51
+ entries (`ae.safetensors`, `flux2_ae.safetensors`, `sd3_vae/`, `rae/`,
52
+ `scale_rae/`) are **the corresponding encoder/decoder VAE weights** that PiD
53
+ plugs into — they're not PiD checkpoints themselves.
54
+
55
+ ### License/Terms of Use
56
+
57
+ This model is released under the [NSCLv1](https://huggingface.co/nvidia/PixelDiT-1300M-1024px/blob/main/LICENSE) License. The work and any derivative works may only be used for non-commercial (research or evaluation) purposes.
58
+
59
+ ### Deployment Geography:
60
+ Global
61
+
62
+ ## PiD checkpoints
63
+
64
+ Two variants are released for each diffusers-style backbone:
65
+
66
+ - **`2k`** — trained at 2048px, used as a 4× decoder (512 LDM → 2048 px), or as
67
+ an 8× decoder for the Scale-RAE backbone (256 → 2048).
68
+ - **`2kto4k`** — trained with multi-resolution data bucketing 2048→3840 and an
69
+ SD3-style dynamic shift; designed for 1024 LDM → 4K (4096 px) decoding.
70
+
71
+ Both checkpoint variants support multiple aspect ratios.
72
+
73
+ | Path | Backbone (encoder side) | SR factor | Variant |
74
+ |---------------------------------------------------------------|--------------------------------------------|-----------|-----------|
75
+ | `checkpoints/PiD_res2k_sr4x_official_flux_distill_4step` | Flux1-dev (16-ch VAE) | 4× | 2k |
76
+ | `checkpoints/PiD_res2k_sr4x_official_flux2_distill_4step` | Flux2-dev (128-ch BN VAE) | 4× | 2k |
77
+ | `checkpoints/PiD_res2k_sr4x_official_sd3_distill_4step` | SD3 medium (16-ch VAE) | 4× | 2k |
78
+ | `checkpoints/PiD_res2k_sr4x_official_dinov2_distill_4step` | DINOv2-B + RAE ViT-XL (768-ch) | 4× | 2k |
79
+ | `checkpoints/PiD_res2k_sr8x_official_siglip_distill_4step` | SigLIP-2 So400M + Scale-RAE ViT-XL (1152) | 8× | 2k |
80
+ | `checkpoints/PiD_res2kto4k_sr4x_official_flux_distill_4step` | Flux1-dev (16-ch VAE) | 4× | 2kto4k |
81
+ | `checkpoints/PiD_res2kto4k_sr4x_official_flux2_distill_4step` | Flux2-dev (128-ch BN VAE) | 4× | 2kto4k |
82
+ | `checkpoints/PiD_res2kto4k_sr4x_official_sd3_distill_4step` | SD3 medium (16-ch VAE) | 4× | 2kto4k |
83
+
84
+ Z-Image shares Flux1's VAE, so its inference path reuses the `flux` checkpoints
85
+ (both `2k` and `2kto4k`) — no separate `zimage` checkpoint is shipped.
86
+
87
+ Each directory contains a single file, `model_ema_bf16.pth`, which is the EMA
88
+ weights cast to bfloat16 — the format the inference scripts load by default.
89
+
90
+ ## VAE / encoder weights
91
+
92
+ These are the per-backbone encoder (and, where applicable, original decoder)
93
+ weights that PiD pairs with. They're hosted here so a single download brings
94
+ everything needed end-to-end.
95
+
96
+ | Path | Description |
97
+ |---------------------------------|--------------------------------------------------------------------------------------|
98
+ | `checkpoints/ae.safetensors` | Flux1-dev / Z-Image 16-ch VAE (encoder + original Flux decoder). |
99
+ | `checkpoints/flux2_ae.safetensors` | Flux2-dev 128-ch BN VAE. |
100
+ | `checkpoints/sd3_vae/` | SD3 medium 16-ch VAE in diffusers format. |
101
+ | `checkpoints/rae/` | DINOv2-B image encoder + RAE ViT-XL decoder + ImageNet-512 normalization statistics. |
102
+ | `checkpoints/scale_rae/` | SigLIP-2 So400M encoder + Scale-RAE ViT-XL decoder + decoder config. |
103
+
104
+ ## Usage
105
+
106
+ The decoder checkpoints are loaded by the inference scripts in the [PiD
107
+ codebase](https://github.com/nv-tlabs/pid). The exact `(backbone, ckpt_type) → path` mapping is the single source
108
+ of truth in
109
+ [`pid/_src/inference/checkpoint_registry.py`](https://github.com/nv-tlabs/PiD/blob/main/pid/_src/inference/checkpoint_registry.py) — clone the
110
+ repo, point it at this snapshot, and the demos pick the right file
111
+ automatically:
112
+
113
+ ```bash
114
+ # Pull just the checkpoints/ tree into the repo root (skips this README and
115
+ # the teaser figure so they don't clobber the files in the source repo).
116
+ hf download nvidia/PiD --local-dir . --include "checkpoints/*"
117
+
118
+ # Then run any of the demos, e.g.:
119
+ PYTHONPATH=. python -m pid._src.inference.from_ldm_flux \
120
+ --prompt "A photorealistic cat" \
121
+ --ldm_inference_steps 28 --save_xt_steps 22 24 26 \
122
+ --output_dir ./results/demo \
123
+ --cfg_scale 1 --pid_inference_steps 4 --scale 4
124
+ ```
125
+
126
+ Pick the `2kto4k` variant via `--pid_ckpt_type 2kto4k` when decoding at 4K.
127
+
128
+ ## Citation
129
+ ```
130
+ @article{lu2026pid,
131
+ title={PiD: Fast and High-Resolution Latent Decoding with Pixel Diffusion},
132
+ author={Lu, Yifan and Wu, Qi and Wu, Jay Zhangjie and Wang, Zian and Ling, Huan and Fidler, Sanja and Ren, Xuanchi},
133
+ journal={arXiv preprint arXiv:2605.23902},
134
+ year={2026}
135
+ }
136
+ ```
checkpoints/PiD_res2k_sr4x_official_dinov2_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4ce25b6fd2c953720468cd88a7c6a192b4ce908bf085659a1324c186949eab0
3
+ size 2731773393
checkpoints/PiD_res2k_sr4x_official_flux2_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0e3a7a19d4738e0b53c1267815a87e77295fddbee117b5aed802b9b62030cac
3
+ size 2725875153
checkpoints/PiD_res2k_sr4x_official_flux_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47dd165bf3ea85df08deb152e6fcded19ddf5a35b83832abcd99d403ffca6ac3
3
+ size 2724842961
checkpoints/PiD_res2k_sr4x_official_sd3_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:835a069763903bfee317e524b83d0974639a6c1d9f79e00728d338fcc249fa27
3
+ size 2724842961
checkpoints/PiD_res2k_sr8x_official_siglip_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9b735ca95044c9d4b5777f1a398fb30efcf4c28021622f13964ba785c33495c
3
+ size 2735312130
checkpoints/PiD_res2kto4k_sr4x_official_flux2_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca75b0b2712f0872d8225fb0c2d520f817c7185eb4a5dbedfe2d164239df044a
3
+ size 2725875153
checkpoints/PiD_res2kto4k_sr4x_official_flux_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f3eabf4f2f83320472e6146f6545d8237e1423849e62148d5d656bfb571d00e
3
+ size 2724842961
checkpoints/PiD_res2kto4k_sr4x_official_sd3_distill_4step/model_ema_bf16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22d1224cae36041b61517c2145c954fca2a9624a30a01d57b7bb044304b9dc31
3
+ size 2724842961
checkpoints/ae.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afc8e28272cd15db3919bacdb6918ce9c1ed22e96cb12c4d5ed0fba823529e38
3
+ size 335304388
checkpoints/flux2_ae.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:868fe7b343cc8f3a19dbcfcafbc3d5f888802be3f89bd81b65b3621a066ce8f3
3
+ size 336211292
checkpoints/rae/decoders/dinov2/wReg_base/ViTXL_n08_i512/model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8b83b058cd84567ce1f671c9ea32d6ec0e48532c650bbf1ba04bb4739292630
3
+ size 1665128758
checkpoints/rae/stats/dinov2/wReg_base/imagenet1k_512/stat.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe0ac4e914a28708ec85f0dbd3be436dcec48e556d5d745f78a13625dc8fe2c7
3
+ size 6292742
checkpoints/scale_rae/decoder/XL_decoder_config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/vit-mae-base",
3
+ "architectures": [
4
+ "ViTMAEForPreTraining"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "decoder_hidden_size": 1152,
8
+ "decoder_intermediate_size": 4096,
9
+ "decoder_num_attention_heads": 16,
10
+ "decoder_num_hidden_layers": 28,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.0,
13
+ "hidden_size": 1152,
14
+ "image_size": 224,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "layer_norm_eps": 1e-12,
18
+ "mask_ratio": 0.75,
19
+ "model_type": "vit_mae",
20
+ "norm_pix_loss": false,
21
+ "num_attention_heads": 12,
22
+ "num_channels": 3,
23
+ "num_hidden_layers": 12,
24
+ "patch_size": 14,
25
+ "qkv_bias": true,
26
+ "torch_dtype": "float32",
27
+ "transformers_version": "4.42.3"
28
+ }
checkpoints/scale_rae/decoder/siglip2_sop14_i224_web73M_ganw3_decXL.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca7e6b907bb51455a12eea39b6acb1999c2133f325c123cda20ceb206d1ef3cb
3
+ size 1662529538
checkpoints/sd3_vae/vae/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9b67a279283625caee39d61eacb5324243848477b4eb535355eaaa8423d4e09
3
+ size 167666654
config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "input_types": [
3
+ "PiD"
4
+ ],
5
+ "model_size": "1.3B"
6
+ }
figures/teaser.jpg ADDED

Git LFS Details

  • SHA256: fb74f71364bd8fc0901650d6c7b5b8ef8efac751b7d248d2c9a3d7accf031d17
  • Pointer size: 132 Bytes
  • Size of remote file: 1.36 MB
tutorial.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4446c69aba92962c5b7c3a15c4a1e6803c6c215dcd63118ab5e8fc9b7d07e299
3
+ size 121100912