Image-to-Image
Wan2.2
steppe
latent-upscaler
upscaler
super-resolution
video-super-resolution
frame-interpolation
comfyui
wan
wan2.1
qwen-image
flow-matching
distillation
Instructions to use TensorForger/Steppe-Wan2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Wan2.2
How to use TensorForger/Steppe-Wan2.1 with Wan2.2:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- .comfyignore +4 -0
- .gitignore +11 -0
- .ruff_cache/.gitignore +2 -0
- .ruff_cache/0.17.6/14471419630140837032 +0 -0
- .ruff_cache/0.17.6/18193167133809595831 +0 -0
- .ruff_cache/0.17.6/9175784552151113906 +0 -0
- .ruff_cache/CACHEDIR.TAG +1 -0
- NOTICE +1 -1
- README.md +115 -150
- __init__.py +3 -0
- example_workflows/krea_2_steppe_image_upscale_4x.json +981 -0
- example_workflows/wan_2.1_steppe_video_upscale_spatiotemporal.json +985 -0
- nodes.py +336 -0
- pyproject.toml +36 -0
- requirements.txt +2 -0
- scripts/export_release.py +107 -0
- steppe/__init__.py +31 -0
- steppe/catalog.py +105 -0
- steppe/hff.py +78 -0
- steppe/latent_spaces.py +71 -0
- steppe/model.py +175 -0
- steppe/sampling.py +277 -0
- steppe/wan_transformer.py +493 -0
- tests/output/decode_bicubic.png +3 -0
- tests/output/input.png +3 -0
- tests/output/steppe_wan_2_1_200M_1step_hff-1.0_g1.0.png +3 -0
- tests/output/steppe_wan_2_1_200M_1step_hff0.9_g2.0.png +3 -0
- tests/output/steppe_wan_2_1_200M_base_hff0.9_g1.0.png +3 -0
- tests/output/steppe_wan_2_1_200M_base_hff0.9_g4.0.png +3 -0
- tests/output/steppe_wan_2_1_20M_1step_hff-1.0_g1.0.png +3 -0
- tests/output/steppe_wan_2_1_20M_1step_hff0.9_g2.0.png +3 -0
- tests/test_comfyui.py +115 -0
- tests/test_parity.py +155 -0
.comfyignore
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tests/
|
| 2 |
+
scripts/
|
| 3 |
+
node.zip
|
| 4 |
+
.ruff_cache/
|
.gitignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.py[cod]
|
| 3 |
+
*.egg-info/
|
| 4 |
+
build/
|
| 5 |
+
dist/
|
| 6 |
+
.venv/
|
| 7 |
+
tests/output/
|
| 8 |
+
*.safetensors
|
| 9 |
+
.ruff_cache/
|
| 10 |
+
.pytest_cache/
|
| 11 |
+
node.zip
|
.ruff_cache/.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Automatically created by ruff.
|
| 2 |
+
*
|
.ruff_cache/0.17.6/14471419630140837032
ADDED
|
Binary file (172 Bytes). View file
|
|
|
.ruff_cache/0.17.6/18193167133809595831
ADDED
|
Binary file (540 Bytes). View file
|
|
|
.ruff_cache/0.17.6/9175784552151113906
ADDED
|
Binary file (212 Bytes). View file
|
|
|
.ruff_cache/CACHEDIR.TAG
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Signature: 8a477f597d28d172789f06886806bc55
|
NOTICE
CHANGED
|
@@ -8,6 +8,6 @@ Copyright (c) 2025 Wan Team, Alibaba Group.
|
|
| 8 |
Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
Source: https://github.com/Wan-Video/Wan2.1, https://huggingface.co/Wan-AI/Wan2.1-T2V-14B
|
| 10 |
|
| 11 |
-
This
|
| 12 |
Wan 2.1 VAE configuration. It does not contain or redistribute Wan VAE weights or code; the VAE is obtained
|
| 13 |
from its original source by the user. No modifications were made to the Wan VAE.
|
|
|
|
| 8 |
Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
Source: https://github.com/Wan-Video/Wan2.1, https://huggingface.co/Wan-AI/Wan2.1-T2V-14B
|
| 10 |
|
| 11 |
+
This software contains the per channel latent normalization statistics (latents_mean, latents_std) of the
|
| 12 |
Wan 2.1 VAE configuration. It does not contain or redistribute Wan VAE weights or code; the VAE is obtained
|
| 13 |
from its original source by the user. No modifications were made to the Wan VAE.
|
README.md
CHANGED
|
@@ -1,52 +1,31 @@
|
|
| 1 |
-
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
- wan2.2
|
| 15 |
-
- qwen-image
|
| 16 |
-
- flow-matching
|
| 17 |
-
- distillation
|
| 18 |
-
base_model:
|
| 19 |
-
- Wan-AI/Wan2.1-T2V-14B
|
| 20 |
-
- Wan-AI/Wan2.1-T2V-1.3B
|
| 21 |
-
- Wan-AI/Wan2.1-I2V-14B-720P
|
| 22 |
-
- Wan-AI/Wan2.1-I2V-14B-480P
|
| 23 |
-
- Wan-AI/Wan2.2-T2V-A14B
|
| 24 |
-
- Wan-AI/Wan2.2-I2V-A14B
|
| 25 |
-
- Qwen/Qwen-Image
|
| 26 |
-
- Qwen/Qwen-Image-Edit
|
| 27 |
-
base_model_relation: adapter
|
| 28 |
-
---
|
| 29 |
-
|
| 30 |
-
# Steppe for Wan 2.1 VAE latents
|
| 31 |
-
|
| 32 |
-
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/hero_cat.png)
|
| 33 |
-
|
| 34 |
-
**Steppe** is a family of *generative latent upscalers*: small generative models trained only for upscaling,
|
| 35 |
-
which run directly on VAE latents. The upscaled latent is **decoded straight by the VAE**: no second sampling pass of
|
| 36 |
-
the base model, no hires fix, no prompt.
|
| 37 |
-
|
| 38 |
-
These models upscale latents of the **Wan 2.1 VAE**, the latent space shared by Wan 2.1, Wan 2.2 14B, Qwen-Image,
|
| 39 |
-
Qwen-Image-Edit and Krea 2.
|
| 40 |
|
| 41 |
- **2x resolution** of images and videos, e.g. 512 → 1024 or 1024 → 2048, and chained 2x → 2x.
|
| 42 |
- **2x frame rate** of videos (latent frame interpolation), also combined with 2x resolution.
|
| 43 |
-
- **One step**:
|
| 44 |
-
- **Sharpness control** through the high frequency feature
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
*Wan 2.1 1.3B, 640x512 at 16 fps → Steppe 1280x1024 at 32 fps (2x resolution and 2x frame rate in one pass).*
|
| 49 |
|
|
|
|
|
|
|
|
|
|
| 50 |
## Gallery
|
| 51 |
|
| 52 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/compare_anime.png)
|
|
@@ -58,153 +37,139 @@ Qwen-Image-Edit and Krea 2.
|
|
| 58 |
All examples: Krea 2 Turbo, Steppe 200M 1-step, chained 2x → 2x, no prompt and no refinement pass. Bicubic tiles are
|
| 59 |
upscaled by the same factor from the same input. Click an image for the full resolution card.
|
| 60 |
|
| 61 |
-
##
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
`
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
-
[`example_workflows/`](https://github.com/TensorForger/ComfyUI-Steppe/tree/main/example_workflows).
|
| 70 |
-
|
| 71 |
-
To install the models manually, put the files into `ComfyUI/models/latent_upscale_models`.
|
| 72 |
-
|
| 73 |
-
## Files
|
| 74 |
|
| 75 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/models_lineup.png)
|
| 76 |
|
| 77 |
-
| file | steps |
|
| 78 |
|---|---|---|---|
|
| 79 |
-
|
|
| 80 |
-
|
|
| 81 |
-
|
|
| 82 |
|
| 83 |
-
|
| 84 |
-
repository (versions, recommended settings).
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
| Wan 2.2 A14B (T2V, I2V) | Wan 2.1 VAE | native |
|
| 92 |
-
| Qwen-Image, Qwen-Image-Edit | Qwen-Image VAE: the Wan 2.1 encoder (identical weights) with a fine-tuned decoder | native, tested with `qwen_image_vae` |
|
| 93 |
-
| Krea 2 | Wan 2.1 VAE | native, tested |
|
| 94 |
-
| Wan 2.2 TI2V 5B | Wan 2.2 VAE (48 channels) | **not supported** |
|
| 95 |
-
| FLUX, SD3, SDXL, … | other VAEs | **not supported** |
|
| 96 |
|
| 97 |
-
|
| 98 |
-
512x512 pixels up.
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/hff_portrait.png)
|
| 103 |
|
| 104 |
-
- **hff** (`0...1`, default 0.9)
|
| 105 |
-
The values are absolute:
|
|
|
|
| 106 |
- **guidance**:
|
| 107 |
-
- 1-step models:
|
| 108 |
-
|
| 109 |
-
- Base model: classifier free guidance between
|
| 110 |
-
two passes per step.
|
| 111 |
-
- **
|
| 112 |
-
|
| 113 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
##
|
|
|
|
|
|
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/benchmark_plot.png)
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
| Steppe 200M base, 20 steps | **4.31** | 3.01 | 1051 ms | 5.0 GB |
|
| 125 |
-
| Steppe 200M 1-step | 4.36 | 3.07 | 179 ms | 4.9 GB |
|
| 126 |
-
| Steppe 20M 1-step | 5.85 | 3.85 | 141 ms | 4.5 GB |
|
| 127 |
-
| Wan2.1-VAE-upscale2x decoder (spacepxl) | 6.33 | 5.80 | 29 ms | 1.3 GB |
|
| 128 |
-
| SPAN 2x after decode | 11.19 | 4.83 | 35 ms | 1.3 GB |
|
| 129 |
-
| Real-ESRGAN x2 after decode | 13.83 | 8.83 | 57 ms | 1.3 GB |
|
| 130 |
-
| bicubic after decode | 14.13 | 3.33 | 30 ms | 1.3 GB |
|
| 131 |
-
| SesquiLSR (latent, made for hires fix) | 29.23 | 7.65 | 136 ms | 4.5 GB |
|
| 132 |
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/benchmark_gallery.png)
|
| 136 |
|
| 137 |
-
Benchmark images: [Axis-V1](https://huggingface.co/datasets/refine-axis/axis-v1_1k) by refine-axis (CC BY 4.0),
|
|
|
|
|
|
|
| 138 |
|
| 139 |
## Python
|
| 140 |
|
|
|
|
|
|
|
| 141 |
```bash
|
| 142 |
pip install "steppe[standalone] @ git+https://github.com/TensorForger/ComfyUI-Steppe"
|
| 143 |
```
|
| 144 |
|
| 145 |
```python
|
| 146 |
-
import torch
|
| 147 |
-
from diffusers import AutoencoderKLWan
|
| 148 |
from steppe import UpscaleSettings, load_upscaler
|
| 149 |
|
| 150 |
-
|
| 151 |
-
"Wan-AI/Wan2.1-T2V-1.3B-Diffusers", subfolder="vae", torch_dtype=torch.float32
|
| 152 |
-
).to("cuda")
|
| 153 |
-
upscaler = load_upscaler("steppe_wan_2_1_200M_1step.safetensors")
|
| 154 |
upscaler.model.to("cuda")
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
latents = vae.encode(pixels.to("cuda")).latent_dist.mode()
|
| 158 |
-
upscaled = upscaler.upscale(
|
| 159 |
-
latents, UpscaleSettings(spatial=True, temporal=False, hff=0.9, guidance=1.0)
|
| 160 |
-
)
|
| 161 |
-
pixels_2x = vae.decode(upscaled.to("cuda")).sample
|
| 162 |
```
|
| 163 |
|
| 164 |
-
##
|
| 165 |
-
|
| 166 |
-
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/how_it_works.png)
|
| 167 |
-
|
| 168 |
-
A window transformer runs on the full resolution latent grid. It uses DiT style adaLN-zero blocks, shifted 8x8
|
| 169 |
-
window attention and a causal depthwise temporal convolution. A learned source encoder upsamples the input latent.
|
| 170 |
-
The model generates the normalized residual over the aligned low resolution latent with rectified flow, conditioned
|
| 171 |
-
on the noise level and the hff.
|
| 172 |
|
| 173 |
-
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
hff dropout enables classifier free guidance.
|
| 178 |
-
- **1-step model**: rectified flow distillation of the base model (40k teacher pairs, 2 h on 8 GPUs). It keeps ~99%
|
| 179 |
-
of the base model's quality.
|
| 180 |
-
- **20M model**: the same architecture scaled down and trained from scratch on pairs from the 1-step model.
|
| 181 |
-
|
| 182 |
-
The architecture and recipe come from agent-driven autoresearch: ~80 runs on FLUX.2 latents, then ~70 on Wan 2.1
|
| 183 |
-
latents (rounds of parallel 30 min and 2 h training runs, judged by patch FID).
|
| 184 |
-
|
| 185 |
-
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/autoresearch.png)
|
| 186 |
-
|
| 187 |
-
## Limitations
|
| 188 |
-
|
| 189 |
-
- Small text and small background faces are where all upscalers fail. Steppe improves them less than textures and
|
| 190 |
-
edges, and the 20M model the least.
|
| 191 |
-
- The upscaling factor is fixed at 2x. For 4x, chain two upscales (the 1-step model is as good as the base model
|
| 192 |
-
there).
|
| 193 |
-
- Long videos run in one pass, but the model was trained on clips up to 33 output frames. For very long clips,
|
| 194 |
-
temporal windows (Advanced node) can be more stable.
|
| 195 |
|
| 196 |
## License
|
| 197 |
|
| 198 |
-
MIT. Steppe works on latents of the Wan 2.1 VAE (Apache-2.0, Wan Team, Alibaba Group)
|
| 199 |
-
does not contain VAE weights.
|
| 200 |
-
|
| 201 |
-
The ancestor of Steppe is [comfyui-flow-upscaler](https://github.com/tensorforger/comfyui-flow-upscaler) (FLUX.2).
|
| 202 |
-
|
| 203 |
-
```bibtex
|
| 204 |
-
@misc{steppe2026,
|
| 205 |
-
author = {TensorForger},
|
| 206 |
-
title = {Steppe: Generative Latent Upscalers},
|
| 207 |
-
year = {2026},
|
| 208 |
-
url = {https://huggingface.co/TensorForger/Steppe-Wan2.1}
|
| 209 |
-
}
|
| 210 |
-
```
|
|
|
|
| 1 |
+
# ComfyUI-Steppe
|
| 2 |
+
|
| 3 |
+
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/hero_cat.png)
|
| 4 |
+
|
| 5 |
+
> [!TIP]
|
| 6 |
+
> ### 🌾 Try it in your browser: [Steppe demo on Hugging Face](https://huggingface.co/spaces/TensorForger/Steppe)
|
| 7 |
+
> Upload an image and get a 2x or 4x Steppe upscale. Nothing to install.
|
| 8 |
+
>
|
| 9 |
+
> [](https://huggingface.co/spaces/TensorForger/Steppe)
|
| 10 |
+
|
| 11 |
+
**Steppe** is a family of *generative latent upscalers*: small generative models trained only for upscaling, which
|
| 12 |
+
run directly on VAE latents. The upscaled latent is **decoded straight by the VAE**: no second sampling pass of the
|
| 13 |
+
base model, no hires fix, no prompt.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
- **2x resolution** of images and videos, e.g. 512 → 1024 or 1024 → 2048, and chained 2x → 2x.
|
| 16 |
- **2x frame rate** of videos (latent frame interpolation), also combined with 2x resolution.
|
| 17 |
+
- **One step**: about 45 ms for a 1024 px image with the default model. Most of the time goes to the VAE decode.
|
| 18 |
+
- **Sharpness control** through the high frequency feature (hff).
|
| 19 |
+
- Works with latents of the **Wan 2.1 VAE**, which is used by Wan 2.1, Wan 2.2 14B, Qwen-Image, Qwen-Image-Edit and
|
| 20 |
+
Krea 2, among others. Both `wan_2.1_vae` and `qwen_image_vae` decode the upscaled latents.
|
| 21 |
|
| 22 |
+
https://github.com/user-attachments/assets/5ac3da99-5d0a-496e-b78e-5911f3075968
|
| 23 |
|
| 24 |
*Wan 2.1 1.3B, 640x512 at 16 fps → Steppe 1280x1024 at 32 fps (2x resolution and 2x frame rate in one pass).*
|
| 25 |
|
| 26 |
+
Models: [TensorForger/Steppe-Wan2.1](https://huggingface.co/TensorForger/Steppe-Wan2.1) on Hugging Face.
|
| 27 |
+
The nodes download them on first use.
|
| 28 |
+
|
| 29 |
## Gallery
|
| 30 |
|
| 31 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/compare_anime.png)
|
|
|
|
| 37 |
All examples: Krea 2 Turbo, Steppe 200M 1-step, chained 2x → 2x, no prompt and no refinement pass. Bicubic tiles are
|
| 38 |
upscaled by the same factor from the same input. Click an image for the full resolution card.
|
| 39 |
|
| 40 |
+
## Installation
|
| 41 |
|
| 42 |
+
- **ComfyUI-Manager:** search for "Steppe" and install.
|
| 43 |
+
- **Comfy CLI:** `comfy node install steppe`
|
| 44 |
+
- **Manual:**
|
| 45 |
+
```bash
|
| 46 |
+
cd ComfyUI/custom_nodes
|
| 47 |
+
git clone https://github.com/TensorForger/ComfyUI-Steppe
|
| 48 |
+
pip install -r ComfyUI-Steppe/requirements.txt
|
| 49 |
+
```
|
| 50 |
|
| 51 |
+
The nodes download models into `ComfyUI/models/latent_upscale_models` on first use. You can also download them
|
| 52 |
+
yourself from [Hugging Face](https://huggingface.co/TensorForger/Steppe-Wan2.1) into that folder.
|
| 53 |
|
| 54 |
+
## Models
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/models_lineup.png)
|
| 57 |
|
| 58 |
+
| file | steps | size | use |
|
| 59 |
|---|---|---|---|
|
| 60 |
+
| `steppe_wan_2_1_200M_1step.safetensors` | 1 | 445 MB | **default**: the quality of the base model in one step |
|
| 61 |
+
| `steppe_wan_2_1_200M_base.safetensors` | 1-200 (20) | 444 MB | most control and research: steps, CFG on hff; same quality as 1-step |
|
| 62 |
+
| `steppe_wan_2_1_20M_1step.safetensors` | 1 | 39 MB | lite: very large outputs (2048 → 4096), real time |
|
| 63 |
|
| 64 |
+
## Nodes
|
|
|
|
| 65 |
|
| 66 |
+
| node | what it does |
|
| 67 |
+
|---|---|
|
| 68 |
+
| **Load Steppe Upscaler** | Loads a model and downloads released models if missing. `dtype`: auto (bfloat16 where supported) or float32. |
|
| 69 |
+
| **Steppe Upscale Latent** | Upscales a `LATENT`: `spatial` 2x resolution, `temporal` 2x frame rate, `hff`, `guidance`, `steps` (base model only), `seed`. |
|
| 70 |
+
| **Steppe Upscale Latent (Advanced)** | Adds `negative_hff`, `shift`, `noise_scale` and temporal windows for long videos. |
|
| 71 |
+
| **Steppe Measure HFF** | The hff value of an image, e.g. to match the sharpness of a reference. |
|
| 72 |
|
| 73 |
+
Basic graph: `KSampler → Steppe Upscale Latent → VAE Decode`. Images and videos use the same node.
|
| 74 |
+
|
| 75 |
+
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/workflow.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
## Example workflows
|
|
|
|
| 78 |
|
| 79 |
+
In `example_workflows/` (also listed in ComfyUI's template browser under custom nodes):
|
| 80 |
+
|
| 81 |
+
- `krea_2_steppe_image_upscale_4x.json`: Krea 2 Turbo at 960x1280, two chained Steppe nodes, 3840x5120 output.
|
| 82 |
+
- `wan_2.1_steppe_video_upscale_spatiotemporal.json`: Wan 2.1 T2V 1.3B at 640x512, 65 frames at 16 fps, Steppe 2x
|
| 83 |
+
resolution and 2x frame rate: 1280x1024, 129 frames at 32 fps.
|
| 84 |
+
|
| 85 |
+
The model links and folders are in the note inside each workflow.
|
| 86 |
+
|
| 87 |
+
### Parameters
|
| 88 |
|
| 89 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/hff_portrait.png)
|
| 90 |
|
| 91 |
+
- **hff** (high frequency feature, `0...1`, default 0.9) is the target amount of fine detail and sharpness. `-1`
|
| 92 |
+
turns hff off and lets the model choose. The values are absolute: Steppe Measure HFF on a photo at the target
|
| 93 |
+
resolution gives a value that matches it.
|
| 94 |
- **guidance**:
|
| 95 |
+
- 1-step models: distilled guidance, trained on 1-3. The default `1` turns it off and is safe and stable; `2` also
|
| 96 |
+
works well. It is a model input, so it costs nothing.
|
| 97 |
+
- Base model: classifier free guidance between `hff` and `negative_hff` (default: no hff). The effect is subtle,
|
| 98 |
+
so use 4-8 for a visible change. Guidance above 1 costs two passes per step.
|
| 99 |
+
- **temporal**: T latent frames become 1 + 2 (T - 1), i.e. 81 → 161 pixel frames for Wan. The first frame is kept.
|
| 100 |
+
- **temporal_window** (Advanced): long videos run without windows, since memory is handled by chunking. Windows of
|
| 101 |
+
about 8-16 source latent frames keep each piece close to the training clip length.
|
| 102 |
+
|
| 103 |
+
### Tips
|
| 104 |
+
|
| 105 |
+
- **Chained upscaling** 512 → 1024 → 2048 (4x): use two Steppe nodes. The 1-step model is as good as the base model
|
| 106 |
+
here, too. The 20M model is fast enough for the 2048 → 4096 step.
|
| 107 |
+
- **Any aspect ratio** works; inputs from 512x512 pixels up are tested.
|
| 108 |
+
- **Base model**: same quality as the 1-step model for general use; it is for control and research (steps, CFG on
|
| 109 |
+
hff, negative hff, shift, noise scale).
|
| 110 |
+
- **Decoding large outputs**: use `VAE Decode (Tiled)` for 2048 px images and upscaled videos.
|
| 111 |
+
- **Video**: 81 frames at 480x832 → 960x1664 at 2x frame rate takes 3.5 s and 9 GB peak VRAM with the 1-step model
|
| 112 |
+
(RTX 5090), plus the VAE decode.
|
| 113 |
+
- **Not supported**: the Wan 2.2 5B (TI2V) VAE (48 channels), and FLUX, SD3 and SDXL latents. 16 channel FLUX.1 /
|
| 114 |
+
SD3 latents pass the channel check but give wrong results.
|
| 115 |
|
| 116 |
+
## How it works
|
| 117 |
+
|
| 118 |
+
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/how_it_works.png)
|
| 119 |
|
| 120 |
+
Latent upscalers made for hires fix only stretch the latent, so the base model has to denoise it again at the high
|
| 121 |
+
resolution. Steppe is a generative model itself: a window transformer on the full resolution latent grid generates
|
| 122 |
+
the missing detail with rectified flow, distilled to one step. Details on the
|
| 123 |
+
[model card](https://huggingface.co/TensorForger/Steppe-Wan2.1#how-it-works).
|
| 124 |
+
|
| 125 |
+
## Benchmark
|
| 126 |
|
| 127 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/benchmark_plot.png)
|
| 128 |
|
| 129 |
+
1000 photos (Axis-V1), 512 → 1024 from the Wan 2.1 latent only (no prompt), patch FID on native 256 px tiles (lower
|
| 130 |
+
is better). Latency at batch 1 on an RTX 5090, VAE decode included.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
+
| solution | patch FID | latency |
|
| 133 |
+
|---|---|---|
|
| 134 |
+
| Steppe 200M base, 20 steps | **4.31** | 1051 ms |
|
| 135 |
+
| Steppe 200M 1-step | 4.36 | 179 ms |
|
| 136 |
+
| Steppe 20M 1-step | 5.85 | 141 ms |
|
| 137 |
+
| Wan2.1-VAE-upscale2x decoder (spacepxl) | 6.33 | 29 ms |
|
| 138 |
+
| SPAN 2x after decode | 11.19 | 35 ms |
|
| 139 |
+
| Real-ESRGAN x2 after decode | 13.83 | 57 ms |
|
| 140 |
+
| bicubic after decode | 14.13 | 30 ms |
|
| 141 |
+
| latent upscalers made for hires fix (SesquiLSR, NN latent) | 29-51 | ~135 ms |
|
| 142 |
|
| 143 |
[](https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/benchmark_gallery.png)
|
| 144 |
|
| 145 |
+
Benchmark images: [Axis-V1](https://huggingface.co/datasets/refine-axis/axis-v1_1k) by refine-axis (CC BY 4.0),
|
| 146 |
+
cropped. Full table with FID, color shift and VRAM:
|
| 147 |
+
[model card](https://huggingface.co/TensorForger/Steppe-Wan2.1#benchmark).
|
| 148 |
|
| 149 |
## Python
|
| 150 |
|
| 151 |
+
The `steppe` package is pure PyTorch and does not need ComfyUI:
|
| 152 |
+
|
| 153 |
```bash
|
| 154 |
pip install "steppe[standalone] @ git+https://github.com/TensorForger/ComfyUI-Steppe"
|
| 155 |
```
|
| 156 |
|
| 157 |
```python
|
|
|
|
|
|
|
| 158 |
from steppe import UpscaleSettings, load_upscaler
|
| 159 |
|
| 160 |
+
upscaler = load_upscaler("steppe_wan_2_1_200M_1step.safetensors") # downloads from Hugging Face
|
|
|
|
|
|
|
|
|
|
| 161 |
upscaler.model.to("cuda")
|
| 162 |
+
# raw (unnormalized) Wan 2.1 VAE latents, [B, 16, T, H, W] or [B, 16, H, W]
|
| 163 |
+
upscaled = upscaler.upscale(latents, UpscaleSettings(spatial=True, temporal=False, hff=0.9, guidance=1.0))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
```
|
| 165 |
|
| 166 |
+
## Related
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
+
- [comfyui-flow-upscaler](https://github.com/tensorforger/comfyui-flow-upscaler): the ancestor of Steppe, a FLUX.2
|
| 169 |
+
latent upscaler.
|
| 170 |
+
- [LUA: latent upscale adapters](https://arxiv.org/abs/2511.10629): single pass regression upscalers. Steppe is
|
| 171 |
+
generative instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
## License
|
| 174 |
|
| 175 |
+
MIT (see `LICENSE`). Steppe works on latents of the Wan 2.1 VAE (Apache-2.0, Wan Team, Alibaba Group); see `NOTICE`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
| 2 |
+
|
| 3 |
+
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
|
example_workflows/krea_2_steppe_image_upscale_4x.json
ADDED
|
@@ -0,0 +1,981 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "08988737-a544-4ab1-99fb-22d67b7c36e3",
|
| 3 |
+
"revision": 0,
|
| 4 |
+
"last_node_id": 123,
|
| 5 |
+
"last_link_id": 234,
|
| 6 |
+
"nodes": [
|
| 7 |
+
{
|
| 8 |
+
"id": 48,
|
| 9 |
+
"type": "MarkdownNote",
|
| 10 |
+
"pos": [
|
| 11 |
+
127.76095051217284,
|
| 12 |
+
-96.04574295096032
|
| 13 |
+
],
|
| 14 |
+
"size": [
|
| 15 |
+
393.99366648793193,
|
| 16 |
+
647.8794695263359
|
| 17 |
+
],
|
| 18 |
+
"flags": {},
|
| 19 |
+
"order": 0,
|
| 20 |
+
"mode": 0,
|
| 21 |
+
"inputs": [],
|
| 22 |
+
"outputs": [],
|
| 23 |
+
"title": "Model Links",
|
| 24 |
+
"properties": {},
|
| 25 |
+
"widgets_values": [
|
| 26 |
+
"## Model Links\n\nFor BF16 and NVFP4 variants, see [Comfy-Org/Krea-2](https://huggingface.co/Comfy-Org/Krea-2)\n\n**diffusion_models**\n\n- [krea2_turbo_fp8_scaled.safetensors](https://huggingface.co/Comfy-Org/Krea-2/resolve/main/diffusion_models/krea2_turbo_fp8_scaled.safetensors)\n\n**text_encoders**\n\n- [qwen3vl_4b_fp8_scaled.safetensors](https://huggingface.co/Comfy-Org/Krea-2/resolve/main/text_encoders/qwen3vl_4b_fp8_scaled.safetensors)\n\n**latent upscaler**\n\n- [steppe_wan_2_1_200M_1step.safetensors](https://huggingface.co/TensorForger/Steppe-Wan2.1/resolve/main/steppe_wan_2_1_200M_1step.safetensors)\n\n**vae**\n\n- [wan_2.1_vae.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/vae/wan_2.1_vae.safetensors)\n\n\n\n## Model Storage Location\n\n```\n\ud83d\udcc2 ComfyUI/\n\u251c\u2500\u2500 \ud83d\udcc2 models/\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 diffusion_models/\n\u2502 \u2502 \u2514\u2500\u2500 krea2_turbo_fp8_scaled.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 text_encoders/\n\u2502 \u2502 \u2514\u2500\u2500 qwen3vl_4b_fp8_scaled.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 latent_upscale_models/\n\u2502 \u2502 \u2514\u2500\u2500 steppe_wan_2_1_200M_1step.safetensors\n\u2502 \u2514\u2500\u2500 \ud83d\udcc2 vae/\n\u2502 \u2514\u2500\u2500 wan_2.1_vae.safetensors\n```\n\n## Custom Nodes\n\n- [ComfyUI-Steppe](https://github.com/tensorforger/ComfyUI-Steppe)\n\n"
|
| 27 |
+
],
|
| 28 |
+
"widgets_values_named": {
|
| 29 |
+
"text": "## Model Links\n\nFor BF16 and NVFP4 variants, see [Comfy-Org/Krea-2](https://huggingface.co/Comfy-Org/Krea-2)\n\n**diffusion_models**\n\n- [krea2_turbo_fp8_scaled.safetensors](https://huggingface.co/Comfy-Org/Krea-2/resolve/main/diffusion_models/krea2_turbo_fp8_scaled.safetensors)\n\n**text_encoders**\n\n- [qwen3vl_4b_fp8_scaled.safetensors](https://huggingface.co/Comfy-Org/Krea-2/resolve/main/text_encoders/qwen3vl_4b_fp8_scaled.safetensors)\n\n**latent upscaler**\n\n- [steppe_wan_2_1_200M_1step.safetensors](https://huggingface.co/TensorForger/Steppe-Wan2.1/resolve/main/steppe_wan_2_1_200M_1step.safetensors)\n\n**vae**\n\n- [steppe_wan_2_1_200M_1step.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/vae/wan_2.1_vae.safetensors)\n\n\n\n## Model Storage Location\n\n```\n\ud83d\udcc2 ComfyUI/\n\u251c\u2500\u2500 \ud83d\udcc2 models/\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 diffusion_models/\n\u2502 \u2502 \u2514\u2500\u2500 krea2_turbo_fp8_scaled.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 text_encoders/\n\u2502 \u2502 \u2514\u2500\u2500 qwen3vl_4b_fp8_scaled.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 latent_upscale_models/\n\u2502 \u2502 \u2514\u2500\u2500 steppe_wan_2_1_200M_1step.safetensors\n\u2502 \u2514\u2500\u2500 \ud83d\udcc2 vae/\n\u2502 \u2514\u2500\u2500 wan_2.1_vae.safetensors\n```\n\n## Custom Nodes\n\n- [ComfyUI-Steppe](https://github.com/tensorforger/ComfyUI-Steppe)\n\n"
|
| 30 |
+
},
|
| 31 |
+
"color": "#222",
|
| 32 |
+
"bgcolor": "#000"
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"id": 54,
|
| 36 |
+
"type": "Image Comparer (rgthree)",
|
| 37 |
+
"pos": [
|
| 38 |
+
3506.8706256339965,
|
| 39 |
+
-49.45241572465535
|
| 40 |
+
],
|
| 41 |
+
"size": [
|
| 42 |
+
447.78671991396857,
|
| 43 |
+
582.9237263672619
|
| 44 |
+
],
|
| 45 |
+
"flags": {},
|
| 46 |
+
"order": 15,
|
| 47 |
+
"mode": 0,
|
| 48 |
+
"inputs": [
|
| 49 |
+
{
|
| 50 |
+
"dir": 3,
|
| 51 |
+
"name": "image_a",
|
| 52 |
+
"type": "IMAGE",
|
| 53 |
+
"link": 233
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"dir": 3,
|
| 57 |
+
"name": "image_b",
|
| 58 |
+
"type": "IMAGE",
|
| 59 |
+
"link": 234
|
| 60 |
+
}
|
| 61 |
+
],
|
| 62 |
+
"outputs": [
|
| 63 |
+
{
|
| 64 |
+
"dir": 4,
|
| 65 |
+
"name": "images",
|
| 66 |
+
"shape": 3,
|
| 67 |
+
"type": "IMAGE",
|
| 68 |
+
"links": null
|
| 69 |
+
}
|
| 70 |
+
],
|
| 71 |
+
"properties": {
|
| 72 |
+
"comparer_mode": "Slide"
|
| 73 |
+
},
|
| 74 |
+
"widgets_values": [
|
| 75 |
+
[
|
| 76 |
+
{
|
| 77 |
+
"name": "A",
|
| 78 |
+
"selected": true,
|
| 79 |
+
"url": "/api/view?filename=rgthree.compare._temp_pdetg_00179_.png&type=temp&subfolder=&rand=0.7829568105861398"
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"name": "B",
|
| 83 |
+
"selected": true,
|
| 84 |
+
"url": "/api/view?filename=rgthree.compare._temp_pdetg_00180_.png&type=temp&subfolder=&rand=0.31946688699032466"
|
| 85 |
+
}
|
| 86 |
+
]
|
| 87 |
+
],
|
| 88 |
+
"widgets_values_named": {
|
| 89 |
+
"rgthree_comparer": {
|
| 90 |
+
"images": [
|
| 91 |
+
{
|
| 92 |
+
"name": "A",
|
| 93 |
+
"selected": true,
|
| 94 |
+
"url": "/api/view?filename=rgthree.compare._temp_pdetg_00179_.png&type=temp&subfolder=&rand=0.7829568105861398",
|
| 95 |
+
"img": {}
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"name": "B",
|
| 99 |
+
"selected": true,
|
| 100 |
+
"url": "/api/view?filename=rgthree.compare._temp_pdetg_00180_.png&type=temp&subfolder=&rand=0.31946688699032466",
|
| 101 |
+
"img": {}
|
| 102 |
+
}
|
| 103 |
+
]
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"id": 88,
|
| 109 |
+
"type": "CLIPTextEncode",
|
| 110 |
+
"pos": [
|
| 111 |
+
1095.947470141841,
|
| 112 |
+
-15.75782202549159
|
| 113 |
+
],
|
| 114 |
+
"size": [
|
| 115 |
+
471.5877830667075,
|
| 116 |
+
244.54459240688624
|
| 117 |
+
],
|
| 118 |
+
"flags": {},
|
| 119 |
+
"order": 6,
|
| 120 |
+
"mode": 0,
|
| 121 |
+
"inputs": [
|
| 122 |
+
{
|
| 123 |
+
"name": "clip",
|
| 124 |
+
"type": "CLIP",
|
| 125 |
+
"link": 173
|
| 126 |
+
}
|
| 127 |
+
],
|
| 128 |
+
"outputs": [
|
| 129 |
+
{
|
| 130 |
+
"name": "CONDITIONING",
|
| 131 |
+
"type": "CONDITIONING",
|
| 132 |
+
"slot_index": 0,
|
| 133 |
+
"links": [
|
| 134 |
+
176,
|
| 135 |
+
181
|
| 136 |
+
]
|
| 137 |
+
}
|
| 138 |
+
],
|
| 139 |
+
"properties": {
|
| 140 |
+
"Node name for S&R": "CLIPTextEncode",
|
| 141 |
+
"cnr_id": "comfy-core",
|
| 142 |
+
"ver": "0.25.0"
|
| 143 |
+
},
|
| 144 |
+
"widgets_values": [
|
| 145 |
+
"A close-up professional macro photograph at golden hour: a bold, lush orange-furred cat positioned on the left, gazing downward at a cactus flower, with bright, natural light illuminating the scene, sharp detailed fur textures, and clear reflections of the flower in the cat\u2019s eyes; the outdoor background is softly blurred, showing rocks and large cacti. The large caption reading \u201cExplore\u201d is partially behind the cat, on the background, across the top of the image in a stylish Times New Roman\u2013style typeface in warm white, styled like a journal cover and layered so it appears behind the cat\u2014partially occluded by the cat\u2019s head and body\u2014with the smaller line \u201cand imagine at scale\u201d placed below it and shifted to the right."
|
| 146 |
+
],
|
| 147 |
+
"widgets_values_named": {
|
| 148 |
+
"text": "A close-up professional macro photograph at golden hour: a bold, lush orange-furred cat positioned on the left, gazing downward at a cactus flower, with bright, natural light illuminating the scene, sharp detailed fur textures, and clear reflections of the flower in the cat\u2019s eyes; the outdoor background is softly blurred, showing rocks and large cacti. The large caption reading \u201cExplore\u201d is partially behind the cat, on the background, across the top of the image in a stylish Times New Roman\u2013style typeface in warm white, styled like a journal cover and layered so it appears behind the cat\u2014partially occluded by the cat\u2019s head and body\u2014with the smaller line \u201cand imagine at scale\u201d placed below it and shifted to the right."
|
| 149 |
+
},
|
| 150 |
+
"color": "#232",
|
| 151 |
+
"bgcolor": "#353"
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"id": 89,
|
| 155 |
+
"type": "EmptyLatentImage",
|
| 156 |
+
"pos": [
|
| 157 |
+
1106.0890919327483,
|
| 158 |
+
327.2526748382272
|
| 159 |
+
],
|
| 160 |
+
"size": [
|
| 161 |
+
447.962354306967,
|
| 162 |
+
181.6328638441248
|
| 163 |
+
],
|
| 164 |
+
"flags": {},
|
| 165 |
+
"order": 1,
|
| 166 |
+
"mode": 0,
|
| 167 |
+
"inputs": [],
|
| 168 |
+
"outputs": [
|
| 169 |
+
{
|
| 170 |
+
"name": "LATENT",
|
| 171 |
+
"type": "LATENT",
|
| 172 |
+
"slot_index": 0,
|
| 173 |
+
"links": [
|
| 174 |
+
178
|
| 175 |
+
]
|
| 176 |
+
}
|
| 177 |
+
],
|
| 178 |
+
"properties": {
|
| 179 |
+
"Node name for S&R": "EmptyLatentImage",
|
| 180 |
+
"cnr_id": "comfy-core",
|
| 181 |
+
"ver": "0.25.0"
|
| 182 |
+
},
|
| 183 |
+
"widgets_values": [
|
| 184 |
+
960,
|
| 185 |
+
1280,
|
| 186 |
+
1
|
| 187 |
+
],
|
| 188 |
+
"widgets_values_named": {
|
| 189 |
+
"width": 960,
|
| 190 |
+
"height": 1280,
|
| 191 |
+
"batch_size": 1
|
| 192 |
+
}
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"id": 90,
|
| 196 |
+
"type": "KSampler",
|
| 197 |
+
"pos": [
|
| 198 |
+
1604.7562935163837,
|
| 199 |
+
-57.09456180280735
|
| 200 |
+
],
|
| 201 |
+
"size": [
|
| 202 |
+
320,
|
| 203 |
+
590
|
| 204 |
+
],
|
| 205 |
+
"flags": {},
|
| 206 |
+
"order": 8,
|
| 207 |
+
"mode": 0,
|
| 208 |
+
"inputs": [
|
| 209 |
+
{
|
| 210 |
+
"name": "model",
|
| 211 |
+
"type": "MODEL",
|
| 212 |
+
"link": 218
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"name": "positive",
|
| 216 |
+
"type": "CONDITIONING",
|
| 217 |
+
"link": 176
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"name": "negative",
|
| 221 |
+
"type": "CONDITIONING",
|
| 222 |
+
"link": 177
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"name": "latent_image",
|
| 226 |
+
"type": "LATENT",
|
| 227 |
+
"link": 178
|
| 228 |
+
}
|
| 229 |
+
],
|
| 230 |
+
"outputs": [
|
| 231 |
+
{
|
| 232 |
+
"name": "LATENT",
|
| 233 |
+
"type": "LATENT",
|
| 234 |
+
"slot_index": 0,
|
| 235 |
+
"links": [
|
| 236 |
+
224,
|
| 237 |
+
230
|
| 238 |
+
]
|
| 239 |
+
}
|
| 240 |
+
],
|
| 241 |
+
"properties": {
|
| 242 |
+
"Node name for S&R": "KSampler",
|
| 243 |
+
"cnr_id": "comfy-core",
|
| 244 |
+
"ver": "0.25.0"
|
| 245 |
+
},
|
| 246 |
+
"widgets_values": [
|
| 247 |
+
111553999817709,
|
| 248 |
+
"fixed",
|
| 249 |
+
14,
|
| 250 |
+
1,
|
| 251 |
+
"euler",
|
| 252 |
+
"simple",
|
| 253 |
+
1
|
| 254 |
+
],
|
| 255 |
+
"widgets_values_named": {
|
| 256 |
+
"seed": 111553999817709,
|
| 257 |
+
"control_after_generate": "fixed",
|
| 258 |
+
"steps": 14,
|
| 259 |
+
"cfg": 1,
|
| 260 |
+
"sampler_name": "euler",
|
| 261 |
+
"scheduler": "simple",
|
| 262 |
+
"denoise": 1
|
| 263 |
+
}
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"id": 92,
|
| 267 |
+
"type": "UNETLoader",
|
| 268 |
+
"pos": [
|
| 269 |
+
595.521833995773,
|
| 270 |
+
-9.330346845780312
|
| 271 |
+
],
|
| 272 |
+
"size": [
|
| 273 |
+
450,
|
| 274 |
+
140
|
| 275 |
+
],
|
| 276 |
+
"flags": {},
|
| 277 |
+
"order": 2,
|
| 278 |
+
"mode": 0,
|
| 279 |
+
"inputs": [],
|
| 280 |
+
"outputs": [
|
| 281 |
+
{
|
| 282 |
+
"name": "MODEL",
|
| 283 |
+
"type": "MODEL",
|
| 284 |
+
"links": [
|
| 285 |
+
218
|
| 286 |
+
]
|
| 287 |
+
}
|
| 288 |
+
],
|
| 289 |
+
"properties": {
|
| 290 |
+
"Node name for S&R": "UNETLoader",
|
| 291 |
+
"cnr_id": "comfy-core",
|
| 292 |
+
"ver": "0.25.0",
|
| 293 |
+
"models": [
|
| 294 |
+
{
|
| 295 |
+
"name": "krea2_turbo_fp8_scaled.safetensors",
|
| 296 |
+
"url": "https://huggingface.co/Comfy-Org/Krea-2/resolve/main/diffusion_models/krea2_turbo_fp8_scaled.safetensors",
|
| 297 |
+
"directory": "diffusion_models"
|
| 298 |
+
}
|
| 299 |
+
]
|
| 300 |
+
},
|
| 301 |
+
"widgets_values": [
|
| 302 |
+
"krea2_turbo_fp8_scaled.safetensors",
|
| 303 |
+
"default"
|
| 304 |
+
],
|
| 305 |
+
"widgets_values_named": {
|
| 306 |
+
"unet_name": "krea2_turbo_fp8_scaled.safetensors",
|
| 307 |
+
"weight_dtype": "default"
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
{
|
| 311 |
+
"id": 93,
|
| 312 |
+
"type": "CLIPLoader",
|
| 313 |
+
"pos": [
|
| 314 |
+
595.521833995773,
|
| 315 |
+
177.09331110099365
|
| 316 |
+
],
|
| 317 |
+
"size": [
|
| 318 |
+
450,
|
| 319 |
+
170
|
| 320 |
+
],
|
| 321 |
+
"flags": {},
|
| 322 |
+
"order": 3,
|
| 323 |
+
"mode": 0,
|
| 324 |
+
"inputs": [],
|
| 325 |
+
"outputs": [
|
| 326 |
+
{
|
| 327 |
+
"name": "CLIP",
|
| 328 |
+
"type": "CLIP",
|
| 329 |
+
"links": [
|
| 330 |
+
173
|
| 331 |
+
]
|
| 332 |
+
}
|
| 333 |
+
],
|
| 334 |
+
"properties": {
|
| 335 |
+
"Node name for S&R": "CLIPLoader",
|
| 336 |
+
"cnr_id": "comfy-core",
|
| 337 |
+
"ver": "0.25.0",
|
| 338 |
+
"models": [
|
| 339 |
+
{
|
| 340 |
+
"name": "qwen3vl_4b_fp8_scaled.safetensors",
|
| 341 |
+
"url": "https://huggingface.co/Comfy-Org/Krea-2/resolve/main/text_encoders/qwen3vl_4b_fp8_scaled.safetensors",
|
| 342 |
+
"directory": "text_encoders"
|
| 343 |
+
}
|
| 344 |
+
]
|
| 345 |
+
},
|
| 346 |
+
"widgets_values": [
|
| 347 |
+
"qwen3vl_4b_fp8_scaled.safetensors",
|
| 348 |
+
"krea2",
|
| 349 |
+
"default"
|
| 350 |
+
],
|
| 351 |
+
"widgets_values_named": {
|
| 352 |
+
"clip_name": "qwen3vl_4b_fp8_scaled.safetensors",
|
| 353 |
+
"type": "krea2",
|
| 354 |
+
"device": "default"
|
| 355 |
+
}
|
| 356 |
+
},
|
| 357 |
+
{
|
| 358 |
+
"id": 94,
|
| 359 |
+
"type": "VAELoader",
|
| 360 |
+
"pos": [
|
| 361 |
+
2631.0211199882638,
|
| 362 |
+
-50.994239531145205
|
| 363 |
+
],
|
| 364 |
+
"size": [
|
| 365 |
+
439.4245724119778,
|
| 366 |
+
85.62998136472373
|
| 367 |
+
],
|
| 368 |
+
"flags": {},
|
| 369 |
+
"order": 4,
|
| 370 |
+
"mode": 0,
|
| 371 |
+
"inputs": [],
|
| 372 |
+
"outputs": [
|
| 373 |
+
{
|
| 374 |
+
"name": "VAE",
|
| 375 |
+
"type": "VAE",
|
| 376 |
+
"links": [
|
| 377 |
+
228,
|
| 378 |
+
229
|
| 379 |
+
]
|
| 380 |
+
}
|
| 381 |
+
],
|
| 382 |
+
"properties": {
|
| 383 |
+
"Node name for S&R": "VAELoader",
|
| 384 |
+
"cnr_id": "comfy-core",
|
| 385 |
+
"ver": "0.25.0",
|
| 386 |
+
"models": [
|
| 387 |
+
{
|
| 388 |
+
"name": "qwen_image_vae.safetensors",
|
| 389 |
+
"url": "https://huggingface.co/Comfy-Org/Krea-2/resolve/main/vae/qwen_image_vae.safetensors",
|
| 390 |
+
"directory": "vae"
|
| 391 |
+
}
|
| 392 |
+
]
|
| 393 |
+
},
|
| 394 |
+
"widgets_values": [
|
| 395 |
+
"wan_2.1_vae.safetensors"
|
| 396 |
+
],
|
| 397 |
+
"widgets_values_named": {
|
| 398 |
+
"vae_name": "wan_2.1_vae.safetensors"
|
| 399 |
+
}
|
| 400 |
+
},
|
| 401 |
+
{
|
| 402 |
+
"id": 95,
|
| 403 |
+
"type": "ConditioningZeroOut",
|
| 404 |
+
"pos": [
|
| 405 |
+
1276.0056863376917,
|
| 406 |
+
276.74379775353
|
| 407 |
+
],
|
| 408 |
+
"size": [
|
| 409 |
+
225,
|
| 410 |
+
26
|
| 411 |
+
],
|
| 412 |
+
"flags": {
|
| 413 |
+
"collapsed": true
|
| 414 |
+
},
|
| 415 |
+
"order": 7,
|
| 416 |
+
"mode": 0,
|
| 417 |
+
"inputs": [
|
| 418 |
+
{
|
| 419 |
+
"name": "conditioning",
|
| 420 |
+
"type": "CONDITIONING",
|
| 421 |
+
"link": 181
|
| 422 |
+
}
|
| 423 |
+
],
|
| 424 |
+
"outputs": [
|
| 425 |
+
{
|
| 426 |
+
"name": "CONDITIONING",
|
| 427 |
+
"type": "CONDITIONING",
|
| 428 |
+
"links": [
|
| 429 |
+
177
|
| 430 |
+
]
|
| 431 |
+
}
|
| 432 |
+
],
|
| 433 |
+
"properties": {
|
| 434 |
+
"Node name for S&R": "ConditioningZeroOut",
|
| 435 |
+
"cnr_id": "comfy-core",
|
| 436 |
+
"ver": "0.25.0"
|
| 437 |
+
}
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"id": 116,
|
| 441 |
+
"type": "SteppeLoadUpscaler",
|
| 442 |
+
"pos": [
|
| 443 |
+
2005.5098394502606,
|
| 444 |
+
-48.7356805820607
|
| 445 |
+
],
|
| 446 |
+
"size": [
|
| 447 |
+
564.145426566688,
|
| 448 |
+
82
|
| 449 |
+
],
|
| 450 |
+
"flags": {},
|
| 451 |
+
"order": 5,
|
| 452 |
+
"mode": 0,
|
| 453 |
+
"inputs": [],
|
| 454 |
+
"outputs": [
|
| 455 |
+
{
|
| 456 |
+
"name": "upscaler",
|
| 457 |
+
"type": "STEPPE_UPSCALER",
|
| 458 |
+
"links": [
|
| 459 |
+
223,
|
| 460 |
+
226
|
| 461 |
+
]
|
| 462 |
+
}
|
| 463 |
+
],
|
| 464 |
+
"properties": {
|
| 465 |
+
"Node name for S&R": "SteppeLoadUpscaler"
|
| 466 |
+
},
|
| 467 |
+
"widgets_values": [
|
| 468 |
+
"steppe_wan_2_1_200M_1step.safetensors",
|
| 469 |
+
"auto"
|
| 470 |
+
],
|
| 471 |
+
"widgets_values_named": {
|
| 472 |
+
"model_name": "steppe_wan_2_1_200M_1step.safetensors",
|
| 473 |
+
"dtype": "auto"
|
| 474 |
+
}
|
| 475 |
+
},
|
| 476 |
+
{
|
| 477 |
+
"id": 117,
|
| 478 |
+
"type": "SteppeUpscaleLatent",
|
| 479 |
+
"pos": [
|
| 480 |
+
2014.9221584164848,
|
| 481 |
+
84.65831910139244
|
| 482 |
+
],
|
| 483 |
+
"size": [
|
| 484 |
+
270,
|
| 485 |
+
222
|
| 486 |
+
],
|
| 487 |
+
"flags": {},
|
| 488 |
+
"order": 9,
|
| 489 |
+
"mode": 0,
|
| 490 |
+
"inputs": [
|
| 491 |
+
{
|
| 492 |
+
"name": "upscaler",
|
| 493 |
+
"type": "STEPPE_UPSCALER",
|
| 494 |
+
"link": 223
|
| 495 |
+
},
|
| 496 |
+
{
|
| 497 |
+
"name": "latent",
|
| 498 |
+
"type": "LATENT",
|
| 499 |
+
"link": 224
|
| 500 |
+
}
|
| 501 |
+
],
|
| 502 |
+
"outputs": [
|
| 503 |
+
{
|
| 504 |
+
"name": "LATENT",
|
| 505 |
+
"type": "LATENT",
|
| 506 |
+
"links": [
|
| 507 |
+
225
|
| 508 |
+
]
|
| 509 |
+
}
|
| 510 |
+
],
|
| 511 |
+
"properties": {
|
| 512 |
+
"Node name for S&R": "SteppeUpscaleLatent"
|
| 513 |
+
},
|
| 514 |
+
"widgets_values": [
|
| 515 |
+
true,
|
| 516 |
+
false,
|
| 517 |
+
0.95,
|
| 518 |
+
1,
|
| 519 |
+
1,
|
| 520 |
+
161124989277098,
|
| 521 |
+
"fixed"
|
| 522 |
+
],
|
| 523 |
+
"widgets_values_named": {
|
| 524 |
+
"spatial": true,
|
| 525 |
+
"temporal": false,
|
| 526 |
+
"hff": 0.95,
|
| 527 |
+
"guidance": 1,
|
| 528 |
+
"steps": 1,
|
| 529 |
+
"seed": 161124989277098,
|
| 530 |
+
"control_after_generate": "fixed"
|
| 531 |
+
}
|
| 532 |
+
},
|
| 533 |
+
{
|
| 534 |
+
"id": 118,
|
| 535 |
+
"type": "SteppeUpscaleLatent",
|
| 536 |
+
"pos": [
|
| 537 |
+
2301.917030801153,
|
| 538 |
+
83.2243215316733
|
| 539 |
+
],
|
| 540 |
+
"size": [
|
| 541 |
+
270,
|
| 542 |
+
222
|
| 543 |
+
],
|
| 544 |
+
"flags": {},
|
| 545 |
+
"order": 11,
|
| 546 |
+
"mode": 0,
|
| 547 |
+
"inputs": [
|
| 548 |
+
{
|
| 549 |
+
"name": "upscaler",
|
| 550 |
+
"type": "STEPPE_UPSCALER",
|
| 551 |
+
"link": 226
|
| 552 |
+
},
|
| 553 |
+
{
|
| 554 |
+
"name": "latent",
|
| 555 |
+
"type": "LATENT",
|
| 556 |
+
"link": 225
|
| 557 |
+
}
|
| 558 |
+
],
|
| 559 |
+
"outputs": [
|
| 560 |
+
{
|
| 561 |
+
"name": "LATENT",
|
| 562 |
+
"type": "LATENT",
|
| 563 |
+
"links": [
|
| 564 |
+
227
|
| 565 |
+
]
|
| 566 |
+
}
|
| 567 |
+
],
|
| 568 |
+
"properties": {
|
| 569 |
+
"Node name for S&R": "SteppeUpscaleLatent"
|
| 570 |
+
},
|
| 571 |
+
"widgets_values": [
|
| 572 |
+
true,
|
| 573 |
+
false,
|
| 574 |
+
0.95,
|
| 575 |
+
1,
|
| 576 |
+
1,
|
| 577 |
+
287135665288553,
|
| 578 |
+
"fixed"
|
| 579 |
+
],
|
| 580 |
+
"widgets_values_named": {
|
| 581 |
+
"spatial": true,
|
| 582 |
+
"temporal": false,
|
| 583 |
+
"hff": 0.95,
|
| 584 |
+
"guidance": 1,
|
| 585 |
+
"steps": 1,
|
| 586 |
+
"seed": 287135665288553,
|
| 587 |
+
"control_after_generate": "fixed"
|
| 588 |
+
}
|
| 589 |
+
},
|
| 590 |
+
{
|
| 591 |
+
"id": 119,
|
| 592 |
+
"type": "VAEDecode",
|
| 593 |
+
"pos": [
|
| 594 |
+
2632.648786239429,
|
| 595 |
+
82.64126414185218
|
| 596 |
+
],
|
| 597 |
+
"size": [
|
| 598 |
+
427.70366180388055,
|
| 599 |
+
68.45951532461459
|
| 600 |
+
],
|
| 601 |
+
"flags": {},
|
| 602 |
+
"order": 13,
|
| 603 |
+
"mode": 0,
|
| 604 |
+
"inputs": [
|
| 605 |
+
{
|
| 606 |
+
"name": "samples",
|
| 607 |
+
"type": "LATENT",
|
| 608 |
+
"link": 227
|
| 609 |
+
},
|
| 610 |
+
{
|
| 611 |
+
"name": "vae",
|
| 612 |
+
"type": "VAE",
|
| 613 |
+
"link": 228
|
| 614 |
+
}
|
| 615 |
+
],
|
| 616 |
+
"outputs": [
|
| 617 |
+
{
|
| 618 |
+
"name": "IMAGE",
|
| 619 |
+
"type": "IMAGE",
|
| 620 |
+
"links": [
|
| 621 |
+
231
|
| 622 |
+
]
|
| 623 |
+
}
|
| 624 |
+
],
|
| 625 |
+
"properties": {
|
| 626 |
+
"Node name for S&R": "VAEDecode"
|
| 627 |
+
}
|
| 628 |
+
},
|
| 629 |
+
{
|
| 630 |
+
"id": 120,
|
| 631 |
+
"type": "VAEDecode",
|
| 632 |
+
"pos": [
|
| 633 |
+
2638.603273133919,
|
| 634 |
+
209.1557631573972
|
| 635 |
+
],
|
| 636 |
+
"size": [
|
| 637 |
+
419.77211531802277,
|
| 638 |
+
61.84986097952151
|
| 639 |
+
],
|
| 640 |
+
"flags": {},
|
| 641 |
+
"order": 10,
|
| 642 |
+
"mode": 0,
|
| 643 |
+
"inputs": [
|
| 644 |
+
{
|
| 645 |
+
"name": "samples",
|
| 646 |
+
"type": "LATENT",
|
| 647 |
+
"link": 230
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"name": "vae",
|
| 651 |
+
"type": "VAE",
|
| 652 |
+
"link": 229
|
| 653 |
+
}
|
| 654 |
+
],
|
| 655 |
+
"outputs": [
|
| 656 |
+
{
|
| 657 |
+
"name": "IMAGE",
|
| 658 |
+
"type": "IMAGE",
|
| 659 |
+
"links": [
|
| 660 |
+
232
|
| 661 |
+
]
|
| 662 |
+
}
|
| 663 |
+
],
|
| 664 |
+
"properties": {
|
| 665 |
+
"Node name for S&R": "VAEDecode"
|
| 666 |
+
}
|
| 667 |
+
},
|
| 668 |
+
{
|
| 669 |
+
"id": 122,
|
| 670 |
+
"type": "SaveImage",
|
| 671 |
+
"pos": [
|
| 672 |
+
3137.463241610281,
|
| 673 |
+
263.5134164672979
|
| 674 |
+
],
|
| 675 |
+
"size": [
|
| 676 |
+
324.17352971694163,
|
| 677 |
+
270.00000000000006
|
| 678 |
+
],
|
| 679 |
+
"flags": {},
|
| 680 |
+
"order": 12,
|
| 681 |
+
"mode": 0,
|
| 682 |
+
"inputs": [
|
| 683 |
+
{
|
| 684 |
+
"name": "images",
|
| 685 |
+
"type": "IMAGE",
|
| 686 |
+
"link": 232
|
| 687 |
+
}
|
| 688 |
+
],
|
| 689 |
+
"outputs": [
|
| 690 |
+
{
|
| 691 |
+
"name": "images",
|
| 692 |
+
"type": "IMAGE",
|
| 693 |
+
"links": [
|
| 694 |
+
234
|
| 695 |
+
]
|
| 696 |
+
}
|
| 697 |
+
],
|
| 698 |
+
"properties": {},
|
| 699 |
+
"widgets_values": [
|
| 700 |
+
"steppe_demo_low_res"
|
| 701 |
+
],
|
| 702 |
+
"widgets_values_named": {
|
| 703 |
+
"filename_prefix": "steppe_demo_low_res"
|
| 704 |
+
}
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"id": 123,
|
| 708 |
+
"type": "SaveImage",
|
| 709 |
+
"pos": [
|
| 710 |
+
3127.9251674066995,
|
| 711 |
+
-58.10907387273913
|
| 712 |
+
],
|
| 713 |
+
"size": [
|
| 714 |
+
324.17352971694163,
|
| 715 |
+
270
|
| 716 |
+
],
|
| 717 |
+
"flags": {},
|
| 718 |
+
"order": 14,
|
| 719 |
+
"mode": 0,
|
| 720 |
+
"inputs": [
|
| 721 |
+
{
|
| 722 |
+
"name": "images",
|
| 723 |
+
"type": "IMAGE",
|
| 724 |
+
"link": 231
|
| 725 |
+
}
|
| 726 |
+
],
|
| 727 |
+
"outputs": [
|
| 728 |
+
{
|
| 729 |
+
"name": "images",
|
| 730 |
+
"type": "IMAGE",
|
| 731 |
+
"links": [
|
| 732 |
+
233
|
| 733 |
+
]
|
| 734 |
+
}
|
| 735 |
+
],
|
| 736 |
+
"properties": {},
|
| 737 |
+
"widgets_values": [
|
| 738 |
+
"steppe_demo_high_res"
|
| 739 |
+
],
|
| 740 |
+
"widgets_values_named": {
|
| 741 |
+
"filename_prefix": "steppe_demo_high_res"
|
| 742 |
+
}
|
| 743 |
+
}
|
| 744 |
+
],
|
| 745 |
+
"links": [
|
| 746 |
+
[
|
| 747 |
+
173,
|
| 748 |
+
93,
|
| 749 |
+
0,
|
| 750 |
+
88,
|
| 751 |
+
0,
|
| 752 |
+
"CLIP"
|
| 753 |
+
],
|
| 754 |
+
[
|
| 755 |
+
176,
|
| 756 |
+
88,
|
| 757 |
+
0,
|
| 758 |
+
90,
|
| 759 |
+
1,
|
| 760 |
+
"CONDITIONING"
|
| 761 |
+
],
|
| 762 |
+
[
|
| 763 |
+
177,
|
| 764 |
+
95,
|
| 765 |
+
0,
|
| 766 |
+
90,
|
| 767 |
+
2,
|
| 768 |
+
"CONDITIONING"
|
| 769 |
+
],
|
| 770 |
+
[
|
| 771 |
+
178,
|
| 772 |
+
89,
|
| 773 |
+
0,
|
| 774 |
+
90,
|
| 775 |
+
3,
|
| 776 |
+
"LATENT"
|
| 777 |
+
],
|
| 778 |
+
[
|
| 779 |
+
181,
|
| 780 |
+
88,
|
| 781 |
+
0,
|
| 782 |
+
95,
|
| 783 |
+
0,
|
| 784 |
+
"CONDITIONING"
|
| 785 |
+
],
|
| 786 |
+
[
|
| 787 |
+
218,
|
| 788 |
+
92,
|
| 789 |
+
0,
|
| 790 |
+
90,
|
| 791 |
+
0,
|
| 792 |
+
"MODEL"
|
| 793 |
+
],
|
| 794 |
+
[
|
| 795 |
+
223,
|
| 796 |
+
116,
|
| 797 |
+
0,
|
| 798 |
+
117,
|
| 799 |
+
0,
|
| 800 |
+
"STEPPE_UPSCALER"
|
| 801 |
+
],
|
| 802 |
+
[
|
| 803 |
+
224,
|
| 804 |
+
90,
|
| 805 |
+
0,
|
| 806 |
+
117,
|
| 807 |
+
1,
|
| 808 |
+
"LATENT"
|
| 809 |
+
],
|
| 810 |
+
[
|
| 811 |
+
225,
|
| 812 |
+
117,
|
| 813 |
+
0,
|
| 814 |
+
118,
|
| 815 |
+
1,
|
| 816 |
+
"LATENT"
|
| 817 |
+
],
|
| 818 |
+
[
|
| 819 |
+
226,
|
| 820 |
+
116,
|
| 821 |
+
0,
|
| 822 |
+
118,
|
| 823 |
+
0,
|
| 824 |
+
"STEPPE_UPSCALER"
|
| 825 |
+
],
|
| 826 |
+
[
|
| 827 |
+
227,
|
| 828 |
+
118,
|
| 829 |
+
0,
|
| 830 |
+
119,
|
| 831 |
+
0,
|
| 832 |
+
"LATENT"
|
| 833 |
+
],
|
| 834 |
+
[
|
| 835 |
+
228,
|
| 836 |
+
94,
|
| 837 |
+
0,
|
| 838 |
+
119,
|
| 839 |
+
1,
|
| 840 |
+
"VAE"
|
| 841 |
+
],
|
| 842 |
+
[
|
| 843 |
+
229,
|
| 844 |
+
94,
|
| 845 |
+
0,
|
| 846 |
+
120,
|
| 847 |
+
1,
|
| 848 |
+
"VAE"
|
| 849 |
+
],
|
| 850 |
+
[
|
| 851 |
+
230,
|
| 852 |
+
90,
|
| 853 |
+
0,
|
| 854 |
+
120,
|
| 855 |
+
0,
|
| 856 |
+
"LATENT"
|
| 857 |
+
],
|
| 858 |
+
[
|
| 859 |
+
231,
|
| 860 |
+
119,
|
| 861 |
+
0,
|
| 862 |
+
123,
|
| 863 |
+
0,
|
| 864 |
+
"IMAGE"
|
| 865 |
+
],
|
| 866 |
+
[
|
| 867 |
+
232,
|
| 868 |
+
120,
|
| 869 |
+
0,
|
| 870 |
+
122,
|
| 871 |
+
0,
|
| 872 |
+
"IMAGE"
|
| 873 |
+
],
|
| 874 |
+
[
|
| 875 |
+
233,
|
| 876 |
+
123,
|
| 877 |
+
0,
|
| 878 |
+
54,
|
| 879 |
+
0,
|
| 880 |
+
"IMAGE"
|
| 881 |
+
],
|
| 882 |
+
[
|
| 883 |
+
234,
|
| 884 |
+
122,
|
| 885 |
+
0,
|
| 886 |
+
54,
|
| 887 |
+
1,
|
| 888 |
+
"IMAGE"
|
| 889 |
+
]
|
| 890 |
+
],
|
| 891 |
+
"groups": [
|
| 892 |
+
{
|
| 893 |
+
"id": 14,
|
| 894 |
+
"title": "Low Resolution Image Generation",
|
| 895 |
+
"bounding": [
|
| 896 |
+
557.6681469748794,
|
| 897 |
+
-130.90990400163184,
|
| 898 |
+
1389.8331381461567,
|
| 899 |
+
688.4318007220108
|
| 900 |
+
],
|
| 901 |
+
"color": "#3f789e",
|
| 902 |
+
"flags": {}
|
| 903 |
+
},
|
| 904 |
+
{
|
| 905 |
+
"id": 11,
|
| 906 |
+
"title": "Models",
|
| 907 |
+
"bounding": [
|
| 908 |
+
575.5218339957727,
|
| 909 |
+
-89.33034684578035,
|
| 910 |
+
488.4005105096752,
|
| 911 |
+
626.0660823179378
|
| 912 |
+
],
|
| 913 |
+
"color": "#3f789e",
|
| 914 |
+
"flags": {}
|
| 915 |
+
},
|
| 916 |
+
{
|
| 917 |
+
"id": 15,
|
| 918 |
+
"title": "Settings",
|
| 919 |
+
"bounding": [
|
| 920 |
+
1085.947470141841,
|
| 921 |
+
-85.75782202549178,
|
| 922 |
+
492.78950319467504,
|
| 923 |
+
622.8770059119695
|
| 924 |
+
],
|
| 925 |
+
"color": "#3f789e",
|
| 926 |
+
"flags": {}
|
| 927 |
+
},
|
| 928 |
+
{
|
| 929 |
+
"id": 18,
|
| 930 |
+
"title": "Upscaling",
|
| 931 |
+
"bounding": [
|
| 932 |
+
1986.7313060666766,
|
| 933 |
+
-127.98657691092205,
|
| 934 |
+
600.549761905027,
|
| 935 |
+
449.56878053659204
|
| 936 |
+
],
|
| 937 |
+
"color": "#3f789e",
|
| 938 |
+
"flags": {}
|
| 939 |
+
},
|
| 940 |
+
{
|
| 941 |
+
"id": 19,
|
| 942 |
+
"title": "Decode",
|
| 943 |
+
"bounding": [
|
| 944 |
+
2615.3102626639316,
|
| 945 |
+
-128.29037162296012,
|
| 946 |
+
481.2435841763363,
|
| 947 |
+
452.4884748826904
|
| 948 |
+
],
|
| 949 |
+
"color": "#3f789e",
|
| 950 |
+
"flags": {}
|
| 951 |
+
},
|
| 952 |
+
{
|
| 953 |
+
"id": 20,
|
| 954 |
+
"title": "Preview and Save",
|
| 955 |
+
"bounding": [
|
| 956 |
+
3116.68847214444,
|
| 957 |
+
-130.1052235464211,
|
| 958 |
+
856.5444375624056,
|
| 959 |
+
679.8095804130401
|
| 960 |
+
],
|
| 961 |
+
"color": "#3f789e",
|
| 962 |
+
"flags": {}
|
| 963 |
+
}
|
| 964 |
+
],
|
| 965 |
+
"config": {},
|
| 966 |
+
"extra": {
|
| 967 |
+
"frontendVersion": "1.53.6",
|
| 968 |
+
"VHS_latentpreview": false,
|
| 969 |
+
"VHS_latentpreviewrate": 0,
|
| 970 |
+
"VHS_MetadataImage": true,
|
| 971 |
+
"VHS_KeepIntermediate": true,
|
| 972 |
+
"ds": {
|
| 973 |
+
"scale": 0.29408349370551556,
|
| 974 |
+
"offset": [
|
| 975 |
+
375.44610556431684,
|
| 976 |
+
1254.685025032415
|
| 977 |
+
]
|
| 978 |
+
}
|
| 979 |
+
},
|
| 980 |
+
"version": 0.4
|
| 981 |
+
}
|
example_workflows/wan_2.1_steppe_video_upscale_spatiotemporal.json
ADDED
|
@@ -0,0 +1,985 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "21720dda-bf84-4f0a-8469-a681c80e302e",
|
| 3 |
+
"revision": 0,
|
| 4 |
+
"last_node_id": 63,
|
| 5 |
+
"last_link_id": 122,
|
| 6 |
+
"nodes": [
|
| 7 |
+
{
|
| 8 |
+
"id": 38,
|
| 9 |
+
"type": "CLIPLoader",
|
| 10 |
+
"pos": [
|
| 11 |
+
-120,
|
| 12 |
+
170
|
| 13 |
+
],
|
| 14 |
+
"size": [
|
| 15 |
+
390,
|
| 16 |
+
106
|
| 17 |
+
],
|
| 18 |
+
"flags": {},
|
| 19 |
+
"order": 0,
|
| 20 |
+
"mode": 0,
|
| 21 |
+
"inputs": [],
|
| 22 |
+
"outputs": [
|
| 23 |
+
{
|
| 24 |
+
"name": "CLIP",
|
| 25 |
+
"type": "CLIP",
|
| 26 |
+
"slot_index": 0,
|
| 27 |
+
"links": [
|
| 28 |
+
74,
|
| 29 |
+
75
|
| 30 |
+
]
|
| 31 |
+
}
|
| 32 |
+
],
|
| 33 |
+
"properties": {
|
| 34 |
+
"Node name for S&R": "CLIPLoader",
|
| 35 |
+
"models": [
|
| 36 |
+
{
|
| 37 |
+
"name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
|
| 38 |
+
"url": "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors?download=true",
|
| 39 |
+
"directory": "text_encoders"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
},
|
| 43 |
+
"widgets_values": [
|
| 44 |
+
"umt5_xxl_fp8_e4m3fn_scaled.safetensors",
|
| 45 |
+
"wan",
|
| 46 |
+
"default"
|
| 47 |
+
],
|
| 48 |
+
"widgets_values_named": {
|
| 49 |
+
"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
|
| 50 |
+
"type": "wan",
|
| 51 |
+
"device": "default"
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"id": 39,
|
| 56 |
+
"type": "VAELoader",
|
| 57 |
+
"pos": [
|
| 58 |
+
-120,
|
| 59 |
+
320
|
| 60 |
+
],
|
| 61 |
+
"size": [
|
| 62 |
+
390,
|
| 63 |
+
60
|
| 64 |
+
],
|
| 65 |
+
"flags": {},
|
| 66 |
+
"order": 1,
|
| 67 |
+
"mode": 0,
|
| 68 |
+
"inputs": [],
|
| 69 |
+
"outputs": [
|
| 70 |
+
{
|
| 71 |
+
"name": "VAE",
|
| 72 |
+
"type": "VAE",
|
| 73 |
+
"slot_index": 0,
|
| 74 |
+
"links": [
|
| 75 |
+
76,
|
| 76 |
+
104
|
| 77 |
+
]
|
| 78 |
+
}
|
| 79 |
+
],
|
| 80 |
+
"properties": {
|
| 81 |
+
"Node name for S&R": "VAELoader",
|
| 82 |
+
"models": [
|
| 83 |
+
{
|
| 84 |
+
"name": "wan_2.1_vae.safetensors",
|
| 85 |
+
"url": "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors?download=true",
|
| 86 |
+
"directory": "vae"
|
| 87 |
+
}
|
| 88 |
+
]
|
| 89 |
+
},
|
| 90 |
+
"widgets_values": [
|
| 91 |
+
"wan_2.1_vae.safetensors"
|
| 92 |
+
],
|
| 93 |
+
"widgets_values_named": {
|
| 94 |
+
"vae_name": "wan_2.1_vae.safetensors"
|
| 95 |
+
}
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"id": 7,
|
| 99 |
+
"type": "CLIPTextEncode",
|
| 100 |
+
"pos": [
|
| 101 |
+
310,
|
| 102 |
+
250
|
| 103 |
+
],
|
| 104 |
+
"size": [
|
| 105 |
+
425.27801513671875,
|
| 106 |
+
180.6060791015625
|
| 107 |
+
],
|
| 108 |
+
"flags": {},
|
| 109 |
+
"order": 7,
|
| 110 |
+
"mode": 0,
|
| 111 |
+
"inputs": [
|
| 112 |
+
{
|
| 113 |
+
"name": "clip",
|
| 114 |
+
"type": "CLIP",
|
| 115 |
+
"link": 75
|
| 116 |
+
}
|
| 117 |
+
],
|
| 118 |
+
"outputs": [
|
| 119 |
+
{
|
| 120 |
+
"name": "CONDITIONING",
|
| 121 |
+
"type": "CONDITIONING",
|
| 122 |
+
"slot_index": 0,
|
| 123 |
+
"links": [
|
| 124 |
+
52
|
| 125 |
+
]
|
| 126 |
+
}
|
| 127 |
+
],
|
| 128 |
+
"title": "CLIP Text Encode (Negative Prompt)",
|
| 129 |
+
"properties": {
|
| 130 |
+
"Node name for S&R": "CLIPTextEncode"
|
| 131 |
+
},
|
| 132 |
+
"widgets_values": [
|
| 133 |
+
"Overly vivid tones, overexposed, static, blurry details, subtitles, stylized, artwork, painting, image, motionless, overall grayish cast, worst quality, low quality, JPEG compression artifacts, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn face, deformed, disfigured, malformed limbs, fused fingers, frozen scene, cluttered background, three legs, crowded background, walking backwards"
|
| 134 |
+
],
|
| 135 |
+
"widgets_values_named": {
|
| 136 |
+
"text": "Overly vivid tones, overexposed, static, blurry details, subtitles, stylized, artwork, painting, image, motionless, overall grayish cast, worst quality, low quality, JPEG compression artifacts, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn face, deformed, disfigured, malformed limbs, fused fingers, frozen scene, cluttered background, three legs, crowded background, walking backwards"
|
| 137 |
+
},
|
| 138 |
+
"color": "#322",
|
| 139 |
+
"bgcolor": "#533"
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"id": 6,
|
| 143 |
+
"type": "CLIPTextEncode",
|
| 144 |
+
"pos": [
|
| 145 |
+
310,
|
| 146 |
+
40
|
| 147 |
+
],
|
| 148 |
+
"size": [
|
| 149 |
+
422.84503173828125,
|
| 150 |
+
164.31304931640625
|
| 151 |
+
],
|
| 152 |
+
"flags": {},
|
| 153 |
+
"order": 6,
|
| 154 |
+
"mode": 0,
|
| 155 |
+
"inputs": [
|
| 156 |
+
{
|
| 157 |
+
"name": "clip",
|
| 158 |
+
"type": "CLIP",
|
| 159 |
+
"link": 74
|
| 160 |
+
}
|
| 161 |
+
],
|
| 162 |
+
"outputs": [
|
| 163 |
+
{
|
| 164 |
+
"name": "CONDITIONING",
|
| 165 |
+
"type": "CONDITIONING",
|
| 166 |
+
"slot_index": 0,
|
| 167 |
+
"links": [
|
| 168 |
+
46
|
| 169 |
+
]
|
| 170 |
+
}
|
| 171 |
+
],
|
| 172 |
+
"title": "CLIP Text Encode (Positive Prompt)",
|
| 173 |
+
"properties": {
|
| 174 |
+
"Node name for S&R": "CLIPTextEncode"
|
| 175 |
+
},
|
| 176 |
+
"widgets_values": [
|
| 177 |
+
"A cinematic macro shot in stunning 4K HDR, filmed at eye level with the camera aligned on the same axis as the cat and the cactus flower, so the cat's face and the bloom sit in a single straight line across the frame. The camera stays perfectly static throughout. During golden hour, warm amber sunlight falls directly on the cat's face, illuminating its eyes and fur as it slowly and deliberately leans in to examine the blooming cactus, whiskers twitching with curiosity. Shallow depth of field keeps the cat's sunlit face and the flower in razor-sharp focus against a softly blurred background. Midway through the shot, the cat blinks once, slowly and naturally, before continuing its inspection, while soft shadows and rich golden light wrap around the intimate scene."
|
| 178 |
+
],
|
| 179 |
+
"widgets_values_named": {
|
| 180 |
+
"text": "A cinematic macro shot in stunning 4K HDR, filmed at eye level with the camera aligned on the same axis as the cat and the cactus flower, so the cat's face and the bloom sit in a single straight line across the frame. The camera stays perfectly static throughout. During golden hour, warm amber sunlight falls directly on the cat's face, illuminating its eyes and fur as it slowly and deliberately leans in to examine the blooming cactus, whiskers twitching with curiosity. Shallow depth of field keeps the cat's sunlit face and the flower in razor-sharp focus against a softly blurred background. Midway through the shot, the cat blinks once, slowly and naturally, before continuing its inspection, while soft shadows and rich golden light wrap around the intimate scene."
|
| 181 |
+
},
|
| 182 |
+
"color": "#232",
|
| 183 |
+
"bgcolor": "#353"
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"id": 37,
|
| 187 |
+
"type": "UNETLoader",
|
| 188 |
+
"pos": [
|
| 189 |
+
-120,
|
| 190 |
+
40
|
| 191 |
+
],
|
| 192 |
+
"size": [
|
| 193 |
+
390,
|
| 194 |
+
82
|
| 195 |
+
],
|
| 196 |
+
"flags": {},
|
| 197 |
+
"order": 2,
|
| 198 |
+
"mode": 0,
|
| 199 |
+
"inputs": [],
|
| 200 |
+
"outputs": [
|
| 201 |
+
{
|
| 202 |
+
"name": "MODEL",
|
| 203 |
+
"type": "MODEL",
|
| 204 |
+
"slot_index": 0,
|
| 205 |
+
"links": [
|
| 206 |
+
94
|
| 207 |
+
]
|
| 208 |
+
}
|
| 209 |
+
],
|
| 210 |
+
"properties": {
|
| 211 |
+
"Node name for S&R": "UNETLoader",
|
| 212 |
+
"models": [
|
| 213 |
+
{
|
| 214 |
+
"name": "wan2.1_t2v_1.3B_fp16.safetensors",
|
| 215 |
+
"url": "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/diffusion_models/wan2.1_t2v_1.3B_fp16.safetensors?download=true",
|
| 216 |
+
"directory": "diffusion_models"
|
| 217 |
+
}
|
| 218 |
+
]
|
| 219 |
+
},
|
| 220 |
+
"widgets_values": [
|
| 221 |
+
"wan2.1_t2v_1.3B_fp16.safetensors",
|
| 222 |
+
"default"
|
| 223 |
+
],
|
| 224 |
+
"widgets_values_named": {
|
| 225 |
+
"unet_name": "wan2.1_t2v_1.3B_fp16.safetensors",
|
| 226 |
+
"weight_dtype": "default"
|
| 227 |
+
}
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"id": 40,
|
| 231 |
+
"type": "EmptyHunyuanLatentVideo",
|
| 232 |
+
"pos": [
|
| 233 |
+
318.42805074644343,
|
| 234 |
+
478.36709742762054
|
| 235 |
+
],
|
| 236 |
+
"size": [
|
| 237 |
+
315,
|
| 238 |
+
130
|
| 239 |
+
],
|
| 240 |
+
"flags": {},
|
| 241 |
+
"order": 3,
|
| 242 |
+
"mode": 0,
|
| 243 |
+
"inputs": [],
|
| 244 |
+
"outputs": [
|
| 245 |
+
{
|
| 246 |
+
"name": "LATENT",
|
| 247 |
+
"type": "LATENT",
|
| 248 |
+
"slot_index": 0,
|
| 249 |
+
"links": [
|
| 250 |
+
91
|
| 251 |
+
]
|
| 252 |
+
}
|
| 253 |
+
],
|
| 254 |
+
"properties": {
|
| 255 |
+
"Node name for S&R": "EmptyHunyuanLatentVideo"
|
| 256 |
+
},
|
| 257 |
+
"widgets_values": [
|
| 258 |
+
640,
|
| 259 |
+
512,
|
| 260 |
+
65,
|
| 261 |
+
1
|
| 262 |
+
],
|
| 263 |
+
"widgets_values_named": {
|
| 264 |
+
"width": 640,
|
| 265 |
+
"height": 512,
|
| 266 |
+
"length": 65,
|
| 267 |
+
"batch_size": 1
|
| 268 |
+
}
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"id": 8,
|
| 272 |
+
"type": "VAEDecode",
|
| 273 |
+
"pos": [
|
| 274 |
+
1604.768662062837,
|
| 275 |
+
43.96749818479392
|
| 276 |
+
],
|
| 277 |
+
"size": [
|
| 278 |
+
390.32391779820773,
|
| 279 |
+
46
|
| 280 |
+
],
|
| 281 |
+
"flags": {},
|
| 282 |
+
"order": 13,
|
| 283 |
+
"mode": 0,
|
| 284 |
+
"inputs": [
|
| 285 |
+
{
|
| 286 |
+
"name": "samples",
|
| 287 |
+
"type": "LATENT",
|
| 288 |
+
"link": 122
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"name": "vae",
|
| 292 |
+
"type": "VAE",
|
| 293 |
+
"link": 76
|
| 294 |
+
}
|
| 295 |
+
],
|
| 296 |
+
"outputs": [
|
| 297 |
+
{
|
| 298 |
+
"name": "IMAGE",
|
| 299 |
+
"type": "IMAGE",
|
| 300 |
+
"slot_index": 0,
|
| 301 |
+
"links": [
|
| 302 |
+
96
|
| 303 |
+
]
|
| 304 |
+
}
|
| 305 |
+
],
|
| 306 |
+
"properties": {
|
| 307 |
+
"Node name for S&R": "VAEDecode"
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
{
|
| 311 |
+
"id": 49,
|
| 312 |
+
"type": "CreateVideo",
|
| 313 |
+
"pos": [
|
| 314 |
+
1613.5794321889089,
|
| 315 |
+
135.65683814163557
|
| 316 |
+
],
|
| 317 |
+
"size": [
|
| 318 |
+
380.0679816086508,
|
| 319 |
+
150
|
| 320 |
+
],
|
| 321 |
+
"flags": {},
|
| 322 |
+
"order": 15,
|
| 323 |
+
"mode": 0,
|
| 324 |
+
"inputs": [
|
| 325 |
+
{
|
| 326 |
+
"name": "images",
|
| 327 |
+
"type": "IMAGE",
|
| 328 |
+
"link": 96
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"name": "audio",
|
| 332 |
+
"shape": 7,
|
| 333 |
+
"type": "AUDIO",
|
| 334 |
+
"link": null
|
| 335 |
+
}
|
| 336 |
+
],
|
| 337 |
+
"outputs": [
|
| 338 |
+
{
|
| 339 |
+
"name": "VIDEO",
|
| 340 |
+
"type": "VIDEO",
|
| 341 |
+
"links": [
|
| 342 |
+
97
|
| 343 |
+
]
|
| 344 |
+
}
|
| 345 |
+
],
|
| 346 |
+
"properties": {
|
| 347 |
+
"Node name for S&R": "CreateVideo"
|
| 348 |
+
},
|
| 349 |
+
"widgets_values": [
|
| 350 |
+
32,
|
| 351 |
+
"auto",
|
| 352 |
+
"sRGB",
|
| 353 |
+
"none"
|
| 354 |
+
],
|
| 355 |
+
"widgets_values_named": {
|
| 356 |
+
"fps": 32,
|
| 357 |
+
"bit_depth": "auto",
|
| 358 |
+
"color_space": "sRGB",
|
| 359 |
+
"codec": "none"
|
| 360 |
+
}
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"id": 3,
|
| 364 |
+
"type": "KSampler",
|
| 365 |
+
"pos": [
|
| 366 |
+
770,
|
| 367 |
+
160
|
| 368 |
+
],
|
| 369 |
+
"size": [
|
| 370 |
+
315,
|
| 371 |
+
262
|
| 372 |
+
],
|
| 373 |
+
"flags": {},
|
| 374 |
+
"order": 9,
|
| 375 |
+
"mode": 0,
|
| 376 |
+
"inputs": [
|
| 377 |
+
{
|
| 378 |
+
"name": "model",
|
| 379 |
+
"type": "MODEL",
|
| 380 |
+
"link": 95
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"name": "positive",
|
| 384 |
+
"type": "CONDITIONING",
|
| 385 |
+
"link": 46
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"name": "negative",
|
| 389 |
+
"type": "CONDITIONING",
|
| 390 |
+
"link": 52
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"name": "latent_image",
|
| 394 |
+
"type": "LATENT",
|
| 395 |
+
"link": 91
|
| 396 |
+
}
|
| 397 |
+
],
|
| 398 |
+
"outputs": [
|
| 399 |
+
{
|
| 400 |
+
"name": "LATENT",
|
| 401 |
+
"type": "LATENT",
|
| 402 |
+
"slot_index": 0,
|
| 403 |
+
"links": [
|
| 404 |
+
103,
|
| 405 |
+
121
|
| 406 |
+
]
|
| 407 |
+
}
|
| 408 |
+
],
|
| 409 |
+
"properties": {
|
| 410 |
+
"Node name for S&R": "KSampler"
|
| 411 |
+
},
|
| 412 |
+
"widgets_values": [
|
| 413 |
+
653018468280048,
|
| 414 |
+
"fixed",
|
| 415 |
+
30,
|
| 416 |
+
2.9,
|
| 417 |
+
"uni_pc",
|
| 418 |
+
"simple",
|
| 419 |
+
1
|
| 420 |
+
],
|
| 421 |
+
"widgets_values_named": {
|
| 422 |
+
"seed": 653018468280048,
|
| 423 |
+
"control_after_generate": "fixed",
|
| 424 |
+
"steps": 30,
|
| 425 |
+
"cfg": 2.9,
|
| 426 |
+
"sampler_name": "uni_pc",
|
| 427 |
+
"scheduler": "simple",
|
| 428 |
+
"denoise": 1
|
| 429 |
+
}
|
| 430 |
+
},
|
| 431 |
+
{
|
| 432 |
+
"id": 50,
|
| 433 |
+
"type": "SaveVideo",
|
| 434 |
+
"pos": [
|
| 435 |
+
3098.663434339084,
|
| 436 |
+
60.28748411538836
|
| 437 |
+
],
|
| 438 |
+
"size": [
|
| 439 |
+
994.7208740617662,
|
| 440 |
+
893.7766992494129
|
| 441 |
+
],
|
| 442 |
+
"flags": {},
|
| 443 |
+
"order": 16,
|
| 444 |
+
"mode": 0,
|
| 445 |
+
"inputs": [
|
| 446 |
+
{
|
| 447 |
+
"name": "video",
|
| 448 |
+
"type": "VIDEO",
|
| 449 |
+
"link": 97
|
| 450 |
+
}
|
| 451 |
+
],
|
| 452 |
+
"outputs": [
|
| 453 |
+
{
|
| 454 |
+
"name": "video",
|
| 455 |
+
"type": "VIDEO",
|
| 456 |
+
"links": null
|
| 457 |
+
}
|
| 458 |
+
],
|
| 459 |
+
"properties": {
|
| 460 |
+
"Node name for S&R": "SaveVideo"
|
| 461 |
+
},
|
| 462 |
+
"widgets_values": [
|
| 463 |
+
"video/steppe_demo_high_res",
|
| 464 |
+
"auto",
|
| 465 |
+
"auto",
|
| 466 |
+
"auto"
|
| 467 |
+
],
|
| 468 |
+
"widgets_values_named": {
|
| 469 |
+
"filename_prefix": "video/steppe_demo_high_res",
|
| 470 |
+
"format": "auto",
|
| 471 |
+
"format.codec": "auto",
|
| 472 |
+
"codec": "auto"
|
| 473 |
+
}
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
"id": 48,
|
| 477 |
+
"type": "ModelSamplingSD3",
|
| 478 |
+
"pos": [
|
| 479 |
+
772.9795441344316,
|
| 480 |
+
37.02045586556828
|
| 481 |
+
],
|
| 482 |
+
"size": [
|
| 483 |
+
210,
|
| 484 |
+
58
|
| 485 |
+
],
|
| 486 |
+
"flags": {},
|
| 487 |
+
"order": 8,
|
| 488 |
+
"mode": 0,
|
| 489 |
+
"inputs": [
|
| 490 |
+
{
|
| 491 |
+
"name": "model",
|
| 492 |
+
"type": "MODEL",
|
| 493 |
+
"link": 94
|
| 494 |
+
}
|
| 495 |
+
],
|
| 496 |
+
"outputs": [
|
| 497 |
+
{
|
| 498 |
+
"name": "MODEL",
|
| 499 |
+
"type": "MODEL",
|
| 500 |
+
"slot_index": 0,
|
| 501 |
+
"links": [
|
| 502 |
+
95
|
| 503 |
+
]
|
| 504 |
+
}
|
| 505 |
+
],
|
| 506 |
+
"properties": {
|
| 507 |
+
"Node name for S&R": "ModelSamplingSD3"
|
| 508 |
+
},
|
| 509 |
+
"widgets_values": [
|
| 510 |
+
8
|
| 511 |
+
],
|
| 512 |
+
"widgets_values_named": {
|
| 513 |
+
"shift": 8
|
| 514 |
+
}
|
| 515 |
+
},
|
| 516 |
+
{
|
| 517 |
+
"id": 54,
|
| 518 |
+
"type": "VAEDecode",
|
| 519 |
+
"pos": [
|
| 520 |
+
1617.443443727045,
|
| 521 |
+
339.17366000546707
|
| 522 |
+
],
|
| 523 |
+
"size": [
|
| 524 |
+
372.8610232958458,
|
| 525 |
+
46
|
| 526 |
+
],
|
| 527 |
+
"flags": {},
|
| 528 |
+
"order": 10,
|
| 529 |
+
"mode": 0,
|
| 530 |
+
"inputs": [
|
| 531 |
+
{
|
| 532 |
+
"name": "samples",
|
| 533 |
+
"type": "LATENT",
|
| 534 |
+
"link": 103
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"name": "vae",
|
| 538 |
+
"type": "VAE",
|
| 539 |
+
"link": 104
|
| 540 |
+
}
|
| 541 |
+
],
|
| 542 |
+
"outputs": [
|
| 543 |
+
{
|
| 544 |
+
"name": "IMAGE",
|
| 545 |
+
"type": "IMAGE",
|
| 546 |
+
"slot_index": 0,
|
| 547 |
+
"links": [
|
| 548 |
+
105
|
| 549 |
+
]
|
| 550 |
+
}
|
| 551 |
+
],
|
| 552 |
+
"properties": {
|
| 553 |
+
"Node name for S&R": "VAEDecode"
|
| 554 |
+
}
|
| 555 |
+
},
|
| 556 |
+
{
|
| 557 |
+
"id": 55,
|
| 558 |
+
"type": "CreateVideo",
|
| 559 |
+
"pos": [
|
| 560 |
+
1619.8364959251805,
|
| 561 |
+
436.80432714676493
|
| 562 |
+
],
|
| 563 |
+
"size": [
|
| 564 |
+
371.7882121753803,
|
| 565 |
+
150
|
| 566 |
+
],
|
| 567 |
+
"flags": {},
|
| 568 |
+
"order": 12,
|
| 569 |
+
"mode": 0,
|
| 570 |
+
"inputs": [
|
| 571 |
+
{
|
| 572 |
+
"name": "images",
|
| 573 |
+
"type": "IMAGE",
|
| 574 |
+
"link": 105
|
| 575 |
+
},
|
| 576 |
+
{
|
| 577 |
+
"name": "audio",
|
| 578 |
+
"shape": 7,
|
| 579 |
+
"type": "AUDIO",
|
| 580 |
+
"link": null
|
| 581 |
+
}
|
| 582 |
+
],
|
| 583 |
+
"outputs": [
|
| 584 |
+
{
|
| 585 |
+
"name": "VIDEO",
|
| 586 |
+
"type": "VIDEO",
|
| 587 |
+
"links": [
|
| 588 |
+
106
|
| 589 |
+
]
|
| 590 |
+
}
|
| 591 |
+
],
|
| 592 |
+
"properties": {
|
| 593 |
+
"Node name for S&R": "CreateVideo"
|
| 594 |
+
},
|
| 595 |
+
"widgets_values": [
|
| 596 |
+
16,
|
| 597 |
+
"auto",
|
| 598 |
+
"sRGB",
|
| 599 |
+
"none"
|
| 600 |
+
],
|
| 601 |
+
"widgets_values_named": {
|
| 602 |
+
"fps": 16,
|
| 603 |
+
"bit_depth": "auto",
|
| 604 |
+
"color_space": "sRGB",
|
| 605 |
+
"codec": "none"
|
| 606 |
+
}
|
| 607 |
+
},
|
| 608 |
+
{
|
| 609 |
+
"id": 56,
|
| 610 |
+
"type": "SaveVideo",
|
| 611 |
+
"pos": [
|
| 612 |
+
2074.7294477020077,
|
| 613 |
+
54.77479543117079
|
| 614 |
+
],
|
| 615 |
+
"size": [
|
| 616 |
+
998.135121163089,
|
| 617 |
+
896.5080969304713
|
| 618 |
+
],
|
| 619 |
+
"flags": {},
|
| 620 |
+
"order": 14,
|
| 621 |
+
"mode": 0,
|
| 622 |
+
"inputs": [
|
| 623 |
+
{
|
| 624 |
+
"name": "video",
|
| 625 |
+
"type": "VIDEO",
|
| 626 |
+
"link": 106
|
| 627 |
+
}
|
| 628 |
+
],
|
| 629 |
+
"outputs": [
|
| 630 |
+
{
|
| 631 |
+
"name": "video",
|
| 632 |
+
"type": "VIDEO",
|
| 633 |
+
"links": []
|
| 634 |
+
}
|
| 635 |
+
],
|
| 636 |
+
"properties": {
|
| 637 |
+
"Node name for S&R": "SaveVideo"
|
| 638 |
+
},
|
| 639 |
+
"widgets_values": [
|
| 640 |
+
"video/steppe_demo_low_res",
|
| 641 |
+
"auto",
|
| 642 |
+
"auto",
|
| 643 |
+
"auto"
|
| 644 |
+
],
|
| 645 |
+
"widgets_values_named": {
|
| 646 |
+
"filename_prefix": "video/steppe_demo_low_res",
|
| 647 |
+
"format": "auto",
|
| 648 |
+
"format.codec": "auto",
|
| 649 |
+
"codec": "auto"
|
| 650 |
+
}
|
| 651 |
+
},
|
| 652 |
+
{
|
| 653 |
+
"id": 61,
|
| 654 |
+
"type": "SteppeLoadUpscaler",
|
| 655 |
+
"pos": [
|
| 656 |
+
1141.693740297831,
|
| 657 |
+
43.53527045928457
|
| 658 |
+
],
|
| 659 |
+
"size": [
|
| 660 |
+
401.61646552938737,
|
| 661 |
+
82.90291220128154
|
| 662 |
+
],
|
| 663 |
+
"flags": {},
|
| 664 |
+
"order": 4,
|
| 665 |
+
"mode": 0,
|
| 666 |
+
"inputs": [],
|
| 667 |
+
"outputs": [
|
| 668 |
+
{
|
| 669 |
+
"name": "upscaler",
|
| 670 |
+
"type": "STEPPE_UPSCALER",
|
| 671 |
+
"links": [
|
| 672 |
+
120
|
| 673 |
+
]
|
| 674 |
+
}
|
| 675 |
+
],
|
| 676 |
+
"properties": {
|
| 677 |
+
"Node name for S&R": "SteppeLoadUpscaler"
|
| 678 |
+
},
|
| 679 |
+
"widgets_values": [
|
| 680 |
+
"steppe_wan_2_1_200M_1step.safetensors",
|
| 681 |
+
"auto"
|
| 682 |
+
],
|
| 683 |
+
"widgets_values_named": {
|
| 684 |
+
"model_name": "steppe_wan_2_1_200M_1step.safetensors",
|
| 685 |
+
"dtype": "auto"
|
| 686 |
+
}
|
| 687 |
+
},
|
| 688 |
+
{
|
| 689 |
+
"id": 62,
|
| 690 |
+
"type": "SteppeUpscaleLatent",
|
| 691 |
+
"pos": [
|
| 692 |
+
1145.3712775375616,
|
| 693 |
+
174.05156144826628
|
| 694 |
+
],
|
| 695 |
+
"size": [
|
| 696 |
+
396.40488263352927,
|
| 697 |
+
222
|
| 698 |
+
],
|
| 699 |
+
"flags": {},
|
| 700 |
+
"order": 11,
|
| 701 |
+
"mode": 0,
|
| 702 |
+
"inputs": [
|
| 703 |
+
{
|
| 704 |
+
"name": "upscaler",
|
| 705 |
+
"type": "STEPPE_UPSCALER",
|
| 706 |
+
"link": 120
|
| 707 |
+
},
|
| 708 |
+
{
|
| 709 |
+
"name": "latent",
|
| 710 |
+
"type": "LATENT",
|
| 711 |
+
"link": 121
|
| 712 |
+
}
|
| 713 |
+
],
|
| 714 |
+
"outputs": [
|
| 715 |
+
{
|
| 716 |
+
"name": "LATENT",
|
| 717 |
+
"type": "LATENT",
|
| 718 |
+
"links": [
|
| 719 |
+
122
|
| 720 |
+
]
|
| 721 |
+
}
|
| 722 |
+
],
|
| 723 |
+
"properties": {
|
| 724 |
+
"Node name for S&R": "SteppeUpscaleLatent"
|
| 725 |
+
},
|
| 726 |
+
"widgets_values": [
|
| 727 |
+
true,
|
| 728 |
+
true,
|
| 729 |
+
0.9,
|
| 730 |
+
1,
|
| 731 |
+
1,
|
| 732 |
+
1028731149352470,
|
| 733 |
+
"randomize"
|
| 734 |
+
],
|
| 735 |
+
"widgets_values_named": {
|
| 736 |
+
"spatial": true,
|
| 737 |
+
"temporal": true,
|
| 738 |
+
"hff": 0.9,
|
| 739 |
+
"guidance": 1,
|
| 740 |
+
"steps": 1,
|
| 741 |
+
"seed": 1028731149352470,
|
| 742 |
+
"control_after_generate": "randomize"
|
| 743 |
+
}
|
| 744 |
+
},
|
| 745 |
+
{
|
| 746 |
+
"id": 63,
|
| 747 |
+
"type": "MarkdownNote",
|
| 748 |
+
"pos": [
|
| 749 |
+
-545.122272727087,
|
| 750 |
+
4.26729218443513
|
| 751 |
+
],
|
| 752 |
+
"size": [
|
| 753 |
+
393.99366648793193,
|
| 754 |
+
620.2512169937215
|
| 755 |
+
],
|
| 756 |
+
"flags": {},
|
| 757 |
+
"order": 5,
|
| 758 |
+
"mode": 0,
|
| 759 |
+
"inputs": [],
|
| 760 |
+
"outputs": [],
|
| 761 |
+
"title": "Model Links",
|
| 762 |
+
"properties": {},
|
| 763 |
+
"widgets_values": [
|
| 764 |
+
"## Model Links\n\n**diffusion_models**\n\n- [wan2.1_t2v_1.3B_fp16.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/diffusion_models/wan2.1_t2v_1.3B_fp16.safetensors)\n\n**text_encoders**\n\n- [umt5_xxl_fp8_e4m3fn_scaled.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors)\n\n**latent upscaler**\n\n- [steppe_wan_2_1_200M_1step.safetensors](https://huggingface.co/TensorForger/Steppe-Wan2.1/resolve/main/steppe_wan_2_1_200M_1step.safetensors)\n\n**vae**\n\n- [wan_2.1_vae.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/vae/wan_2.1_vae.safetensors)\n\n\n\n## Model Storage Location\n\n```\n\ud83d\udcc2 ComfyUI/\n\u251c\u2500\u2500 \ud83d\udcc2 models/\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 diffusion_models/\n\u2502 \u2502 \u2514\u2500\u2500 wan2.1_t2v_1.3B_fp16.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 text_encoders/\n\u2502 \u2502 \u2514\u2500\u2500 umt5_xxl_fp8_e4m3fn_scaled.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 latent_upscale_models/\n\u2502 \u2502 \u2514\u2500\u2500 steppe_wan_2_1_200M_1step.safetensors\n\u2502 \u2514\u2500\u2500 \ud83d\udcc2 vae/\n\u2502 \u2514\u2500\u2500 wan_2.1_vae.safetensors\n```\n\n## Custom Nodes\n\n- [ComfyUI-Steppe](https://github.com/tensorforger/ComfyUI-Steppe)\n\n"
|
| 765 |
+
],
|
| 766 |
+
"widgets_values_named": {
|
| 767 |
+
"text": "## Model Links\n\n**diffusion_models**\n\n- [wan2.1_t2v_1.3B_fp16.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/diffusion_models/wan2.1_t2v_1.3B_fp16.safetensors)\n\n**text_encoders**\n\n- [umt5_xxl_fp8_e4m3fn_scaled.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors)\n\n**latent upscaler**\n\n- [steppe_wan_2_1_200M_1step.safetensors](https://huggingface.co/TensorForger/Steppe-Wan2.1/resolve/main/steppe_wan_2_1_200M_1step.safetensors)\n\n**vae**\n\n- [steppe_wan_2_1_200M_1step.safetensors](https://huggingface.co/Comfy-Org/Wan-2.1/resolve/main/split_files/vae/wan_2.1_vae.safetensors)\n\n\n\n## Model Storage Location\n\n```\n\ud83d\udcc2 ComfyUI/\n\u251c\u2500\u2500 \ud83d\udcc2 models/\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 diffusion_models/\n\u2502 \u2502 \u2514\u2500\u2500 wan2.1_t2v_1.3B_fp16.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 text_encoders/\n\u2502 \u2502 \u2514\u2500\u2500 umt5_xxl_fp8_e4m3fn_scaled.safetensors\n\u2502 \u251c\u2500\u2500 \ud83d\udcc2 latent_upscale_models/\n\u2502 \u2502 \u2514\u2500\u2500 steppe_wan_2_1_200M_1step.safetensors\n\u2502 \u2514\u2500\u2500 \ud83d\udcc2 vae/\n\u2502 \u2514\u2500\u2500 wan_2.1_vae.safetensors\n```\n\n## Custom Nodes\n\n- [ComfyUI-Steppe](https://github.com/tensorforger/ComfyUI-Steppe)\n\n"
|
| 768 |
+
},
|
| 769 |
+
"color": "#222",
|
| 770 |
+
"bgcolor": "#000"
|
| 771 |
+
}
|
| 772 |
+
],
|
| 773 |
+
"links": [
|
| 774 |
+
[
|
| 775 |
+
46,
|
| 776 |
+
6,
|
| 777 |
+
0,
|
| 778 |
+
3,
|
| 779 |
+
1,
|
| 780 |
+
"CONDITIONING"
|
| 781 |
+
],
|
| 782 |
+
[
|
| 783 |
+
52,
|
| 784 |
+
7,
|
| 785 |
+
0,
|
| 786 |
+
3,
|
| 787 |
+
2,
|
| 788 |
+
"CONDITIONING"
|
| 789 |
+
],
|
| 790 |
+
[
|
| 791 |
+
74,
|
| 792 |
+
38,
|
| 793 |
+
0,
|
| 794 |
+
6,
|
| 795 |
+
0,
|
| 796 |
+
"CLIP"
|
| 797 |
+
],
|
| 798 |
+
[
|
| 799 |
+
75,
|
| 800 |
+
38,
|
| 801 |
+
0,
|
| 802 |
+
7,
|
| 803 |
+
0,
|
| 804 |
+
"CLIP"
|
| 805 |
+
],
|
| 806 |
+
[
|
| 807 |
+
76,
|
| 808 |
+
39,
|
| 809 |
+
0,
|
| 810 |
+
8,
|
| 811 |
+
1,
|
| 812 |
+
"VAE"
|
| 813 |
+
],
|
| 814 |
+
[
|
| 815 |
+
91,
|
| 816 |
+
40,
|
| 817 |
+
0,
|
| 818 |
+
3,
|
| 819 |
+
3,
|
| 820 |
+
"LATENT"
|
| 821 |
+
],
|
| 822 |
+
[
|
| 823 |
+
94,
|
| 824 |
+
37,
|
| 825 |
+
0,
|
| 826 |
+
48,
|
| 827 |
+
0,
|
| 828 |
+
"MODEL"
|
| 829 |
+
],
|
| 830 |
+
[
|
| 831 |
+
95,
|
| 832 |
+
48,
|
| 833 |
+
0,
|
| 834 |
+
3,
|
| 835 |
+
0,
|
| 836 |
+
"MODEL"
|
| 837 |
+
],
|
| 838 |
+
[
|
| 839 |
+
96,
|
| 840 |
+
8,
|
| 841 |
+
0,
|
| 842 |
+
49,
|
| 843 |
+
0,
|
| 844 |
+
"IMAGE"
|
| 845 |
+
],
|
| 846 |
+
[
|
| 847 |
+
103,
|
| 848 |
+
3,
|
| 849 |
+
0,
|
| 850 |
+
54,
|
| 851 |
+
0,
|
| 852 |
+
"LATENT"
|
| 853 |
+
],
|
| 854 |
+
[
|
| 855 |
+
104,
|
| 856 |
+
39,
|
| 857 |
+
0,
|
| 858 |
+
54,
|
| 859 |
+
1,
|
| 860 |
+
"VAE"
|
| 861 |
+
],
|
| 862 |
+
[
|
| 863 |
+
105,
|
| 864 |
+
54,
|
| 865 |
+
0,
|
| 866 |
+
55,
|
| 867 |
+
0,
|
| 868 |
+
"IMAGE"
|
| 869 |
+
],
|
| 870 |
+
[
|
| 871 |
+
120,
|
| 872 |
+
61,
|
| 873 |
+
0,
|
| 874 |
+
62,
|
| 875 |
+
0,
|
| 876 |
+
"STEPPE_UPSCALER"
|
| 877 |
+
],
|
| 878 |
+
[
|
| 879 |
+
121,
|
| 880 |
+
3,
|
| 881 |
+
0,
|
| 882 |
+
62,
|
| 883 |
+
1,
|
| 884 |
+
"LATENT"
|
| 885 |
+
],
|
| 886 |
+
[
|
| 887 |
+
122,
|
| 888 |
+
62,
|
| 889 |
+
0,
|
| 890 |
+
8,
|
| 891 |
+
0,
|
| 892 |
+
"LATENT"
|
| 893 |
+
],
|
| 894 |
+
[
|
| 895 |
+
97,
|
| 896 |
+
49,
|
| 897 |
+
0,
|
| 898 |
+
50,
|
| 899 |
+
0,
|
| 900 |
+
"VIDEO"
|
| 901 |
+
],
|
| 902 |
+
[
|
| 903 |
+
106,
|
| 904 |
+
55,
|
| 905 |
+
0,
|
| 906 |
+
56,
|
| 907 |
+
0,
|
| 908 |
+
"VIDEO"
|
| 909 |
+
]
|
| 910 |
+
],
|
| 911 |
+
"groups": [
|
| 912 |
+
{
|
| 913 |
+
"id": 1,
|
| 914 |
+
"title": "Generate Low Resolution Video",
|
| 915 |
+
"bounding": [
|
| 916 |
+
300,
|
| 917 |
+
-30,
|
| 918 |
+
800.0825602109473,
|
| 919 |
+
655.9707567197318
|
| 920 |
+
],
|
| 921 |
+
"color": "#3f789e",
|
| 922 |
+
"flags": {}
|
| 923 |
+
},
|
| 924 |
+
{
|
| 925 |
+
"id": 2,
|
| 926 |
+
"title": "Load models",
|
| 927 |
+
"bounding": [
|
| 928 |
+
-130,
|
| 929 |
+
-30,
|
| 930 |
+
410,
|
| 931 |
+
423.6000061035156
|
| 932 |
+
],
|
| 933 |
+
"color": "#3f789e",
|
| 934 |
+
"flags": {}
|
| 935 |
+
},
|
| 936 |
+
{
|
| 937 |
+
"id": 3,
|
| 938 |
+
"title": "Upscale",
|
| 939 |
+
"bounding": [
|
| 940 |
+
1124.7974565947115,
|
| 941 |
+
-28.33899068442555,
|
| 942 |
+
436.69482620304757,
|
| 943 |
+
447.3721468258962
|
| 944 |
+
],
|
| 945 |
+
"color": "#3f789e",
|
| 946 |
+
"flags": {}
|
| 947 |
+
},
|
| 948 |
+
{
|
| 949 |
+
"id": 4,
|
| 950 |
+
"title": "Decode",
|
| 951 |
+
"bounding": [
|
| 952 |
+
1584.1046287954157,
|
| 953 |
+
-28.30441514275504,
|
| 954 |
+
431.5975504357659,
|
| 955 |
+
630.3437779286668
|
| 956 |
+
],
|
| 957 |
+
"color": "#3f789e",
|
| 958 |
+
"flags": {}
|
| 959 |
+
},
|
| 960 |
+
{
|
| 961 |
+
"id": 5,
|
| 962 |
+
"title": "Preview and Save",
|
| 963 |
+
"bounding": [
|
| 964 |
+
2038.2593722722243,
|
| 965 |
+
-26.232636341059614,
|
| 966 |
+
2089.445966192833,
|
| 967 |
+
999.3286298198036
|
| 968 |
+
],
|
| 969 |
+
"color": "#3f789e",
|
| 970 |
+
"flags": {}
|
| 971 |
+
}
|
| 972 |
+
],
|
| 973 |
+
"config": {},
|
| 974 |
+
"extra": {
|
| 975 |
+
"ds": {
|
| 976 |
+
"scale": 0.5209868481924583,
|
| 977 |
+
"offset": [
|
| 978 |
+
964.2794763263353,
|
| 979 |
+
673.6271331283731
|
| 980 |
+
]
|
| 981 |
+
},
|
| 982 |
+
"frontendVersion": "1.53.6"
|
| 983 |
+
},
|
| 984 |
+
"version": 0.4
|
| 985 |
+
}
|
nodes.py
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
ComfyUI nodes of Steppe generative latent upscalers. Models live in models/latent_upscale_models; released models
|
| 3 |
+
are listed even when missing and are downloaded from Hugging Face on first use.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import logging
|
| 7 |
+
import os
|
| 8 |
+
from dataclasses import replace
|
| 9 |
+
|
| 10 |
+
import torch
|
| 11 |
+
|
| 12 |
+
import comfy.model_management
|
| 13 |
+
import comfy.model_patcher
|
| 14 |
+
import comfy.utils
|
| 15 |
+
import folder_paths
|
| 16 |
+
|
| 17 |
+
from .steppe import catalog
|
| 18 |
+
from .steppe.hff import compute_raw_immerkaer, quantile_normalize
|
| 19 |
+
from .steppe.model import SteppeUpscaler, load_upscaler_file, parse_model_info, read_metadata
|
| 20 |
+
from .steppe.sampling import UpscaleSettings, count_model_passes, count_temporal_windows, target_size_of
|
| 21 |
+
|
| 22 |
+
logger = logging.getLogger("steppe")
|
| 23 |
+
|
| 24 |
+
MODEL_FOLDER_NAME = "latent_upscale_models"
|
| 25 |
+
CATEGORY = "Steppe"
|
| 26 |
+
UPSCALER_TYPE = "STEPPE_UPSCALER"
|
| 27 |
+
DTYPES = {"bfloat16": torch.bfloat16, "float32": torch.float32}
|
| 28 |
+
BYTES_PER_TOKEN_FACTOR = 10
|
| 29 |
+
CHUNK_BYTES_FACTOR = 6
|
| 30 |
+
|
| 31 |
+
HFF_TOOLTIP = (
|
| 32 |
+
"High frequency feature: target sharpness / fine detail of the upscaled result, [0...1] "
|
| 33 |
+
"(Immerkaer estimate, ReLAION calibrated). -1 = no hff, the model decides itself. "
|
| 34 |
+
"Use 'Steppe Measure HFF' to take it from a reference image."
|
| 35 |
+
)
|
| 36 |
+
GUIDANCE_TOOLTIP = (
|
| 37 |
+
"1-step models: distilled guidance (trained on 1-3, no extra cost); 1 = off (default, safe and stable), 2 also works well. "
|
| 38 |
+
"Base model: classifier free guidance between hff and negative hff (null by default); "
|
| 39 |
+
"the hff effect is subtle, so larger values (4-8) are needed for a visible change. 1 = off (2x faster)."
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def register_model_folder() -> None:
|
| 44 |
+
if MODEL_FOLDER_NAME not in folder_paths.folder_names_and_paths:
|
| 45 |
+
folder_paths.folder_names_and_paths[MODEL_FOLDER_NAME] = (
|
| 46 |
+
[os.path.join(folder_paths.models_dir, MODEL_FOLDER_NAME)],
|
| 47 |
+
{".safetensors"},
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def model_directory() -> str:
|
| 52 |
+
return folder_paths.get_folder_paths(MODEL_FOLDER_NAME)[0]
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def list_models() -> list[str]:
|
| 56 |
+
"""
|
| 57 |
+
returns:
|
| 58 |
+
released models (present or downloadable) first, then other local Steppe model files
|
| 59 |
+
"""
|
| 60 |
+
register_model_folder()
|
| 61 |
+
local = []
|
| 62 |
+
for file_name in folder_paths.get_filename_list(MODEL_FOLDER_NAME):
|
| 63 |
+
if file_name in catalog.CATALOG_BY_FILE_NAME:
|
| 64 |
+
continue
|
| 65 |
+
try:
|
| 66 |
+
path = folder_paths.get_full_path(MODEL_FOLDER_NAME, file_name)
|
| 67 |
+
if parse_model_info(path, read_metadata(path)) is not None:
|
| 68 |
+
local.append(file_name)
|
| 69 |
+
except Exception:
|
| 70 |
+
continue
|
| 71 |
+
return [entry.file_name for entry in catalog.CATALOG] + local
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def resolve_model_path(model_name: str) -> str:
|
| 75 |
+
register_model_folder()
|
| 76 |
+
path = folder_paths.get_full_path(MODEL_FOLDER_NAME, model_name)
|
| 77 |
+
if path is not None:
|
| 78 |
+
return path
|
| 79 |
+
entry = catalog.CATALOG_BY_FILE_NAME.get(model_name)
|
| 80 |
+
if entry is None:
|
| 81 |
+
raise FileNotFoundError(f"{model_name} not found in models/{MODEL_FOLDER_NAME}")
|
| 82 |
+
return catalog.download_model(entry, model_directory())
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class SteppeModel:
|
| 86 |
+
"""
|
| 87 |
+
Loaded upscaler plus the ComfyUI model patcher that moves it between devices under memory management.
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
def __init__(self, upscaler: SteppeUpscaler) -> None:
|
| 91 |
+
self.upscaler = upscaler
|
| 92 |
+
self.patcher = comfy.model_patcher.ModelPatcher(
|
| 93 |
+
upscaler.model,
|
| 94 |
+
load_device=comfy.model_management.get_torch_device(),
|
| 95 |
+
offload_device=comfy.model_management.unet_offload_device(),
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def resolve_dtype(dtype_name: str) -> torch.dtype:
|
| 100 |
+
if dtype_name != "auto":
|
| 101 |
+
return DTYPES[dtype_name]
|
| 102 |
+
device = comfy.model_management.get_torch_device()
|
| 103 |
+
try:
|
| 104 |
+
use_bf16 = comfy.model_management.should_use_bf16(device)
|
| 105 |
+
except Exception:
|
| 106 |
+
use_bf16 = torch.cuda.is_available() and torch.cuda.is_bf16_supported()
|
| 107 |
+
return torch.bfloat16 if use_bf16 else torch.float32
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
class SteppeLoadUpscaler:
|
| 111 |
+
CATEGORY = CATEGORY
|
| 112 |
+
RETURN_TYPES = (UPSCALER_TYPE,)
|
| 113 |
+
RETURN_NAMES = ("upscaler",)
|
| 114 |
+
FUNCTION = "load"
|
| 115 |
+
DESCRIPTION = "Loads a Steppe latent upscaler. Released models are downloaded from Hugging Face on first use."
|
| 116 |
+
|
| 117 |
+
@classmethod
|
| 118 |
+
def INPUT_TYPES(cls) -> dict:
|
| 119 |
+
descriptions = "; ".join(f"{entry.file_name}: {entry.description}" for entry in catalog.CATALOG)
|
| 120 |
+
return {
|
| 121 |
+
"required": {
|
| 122 |
+
"model_name": (list_models(), {"tooltip": f"Missing released models are downloaded. {descriptions}"}),
|
| 123 |
+
"dtype": (["auto", *DTYPES], {"default": "auto", "tooltip": "auto = bfloat16 where supported."}),
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
def load(self, model_name: str, dtype: str) -> tuple[SteppeModel]:
|
| 128 |
+
path = resolve_model_path(model_name)
|
| 129 |
+
upscaler = load_upscaler_file(path, resolve_dtype(dtype))
|
| 130 |
+
entry = catalog.CATALOG_BY_FILE_NAME.get(model_name)
|
| 131 |
+
if entry is not None:
|
| 132 |
+
catalog.report_updates(entry.repository, entry.file_name, upscaler.info.version)
|
| 133 |
+
return (SteppeModel(upscaler),)
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def estimate_memory(upscaler: SteppeUpscaler, samples_shape: tuple[int, ...], settings: UpscaleSettings) -> float:
|
| 137 |
+
"""
|
| 138 |
+
returns:
|
| 139 |
+
rough peak activation memory in bytes of one sample and temporal window
|
| 140 |
+
"""
|
| 141 |
+
source_frames, height, width = samples_shape[2:]
|
| 142 |
+
if settings.temporal_window > 0:
|
| 143 |
+
source_frames = min(source_frames, settings.temporal_window + settings.temporal_context)
|
| 144 |
+
frames, target_height, target_width = target_size_of((source_frames, height, width), settings.spatial, settings.temporal)
|
| 145 |
+
config = upscaler.model.config
|
| 146 |
+
element_size = torch.finfo(upscaler.model.dtype).bits // 8
|
| 147 |
+
tokens = frames * target_height * target_width
|
| 148 |
+
chunk_tokens = max(target_height * target_width, 65536)
|
| 149 |
+
return element_size * (
|
| 150 |
+
BYTES_PER_TOKEN_FACTOR * tokens * config.width + CHUNK_BYTES_FACTOR * chunk_tokens * config.mlp_hidden
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def run_upscale(model: SteppeModel, latent: dict, settings: UpscaleSettings) -> tuple[dict]:
|
| 155 |
+
upscaler = model.upscaler
|
| 156 |
+
samples = latent["samples"]
|
| 157 |
+
space = upscaler.latent_space
|
| 158 |
+
if samples.ndim not in (4, 5) or samples.shape[1] != space.channels:
|
| 159 |
+
raise ValueError(
|
| 160 |
+
f"{upscaler.info.name} upscales {space.display_name} latents ({space.channels} channels: Wan 2.1, "
|
| 161 |
+
f"Wan 2.2 14B, Qwen-Image and other models using this VAE), got shape {tuple(samples.shape)}. "
|
| 162 |
+
"Wan 2.2 5B uses a different VAE (48 channels) and is not supported."
|
| 163 |
+
)
|
| 164 |
+
frames = samples.shape[2] if samples.ndim == 5 else 1
|
| 165 |
+
temporal = settings.temporal and frames > 1
|
| 166 |
+
if not settings.spatial and not temporal:
|
| 167 |
+
logger.warning("Steppe: nothing to upscale (spatial off, temporal off or single frame)")
|
| 168 |
+
return (latent,)
|
| 169 |
+
settings = replace(settings, temporal=temporal)
|
| 170 |
+
layout_shape = samples.shape if samples.ndim == 5 else (samples.shape[0], samples.shape[1], 1, *samples.shape[2:])
|
| 171 |
+
memory_required = estimate_memory(upscaler, tuple(layout_shape), settings)
|
| 172 |
+
try:
|
| 173 |
+
comfy.model_management.load_models_gpu([model.patcher], memory_required=memory_required, force_full_load=True)
|
| 174 |
+
except TypeError:
|
| 175 |
+
comfy.model_management.load_models_gpu([model.patcher], memory_required=memory_required)
|
| 176 |
+
device = model.patcher.load_device
|
| 177 |
+
total = samples.shape[0] * count_temporal_windows(frames, settings) * count_model_passes(upscaler.model, settings)
|
| 178 |
+
progress_bar = comfy.utils.ProgressBar(total)
|
| 179 |
+
|
| 180 |
+
def on_pass() -> None:
|
| 181 |
+
comfy.model_management.throw_exception_if_processing_interrupted()
|
| 182 |
+
progress_bar.update(1)
|
| 183 |
+
|
| 184 |
+
upscaled = upscaler.upscale(samples, settings, device, on_pass)
|
| 185 |
+
output = {key: value for key, value in latent.items() if key != "noise_mask"}
|
| 186 |
+
output["samples"] = upscaled.to(comfy.model_management.intermediate_device())
|
| 187 |
+
return (output,)
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
def optional_hff(value: float) -> float | None:
|
| 191 |
+
return None if value < 0 else value
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def common_inputs() -> dict:
|
| 195 |
+
return {
|
| 196 |
+
"upscaler": (UPSCALER_TYPE,),
|
| 197 |
+
"latent": ("LATENT",),
|
| 198 |
+
"spatial": ("BOOLEAN", {"default": True, "tooltip": "2x height and width."}),
|
| 199 |
+
"temporal": (
|
| 200 |
+
"BOOLEAN",
|
| 201 |
+
{"default": False, "tooltip": "2x frame rate of videos: T -> 1 + 2 (T - 1) latent frames (4T - 3 -> 8T - 7 pixel frames). Ignored for images."},
|
| 202 |
+
),
|
| 203 |
+
"hff": ("FLOAT", {"default": 0.9, "min": -1.0, "max": 1.0, "step": 0.01, "tooltip": HFF_TOOLTIP}),
|
| 204 |
+
"guidance": ("FLOAT", {"default": 1.0, "min": 1.0, "max": 30.0, "step": 0.1, "tooltip": GUIDANCE_TOOLTIP}),
|
| 205 |
+
"steps": ("INT", {"default": 20, "min": 1, "max": 200, "tooltip": "Base model only; 1-step models ignore it."}),
|
| 206 |
+
"seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF, "control_after_generate": True}),
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
class SteppeUpscaleLatent:
|
| 211 |
+
CATEGORY = CATEGORY
|
| 212 |
+
RETURN_TYPES = ("LATENT",)
|
| 213 |
+
FUNCTION = "upscale"
|
| 214 |
+
DESCRIPTION = (
|
| 215 |
+
"2x latent upscaling (spatial) and / or 2x frame rate (temporal) with a Steppe model. "
|
| 216 |
+
"The result is decoded directly with the VAE, no extra sampling pass needed."
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
@classmethod
|
| 220 |
+
def INPUT_TYPES(cls) -> dict:
|
| 221 |
+
return {"required": common_inputs()}
|
| 222 |
+
|
| 223 |
+
def upscale(
|
| 224 |
+
self,
|
| 225 |
+
upscaler: SteppeModel,
|
| 226 |
+
latent: dict,
|
| 227 |
+
spatial: bool,
|
| 228 |
+
temporal: bool,
|
| 229 |
+
hff: float,
|
| 230 |
+
guidance: float,
|
| 231 |
+
steps: int,
|
| 232 |
+
seed: int,
|
| 233 |
+
) -> tuple[dict]:
|
| 234 |
+
settings = UpscaleSettings(
|
| 235 |
+
spatial=spatial, temporal=temporal, hff=optional_hff(hff), guidance=guidance, steps=steps, seed=seed
|
| 236 |
+
)
|
| 237 |
+
return run_upscale(upscaler, latent, settings)
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
class SteppeUpscaleLatentAdvanced:
|
| 241 |
+
CATEGORY = CATEGORY
|
| 242 |
+
RETURN_TYPES = ("LATENT",)
|
| 243 |
+
FUNCTION = "upscale"
|
| 244 |
+
DESCRIPTION = "Steppe latent upscaling with sampler settings and temporal windows for long videos."
|
| 245 |
+
|
| 246 |
+
@classmethod
|
| 247 |
+
def INPUT_TYPES(cls) -> dict:
|
| 248 |
+
inputs = common_inputs()
|
| 249 |
+
inputs.update(
|
| 250 |
+
{
|
| 251 |
+
"negative_hff": (
|
| 252 |
+
"FLOAT",
|
| 253 |
+
{"default": -1.0, "min": -1.0, "max": 1.0, "step": 0.01, "tooltip": "Base model: hff of the negative guidance branch. -1 = no hff (null)."},
|
| 254 |
+
),
|
| 255 |
+
"shift": ("FLOAT", {"default": 4.0, "min": 0.1, "max": 20.0, "step": 0.1, "tooltip": "Base model: sigma shift of the sampling schedule."}),
|
| 256 |
+
"noise_scale": (
|
| 257 |
+
"FLOAT",
|
| 258 |
+
{"default": -1.0, "min": -1.0, "max": 2.0, "step": 0.01, "tooltip": "Initial noise temperature. -1 = trained default (1.0 with spatial, 0.8 temporal only)."},
|
| 259 |
+
),
|
| 260 |
+
"temporal_window": (
|
| 261 |
+
"INT",
|
| 262 |
+
{"default": 0, "min": 0, "max": 1024, "tooltip": "Source latent frames per window for long videos, 0 = whole clip. Memory is handled without windows too; windows keep long clips closer to the training length (up to 17 source frames)."},
|
| 263 |
+
),
|
| 264 |
+
"temporal_context": (
|
| 265 |
+
"INT",
|
| 266 |
+
{"default": 2, "min": 1, "max": 16, "tooltip": "Overlap frames before every window."},
|
| 267 |
+
),
|
| 268 |
+
}
|
| 269 |
+
)
|
| 270 |
+
return {"required": inputs}
|
| 271 |
+
|
| 272 |
+
def upscale(
|
| 273 |
+
self,
|
| 274 |
+
upscaler: SteppeModel,
|
| 275 |
+
latent: dict,
|
| 276 |
+
spatial: bool,
|
| 277 |
+
temporal: bool,
|
| 278 |
+
hff: float,
|
| 279 |
+
guidance: float,
|
| 280 |
+
steps: int,
|
| 281 |
+
seed: int,
|
| 282 |
+
negative_hff: float,
|
| 283 |
+
shift: float,
|
| 284 |
+
noise_scale: float,
|
| 285 |
+
temporal_window: int,
|
| 286 |
+
temporal_context: int,
|
| 287 |
+
) -> tuple[dict]:
|
| 288 |
+
settings = UpscaleSettings(
|
| 289 |
+
spatial=spatial,
|
| 290 |
+
temporal=temporal,
|
| 291 |
+
hff=optional_hff(hff),
|
| 292 |
+
guidance=guidance,
|
| 293 |
+
negative_hff=optional_hff(negative_hff),
|
| 294 |
+
steps=steps,
|
| 295 |
+
shift=shift,
|
| 296 |
+
noise_scale=None if noise_scale < 0 else noise_scale,
|
| 297 |
+
seed=seed,
|
| 298 |
+
temporal_window=temporal_window,
|
| 299 |
+
temporal_context=temporal_context,
|
| 300 |
+
)
|
| 301 |
+
return run_upscale(upscaler, latent, settings)
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
class SteppeMeasureHFF:
|
| 305 |
+
CATEGORY = CATEGORY
|
| 306 |
+
RETURN_TYPES = ("FLOAT",)
|
| 307 |
+
RETURN_NAMES = ("hff",)
|
| 308 |
+
FUNCTION = "measure"
|
| 309 |
+
DESCRIPTION = (
|
| 310 |
+
"High frequency feature of an image or video frames ([0...1], averaged over the batch), "
|
| 311 |
+
"e.g. to match the sharpness of a reference. Measure at the target resolution."
|
| 312 |
+
)
|
| 313 |
+
|
| 314 |
+
@classmethod
|
| 315 |
+
def INPUT_TYPES(cls) -> dict:
|
| 316 |
+
return {"required": {"image": ("IMAGE",)}}
|
| 317 |
+
|
| 318 |
+
def measure(self, image: torch.Tensor) -> tuple[float]:
|
| 319 |
+
frames = image[..., :3].movedim(-1, 1).float()
|
| 320 |
+
raw = compute_raw_immerkaer(frames).mean(dim=0, keepdim=True)
|
| 321 |
+
value = quantile_normalize(raw).item()
|
| 322 |
+
return (round(value, 3),)
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
NODE_CLASS_MAPPINGS = {
|
| 326 |
+
"SteppeLoadUpscaler": SteppeLoadUpscaler,
|
| 327 |
+
"SteppeUpscaleLatent": SteppeUpscaleLatent,
|
| 328 |
+
"SteppeUpscaleLatentAdvanced": SteppeUpscaleLatentAdvanced,
|
| 329 |
+
"SteppeMeasureHFF": SteppeMeasureHFF,
|
| 330 |
+
}
|
| 331 |
+
NODE_DISPLAY_NAME_MAPPINGS = {
|
| 332 |
+
"SteppeLoadUpscaler": "Load Steppe Upscaler",
|
| 333 |
+
"SteppeUpscaleLatent": "Steppe Upscale Latent",
|
| 334 |
+
"SteppeUpscaleLatentAdvanced": "Steppe Upscale Latent (Advanced)",
|
| 335 |
+
"SteppeMeasureHFF": "Steppe Measure HFF",
|
| 336 |
+
}
|
pyproject.toml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "steppe"
|
| 3 |
+
version = "1.0.3"
|
| 4 |
+
description = "Steppe generative latent upscalers: 2x resolution and 2x frame rate in latent space for Wan 2.1 / Wan 2.2 14B / Qwen-Image latents, decoded directly by the VAE, no extra sampling pass."
|
| 5 |
+
license = { file = "LICENSE" }
|
| 6 |
+
readme = "README.md"
|
| 7 |
+
requires-python = ">=3.10"
|
| 8 |
+
dependencies = [
|
| 9 |
+
"safetensors>=0.4",
|
| 10 |
+
"huggingface_hub>=0.23",
|
| 11 |
+
]
|
| 12 |
+
classifiers = [
|
| 13 |
+
"Operating System :: OS Independent",
|
| 14 |
+
]
|
| 15 |
+
keywords = ["comfyui", "latent upscaler", "upscaling", "super-resolution", "frame interpolation", "wan", "qwen-image"]
|
| 16 |
+
|
| 17 |
+
[project.optional-dependencies]
|
| 18 |
+
standalone = ["torch>=2.5"]
|
| 19 |
+
|
| 20 |
+
[project.urls]
|
| 21 |
+
Repository = "https://github.com/TensorForger/ComfyUI-Steppe"
|
| 22 |
+
Models = "https://huggingface.co/TensorForger/Steppe-Wan2.1"
|
| 23 |
+
"Bug Tracker" = "https://github.com/TensorForger/ComfyUI-Steppe/issues"
|
| 24 |
+
|
| 25 |
+
[tool.comfy]
|
| 26 |
+
PublisherId = "tensorforger"
|
| 27 |
+
DisplayName = "Steppe Latent Upscaler"
|
| 28 |
+
Icon = "https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/icon_400.png"
|
| 29 |
+
Banner = "https://raw.githubusercontent.com/tensorforger/tensorforger/main/assets/steppe/cover_banner_21x9.jpg"
|
| 30 |
+
|
| 31 |
+
[build-system]
|
| 32 |
+
requires = ["setuptools>=64"]
|
| 33 |
+
build-backend = "setuptools.build_meta"
|
| 34 |
+
|
| 35 |
+
[tool.setuptools]
|
| 36 |
+
packages = ["steppe"]
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
safetensors>=0.4
|
| 2 |
+
huggingface_hub>=0.23
|
scripts/export_release.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Converts STDev development checkpoints (safetensors with `vae` / `architecture` / `model_config` metadata) into
|
| 3 |
+
released Steppe model files: release metadata, weights in bfloat16 (inference dtype), release file names.
|
| 4 |
+
Also writes the `config.json` catalog of the model repository.
|
| 5 |
+
|
| 6 |
+
Usage: python scripts/export_release.py --source-dir ../STDev/models/latent_upscale_models --output-dir ../Steppe-Wan2.1
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import argparse
|
| 10 |
+
import glob
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
import sys
|
| 14 |
+
from dataclasses import replace
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
|
| 17 |
+
import torch
|
| 18 |
+
from safetensors.torch import load_file, save_file
|
| 19 |
+
|
| 20 |
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
| 21 |
+
|
| 22 |
+
from steppe import catalog # noqa: E402
|
| 23 |
+
from steppe.model import make_release_metadata, parse_model_info, read_metadata # noqa: E402
|
| 24 |
+
|
| 25 |
+
RELEASES = (
|
| 26 |
+
{
|
| 27 |
+
"source_pattern": "wan_2_1_wan_distill_v1_ema_step*.safetensors",
|
| 28 |
+
"file_name": "steppe_wan_2_1_200M_1step.safetensors",
|
| 29 |
+
"title": "Steppe Wan 2.1 200M 1-step",
|
| 30 |
+
"description": "Single step generative 2x latent upscaler for Wan 2.1 VAE latents (images and videos), distilled from the 200M base model.",
|
| 31 |
+
"recommended": {"hff": 0.9, "guidance": 1.0},
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"source_pattern": "wan_2_1_wan_pretrain_v1_ema_step*.safetensors",
|
| 35 |
+
"file_name": "steppe_wan_2_1_200M_base.safetensors",
|
| 36 |
+
"title": "Steppe Wan 2.1 200M base",
|
| 37 |
+
"description": "Multi step (rectified flow) generative 2x latent upscaler for Wan 2.1 VAE latents (images and videos), classifier free guidance on the high frequency feature.",
|
| 38 |
+
"recommended": {"hff": 0.9, "guidance": 1.0, "steps": 20, "shift": 4.0},
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"source_pattern": "wan_2_1_wan_small_s20m_ema_step*.safetensors",
|
| 42 |
+
"file_name": "steppe_wan_2_1_20M_1step.safetensors",
|
| 43 |
+
"title": "Steppe Wan 2.1 20M 1-step",
|
| 44 |
+
"description": "Lite single step generative 2x latent upscaler for Wan 2.1 VAE latents (images and videos).",
|
| 45 |
+
"recommended": {"hff": 0.9, "guidance": 1.0},
|
| 46 |
+
},
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def newest(directory: Path, pattern: str) -> Path:
|
| 51 |
+
paths = sorted(glob.glob(str(directory / pattern)))
|
| 52 |
+
if not paths:
|
| 53 |
+
raise FileNotFoundError(f"no {pattern} in {directory}")
|
| 54 |
+
return Path(paths[-1])
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def export(source: Path, release: dict, output_directory: Path, version: str) -> dict:
|
| 58 |
+
metadata = read_metadata(str(source))
|
| 59 |
+
info = parse_model_info(str(source), metadata)
|
| 60 |
+
assert info is not None, f"{source} has no development metadata"
|
| 61 |
+
info = replace(info, name=Path(release["file_name"]).stem, version=version)
|
| 62 |
+
tensors = {name: tensor.to(torch.bfloat16).contiguous() for name, tensor in load_file(str(source)).items()}
|
| 63 |
+
release_metadata = make_release_metadata(info, release["title"], release["description"])
|
| 64 |
+
release_metadata["steppe.source"] = f"{metadata.get('run', '?')} step {metadata.get('step', '?')} {metadata.get('weights', '')}".strip()
|
| 65 |
+
output_path = output_directory / release["file_name"]
|
| 66 |
+
save_file(tensors, str(output_path), metadata=release_metadata)
|
| 67 |
+
parameters = sum(tensor.numel() for tensor in tensors.values())
|
| 68 |
+
print(f"{source.name} -> {output_path} ({parameters / 1e6:.1f}M parameters, {os.path.getsize(output_path) / 1e6:.0f} MB)")
|
| 69 |
+
return {
|
| 70 |
+
"version": version,
|
| 71 |
+
"kind": info.kind,
|
| 72 |
+
"latent_space": info.latent_space,
|
| 73 |
+
"parameters": parameters,
|
| 74 |
+
"description": release["description"],
|
| 75 |
+
"recommended_settings": release["recommended"],
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def main() -> None:
|
| 80 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 81 |
+
parser.add_argument("--source-dir", type=Path, required=True)
|
| 82 |
+
parser.add_argument("--output-dir", type=Path, required=True)
|
| 83 |
+
parser.add_argument("--version", default="1.0")
|
| 84 |
+
arguments = parser.parse_args()
|
| 85 |
+
|
| 86 |
+
arguments.output_dir.mkdir(parents=True, exist_ok=True)
|
| 87 |
+
models = {}
|
| 88 |
+
for release in RELEASES:
|
| 89 |
+
assert release["file_name"] in catalog.CATALOG_BY_FILE_NAME, release["file_name"]
|
| 90 |
+
source = newest(arguments.source_dir, release["source_pattern"])
|
| 91 |
+
models[release["file_name"]] = export(source, release, arguments.output_dir, arguments.version)
|
| 92 |
+
repository_catalog = {
|
| 93 |
+
"format": "steppe-catalog",
|
| 94 |
+
"format_version": 1,
|
| 95 |
+
"project": "Steppe",
|
| 96 |
+
"latent_space": "wan_2_1",
|
| 97 |
+
"default_model": "steppe_wan_2_1_200M_1step.safetensors",
|
| 98 |
+
"implementation": "https://github.com/TensorForger/ComfyUI-Steppe",
|
| 99 |
+
"models": models,
|
| 100 |
+
}
|
| 101 |
+
catalog_path = arguments.output_dir / catalog.CATALOG_FILE_NAME
|
| 102 |
+
catalog_path.write_text(json.dumps(repository_catalog, indent=2) + "\n", encoding="utf-8")
|
| 103 |
+
print(f"catalog -> {catalog_path}")
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
if __name__ == "__main__":
|
| 107 |
+
main()
|
steppe/__init__.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Steppe: generative latent upscalers. 2x spatial and / or 2x temporal upscaling of VAE latents with a small
|
| 3 |
+
generative model; the output is decoded directly by the VAE, no extra denoising pass of the base model.
|
| 4 |
+
|
| 5 |
+
from steppe import UpscaleSettings, load_upscaler
|
| 6 |
+
|
| 7 |
+
upscaler = load_upscaler("steppe_wan_2_1_200M_1step.safetensors")
|
| 8 |
+
upscaler.model.to("cuda")
|
| 9 |
+
upscaled = upscaler.upscale(raw_wan_latents, UpscaleSettings(spatial=True, hff=0.9, guidance=1.0))
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from .catalog import CATALOG, CatalogEntry
|
| 13 |
+
from .hff import estimate_hff
|
| 14 |
+
from .latent_spaces import LATENT_SPACES, LatentSpace
|
| 15 |
+
from .model import ModelInfo, SteppeUpscaler, load_upscaler, load_upscaler_file
|
| 16 |
+
from .sampling import UpscaleSettings
|
| 17 |
+
|
| 18 |
+
__version__ = "1.0.3"
|
| 19 |
+
|
| 20 |
+
__all__ = [
|
| 21 |
+
"CATALOG",
|
| 22 |
+
"LATENT_SPACES",
|
| 23 |
+
"CatalogEntry",
|
| 24 |
+
"LatentSpace",
|
| 25 |
+
"ModelInfo",
|
| 26 |
+
"SteppeUpscaler",
|
| 27 |
+
"UpscaleSettings",
|
| 28 |
+
"estimate_hff",
|
| 29 |
+
"load_upscaler",
|
| 30 |
+
"load_upscaler_file",
|
| 31 |
+
]
|
steppe/catalog.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Released Steppe models and their Hugging Face repositories. Every model repository also has a `config.json`
|
| 3 |
+
catalog (model list, versions, recommended settings); it is fetched when a model is loaded to report newer
|
| 4 |
+
releases.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import json
|
| 8 |
+
import logging
|
| 9 |
+
from dataclasses import dataclass
|
| 10 |
+
|
| 11 |
+
logger = logging.getLogger("steppe")
|
| 12 |
+
|
| 13 |
+
CATALOG_FILE_NAME = "config.json"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
@dataclass(frozen=True)
|
| 17 |
+
class CatalogEntry:
|
| 18 |
+
file_name: str
|
| 19 |
+
repository: str
|
| 20 |
+
latent_space: str
|
| 21 |
+
kind: str
|
| 22 |
+
version: str
|
| 23 |
+
description: str
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
CATALOG: tuple[CatalogEntry, ...] = (
|
| 27 |
+
CatalogEntry(
|
| 28 |
+
file_name="steppe_wan_2_1_200M_1step.safetensors",
|
| 29 |
+
repository="TensorForger/Steppe-Wan2.1",
|
| 30 |
+
latent_space="wan_2_1",
|
| 31 |
+
kind="single_step",
|
| 32 |
+
version="1.0",
|
| 33 |
+
description="Default: single step, quality of the 20 step base model.",
|
| 34 |
+
),
|
| 35 |
+
CatalogEntry(
|
| 36 |
+
file_name="steppe_wan_2_1_200M_base.safetensors",
|
| 37 |
+
repository="TensorForger/Steppe-Wan2.1",
|
| 38 |
+
latent_space="wan_2_1",
|
| 39 |
+
kind="flow",
|
| 40 |
+
version="1.0",
|
| 41 |
+
description="Multi step base model: most control (steps, CFG on hff), research; same quality as the 1-step model.",
|
| 42 |
+
),
|
| 43 |
+
CatalogEntry(
|
| 44 |
+
file_name="steppe_wan_2_1_20M_1step.safetensors",
|
| 45 |
+
repository="TensorForger/Steppe-Wan2.1",
|
| 46 |
+
latent_space="wan_2_1",
|
| 47 |
+
kind="single_step",
|
| 48 |
+
version="1.0",
|
| 49 |
+
description="Lite: single step, 10x smaller; very large outputs, real time use.",
|
| 50 |
+
),
|
| 51 |
+
)
|
| 52 |
+
CATALOG_BY_FILE_NAME = {entry.file_name: entry for entry in CATALOG}
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def download_model(entry: CatalogEntry, directory: str) -> str:
|
| 56 |
+
"""
|
| 57 |
+
returns:
|
| 58 |
+
local path of the model file, downloaded into `directory` if missing
|
| 59 |
+
"""
|
| 60 |
+
from huggingface_hub import hf_hub_download
|
| 61 |
+
|
| 62 |
+
logger.info("Steppe: downloading %s from %s", entry.file_name, entry.repository)
|
| 63 |
+
return hf_hub_download(repo_id=entry.repository, filename=entry.file_name, local_dir=directory)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def fetch_repository_catalog(repository: str) -> dict | None:
|
| 67 |
+
"""
|
| 68 |
+
returns:
|
| 69 |
+
parsed `config.json` of the model repository (cached by huggingface_hub), None when offline or failing
|
| 70 |
+
"""
|
| 71 |
+
try:
|
| 72 |
+
from huggingface_hub import hf_hub_download
|
| 73 |
+
|
| 74 |
+
path = hf_hub_download(repo_id=repository, filename=CATALOG_FILE_NAME, etag_timeout=5)
|
| 75 |
+
with open(path, encoding="utf-8") as file:
|
| 76 |
+
return json.load(file)
|
| 77 |
+
except Exception as error:
|
| 78 |
+
logger.debug("Steppe: catalog of %s unavailable: %s", repository, error)
|
| 79 |
+
return None
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def report_updates(repository: str, file_name: str, local_version: str | None) -> None:
|
| 83 |
+
"""
|
| 84 |
+
Logs a notice when the repository catalog lists a newer version of a loaded model.
|
| 85 |
+
"""
|
| 86 |
+
catalog = fetch_repository_catalog(repository)
|
| 87 |
+
if catalog is None:
|
| 88 |
+
return
|
| 89 |
+
remote = catalog.get("models", {}).get(file_name)
|
| 90 |
+
if remote is None or local_version is None:
|
| 91 |
+
return
|
| 92 |
+
if parse_version(remote.get("version", "0")) > parse_version(local_version):
|
| 93 |
+
logger.warning(
|
| 94 |
+
"Steppe: %s %s is available (local %s), delete the file to download the new version",
|
| 95 |
+
file_name,
|
| 96 |
+
remote["version"],
|
| 97 |
+
local_version,
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def parse_version(version: str) -> tuple[int, ...]:
|
| 102 |
+
try:
|
| 103 |
+
return tuple(int(part) for part in version.split("."))
|
| 104 |
+
except ValueError:
|
| 105 |
+
return (0,)
|
steppe/hff.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
High frequency feature (hff) of Steppe models: the Immerkaer fine-scale noise estimate of the luminance,
|
| 3 |
+
mapped to [0...1] through a fixed quantile table calibrated once on ~10k ReLAION images, so values are absolute.
|
| 4 |
+
Higher means more fine-scale detail. Used to measure the sharpness of a reference image for the hff input.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import math
|
| 8 |
+
|
| 9 |
+
import torch
|
| 10 |
+
import torch.nn.functional as functional
|
| 11 |
+
|
| 12 |
+
LUMINANCE_WEIGHTS = (0.299, 0.587, 0.114)
|
| 13 |
+
IMMERKAER_KERNEL = ((1.0, -2.0, 1.0), (-2.0, 4.0, -2.0), (1.0, -2.0, 1.0))
|
| 14 |
+
IMMERKAER_SCALE = math.sqrt(math.pi / 2.0) / 6.0
|
| 15 |
+
|
| 16 |
+
IMMERKAER_QUANTILES: tuple[float, ...] = (
|
| 17 |
+
0.00000000, 0.00020116, 0.00036722, 0.00045936, 0.00058467, 0.00066617, 0.00073944, 0.00081956,
|
| 18 |
+
0.00088596, 0.00095097, 0.00101954, 0.00107751, 0.00112964, 0.00118689, 0.00124444, 0.00129973,
|
| 19 |
+
0.00135998, 0.00142074, 0.00148595, 0.00155106, 0.00161290, 0.00168215, 0.00174499, 0.00181354,
|
| 20 |
+
0.00186737, 0.00193704, 0.00199897, 0.00207116, 0.00212763, 0.00219403, 0.00225236, 0.00232901,
|
| 21 |
+
0.00238967, 0.00244775, 0.00252111, 0.00260088, 0.00267553, 0.00276829, 0.00283433, 0.00291129,
|
| 22 |
+
0.00298126, 0.00305011, 0.00313832, 0.00321171, 0.00330140, 0.00337240, 0.00345847, 0.00355506,
|
| 23 |
+
0.00365330, 0.00375433, 0.00386084, 0.00395091, 0.00405266, 0.00416922, 0.00428589, 0.00439411,
|
| 24 |
+
0.00451155, 0.00462194, 0.00477484, 0.00490455, 0.00505853, 0.00519100, 0.00533937, 0.00548513,
|
| 25 |
+
0.00564388, 0.00578612, 0.00592169, 0.00607432, 0.00626565, 0.00647446, 0.00669298, 0.00689549,
|
| 26 |
+
0.00709790, 0.00729320, 0.00755613, 0.00778564, 0.00800775, 0.00827138, 0.00862279, 0.00891582,
|
| 27 |
+
0.00919540, 0.00957094, 0.00995562, 0.01035687, 0.01084383, 0.01131693, 0.01175147, 0.01235478,
|
| 28 |
+
0.01285607, 0.01353223, 0.01422602, 0.01504661, 0.01593244, 0.01703135, 0.01859967, 0.02029203,
|
| 29 |
+
0.02264602, 0.02552253, 0.03004623, 0.03913622, 0.13334534,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def to_luminance(images: torch.Tensor) -> torch.Tensor:
|
| 34 |
+
"""
|
| 35 |
+
args:
|
| 36 |
+
images: [N, C, H, W], C in {3, 4}, channel_order: RGB or RGBA (alpha ignored), pixel_values: [0...1]
|
| 37 |
+
returns:
|
| 38 |
+
luminance: [N, 1, H, W], pixel_values: [0...1]
|
| 39 |
+
"""
|
| 40 |
+
weights = torch.tensor(LUMINANCE_WEIGHTS, dtype=images.dtype, device=images.device)
|
| 41 |
+
return (images[:, :3] * weights.view(1, 3, 1, 1)).sum(dim=1, keepdim=True)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def compute_raw_immerkaer(frames: torch.Tensor) -> torch.Tensor:
|
| 45 |
+
"""
|
| 46 |
+
args:
|
| 47 |
+
frames: [N, C, H, W], C in {3, 4}, channel_order: RGB or RGBA, pixel_values: [0...1], dtype: float
|
| 48 |
+
returns:
|
| 49 |
+
raw_values: [N], non-negative, same units as pixel values
|
| 50 |
+
"""
|
| 51 |
+
kernel = torch.tensor(IMMERKAER_KERNEL, dtype=frames.dtype, device=frames.device)
|
| 52 |
+
response = functional.conv2d(to_luminance(frames), kernel.view(1, 1, 3, 3)) # [N, 1, H-2, W-2]
|
| 53 |
+
return IMMERKAER_SCALE * response.abs().mean(dim=(1, 2, 3))
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def quantile_normalize(raw_values: torch.Tensor) -> torch.Tensor:
|
| 57 |
+
"""
|
| 58 |
+
args:
|
| 59 |
+
raw_values: [N]
|
| 60 |
+
returns:
|
| 61 |
+
normalized: [N], values: [0...1]
|
| 62 |
+
"""
|
| 63 |
+
table = torch.tensor(IMMERKAER_QUANTILES, dtype=raw_values.dtype, device=raw_values.device)
|
| 64 |
+
lower_index = (torch.searchsorted(table, raw_values, right=True) - 1).clamp(0, table.numel() - 2)
|
| 65 |
+
lower = table[lower_index]
|
| 66 |
+
upper = table[lower_index + 1]
|
| 67 |
+
fraction = (raw_values - lower) / (upper - lower).clamp_min(1e-12)
|
| 68 |
+
return ((lower_index + fraction) / (table.numel() - 1)).clamp(0.0, 1.0)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def estimate_hff(frames: torch.Tensor) -> torch.Tensor:
|
| 72 |
+
"""
|
| 73 |
+
args:
|
| 74 |
+
frames: [N, C, H, W], C in {3, 4}, channel_order: RGB or RGBA, pixel_values: [0...1], dtype: float
|
| 75 |
+
returns:
|
| 76 |
+
hff: [N], values: [0...1]
|
| 77 |
+
"""
|
| 78 |
+
return quantile_normalize(compute_raw_immerkaer(frames.float()))
|
steppe/latent_spaces.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
VAE latent spaces supported by Steppe upscalers: channel count, per channel normalization statistics and
|
| 3 |
+
frame rules. Upscalers work on normalized latents; ComfyUI and diffusers hand over raw VAE latents.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from dataclasses import dataclass
|
| 7 |
+
|
| 8 |
+
import torch
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@dataclass(frozen=True)
|
| 12 |
+
class LatentSpace:
|
| 13 |
+
name: str
|
| 14 |
+
display_name: str
|
| 15 |
+
channels: int
|
| 16 |
+
mean: tuple[float, ...]
|
| 17 |
+
std: tuple[float, ...]
|
| 18 |
+
temporal_compression: int
|
| 19 |
+
|
| 20 |
+
def statistics(self, device: torch.device) -> tuple[torch.Tensor, torch.Tensor]:
|
| 21 |
+
"""
|
| 22 |
+
returns:
|
| 23 |
+
mean, std: [1, C, 1, 1, 1], dtype: torch.float32
|
| 24 |
+
"""
|
| 25 |
+
mean = torch.tensor(self.mean, device=device)[None, :, None, None, None]
|
| 26 |
+
std = torch.tensor(self.std, device=device)[None, :, None, None, None]
|
| 27 |
+
return mean, std
|
| 28 |
+
|
| 29 |
+
def normalize(self, latents: torch.Tensor) -> torch.Tensor:
|
| 30 |
+
"""
|
| 31 |
+
args:
|
| 32 |
+
latents: [B, C, T, H, W], raw VAE latents
|
| 33 |
+
returns:
|
| 34 |
+
latents: [B, C, T, H, W], normalized, dtype: torch.float32
|
| 35 |
+
"""
|
| 36 |
+
mean, std = self.statistics(latents.device)
|
| 37 |
+
return (latents.float() - mean) / std
|
| 38 |
+
|
| 39 |
+
def denormalize(self, latents: torch.Tensor) -> torch.Tensor:
|
| 40 |
+
"""
|
| 41 |
+
args:
|
| 42 |
+
latents: [B, C, T, H, W], normalized
|
| 43 |
+
returns:
|
| 44 |
+
latents: [B, C, T, H, W], raw VAE latents, dtype: torch.float32
|
| 45 |
+
"""
|
| 46 |
+
mean, std = self.statistics(latents.device)
|
| 47 |
+
return latents.float() * std + mean
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
WAN_2_1 = LatentSpace(
|
| 51 |
+
name="wan_2_1",
|
| 52 |
+
display_name="Wan 2.1 VAE",
|
| 53 |
+
channels=16,
|
| 54 |
+
mean=(
|
| 55 |
+
-0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508,
|
| 56 |
+
0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921,
|
| 57 |
+
),
|
| 58 |
+
std=(
|
| 59 |
+
2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743,
|
| 60 |
+
3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.916,
|
| 61 |
+
),
|
| 62 |
+
temporal_compression=4,
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
LATENT_SPACES: dict[str, LatentSpace] = {space.name: space for space in (WAN_2_1,)}
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def get_latent_space(name: str) -> LatentSpace:
|
| 69 |
+
if name not in LATENT_SPACES:
|
| 70 |
+
raise ValueError(f"unknown latent space '{name}', supported: {', '.join(LATENT_SPACES)}")
|
| 71 |
+
return LATENT_SPACES[name]
|
steppe/model.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Steppe model files and the upscaler object: a safetensors file whose metadata names the latent space, the model
|
| 3 |
+
kind (multi step flow or single step student) and the network configuration. Development checkpoints of the
|
| 4 |
+
STDev research code (metadata keys `vae`, `architecture`, `model_config`) are read as well.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import json
|
| 8 |
+
import os
|
| 9 |
+
from dataclasses import dataclass
|
| 10 |
+
|
| 11 |
+
import torch
|
| 12 |
+
from safetensors import safe_open
|
| 13 |
+
from safetensors.torch import load_file
|
| 14 |
+
|
| 15 |
+
from . import catalog
|
| 16 |
+
from .latent_spaces import LatentSpace, get_latent_space
|
| 17 |
+
from .sampling import UpscaleSettings, upscale_latents
|
| 18 |
+
from .wan_transformer import SteppeWanTransformer, WanTransformerConfig
|
| 19 |
+
|
| 20 |
+
FORMAT_KEY = "steppe.format"
|
| 21 |
+
FORMAT_VERSION = "1"
|
| 22 |
+
KIND_FLOW = "flow"
|
| 23 |
+
KIND_SINGLE_STEP = "single_step"
|
| 24 |
+
DEVELOPMENT_KINDS = {"WanUpscalerTransformer": KIND_FLOW, "WanStudentTransformer": KIND_SINGLE_STEP}
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
@dataclass(frozen=True)
|
| 28 |
+
class ModelInfo:
|
| 29 |
+
name: str
|
| 30 |
+
latent_space: str
|
| 31 |
+
kind: str
|
| 32 |
+
version: str | None
|
| 33 |
+
config: dict
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def read_metadata(path: str) -> dict[str, str]:
|
| 37 |
+
with safe_open(path, framework="pt") as file:
|
| 38 |
+
return dict(file.metadata() or {})
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_model_info(path: str, metadata: dict[str, str]) -> ModelInfo | None:
|
| 42 |
+
"""
|
| 43 |
+
returns:
|
| 44 |
+
model description from the file metadata, None if the file is not a Steppe model
|
| 45 |
+
"""
|
| 46 |
+
name = os.path.splitext(os.path.basename(path))[0]
|
| 47 |
+
if FORMAT_KEY in metadata:
|
| 48 |
+
return ModelInfo(
|
| 49 |
+
name=metadata.get("steppe.name", name),
|
| 50 |
+
latent_space=metadata["steppe.latent_space"],
|
| 51 |
+
kind=metadata["steppe.kind"],
|
| 52 |
+
version=metadata.get("steppe.version"),
|
| 53 |
+
config=json.loads(metadata["steppe.model_config"]),
|
| 54 |
+
)
|
| 55 |
+
if metadata.get("vae") == "wan_2_1" and "model_config" in metadata:
|
| 56 |
+
architecture = metadata.get("architecture", "WanUpscalerTransformer")
|
| 57 |
+
if architecture not in DEVELOPMENT_KINDS:
|
| 58 |
+
return None
|
| 59 |
+
return ModelInfo(
|
| 60 |
+
name=name,
|
| 61 |
+
latent_space="wan_2_1",
|
| 62 |
+
kind=DEVELOPMENT_KINDS[architecture],
|
| 63 |
+
version=None,
|
| 64 |
+
config=json.loads(metadata["model_config"]),
|
| 65 |
+
)
|
| 66 |
+
return None
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def make_release_metadata(info: ModelInfo, title: str, description: str) -> dict[str, str]:
|
| 70 |
+
"""
|
| 71 |
+
Metadata of a released model file: Steppe keys plus the common `modelspec` keys shown by model managers.
|
| 72 |
+
"""
|
| 73 |
+
return {
|
| 74 |
+
FORMAT_KEY: FORMAT_VERSION,
|
| 75 |
+
"steppe.name": info.name,
|
| 76 |
+
"steppe.latent_space": info.latent_space,
|
| 77 |
+
"steppe.kind": info.kind,
|
| 78 |
+
"steppe.version": info.version or "1.0",
|
| 79 |
+
"steppe.model_config": json.dumps(info.config),
|
| 80 |
+
"modelspec.sai_model_spec": "1.0.0",
|
| 81 |
+
"modelspec.architecture": f"steppe-{info.latent_space.replace('_', '-')}/latent-upscaler",
|
| 82 |
+
"modelspec.implementation": "https://github.com/TensorForger/ComfyUI-Steppe",
|
| 83 |
+
"modelspec.title": title,
|
| 84 |
+
"modelspec.description": description,
|
| 85 |
+
"modelspec.author": "TensorForger",
|
| 86 |
+
"modelspec.license": "MIT",
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class SteppeUpscaler:
|
| 91 |
+
"""
|
| 92 |
+
A loaded Steppe model: 2x spatial and / or 2x temporal upscaling of raw VAE latents.
|
| 93 |
+
"""
|
| 94 |
+
|
| 95 |
+
def __init__(self, model: SteppeWanTransformer, info: ModelInfo) -> None:
|
| 96 |
+
self.model = model
|
| 97 |
+
self.info = info
|
| 98 |
+
self.latent_space: LatentSpace = get_latent_space(info.latent_space)
|
| 99 |
+
|
| 100 |
+
@property
|
| 101 |
+
def is_single_step(self) -> bool:
|
| 102 |
+
return self.info.kind == KIND_SINGLE_STEP
|
| 103 |
+
|
| 104 |
+
def upscale(
|
| 105 |
+
self,
|
| 106 |
+
latents: torch.Tensor,
|
| 107 |
+
settings: UpscaleSettings = UpscaleSettings(),
|
| 108 |
+
device: torch.device | str | None = None,
|
| 109 |
+
on_pass=lambda: None,
|
| 110 |
+
) -> torch.Tensor:
|
| 111 |
+
"""
|
| 112 |
+
Runs on `device` (default: the device of the model weights); the model is not moved.
|
| 113 |
+
|
| 114 |
+
args:
|
| 115 |
+
latents: [B, C, T, H, W] or [B, C, H, W], raw VAE latents of the model's latent space
|
| 116 |
+
returns:
|
| 117 |
+
latents: [B, C, T_hr, H_hr, W_hr] or [B, C, H_hr, W_hr], raw VAE latents, dtype: torch.float32,
|
| 118 |
+
on the CPU
|
| 119 |
+
"""
|
| 120 |
+
device = torch.device(device) if device is not None else self.model.input_conv.weight.device
|
| 121 |
+
image_layout = latents.ndim == 4
|
| 122 |
+
if image_layout:
|
| 123 |
+
latents = latents[:, :, None]
|
| 124 |
+
upscaled = upscale_latents(self.model, self.latent_space, latents, settings, device, on_pass)
|
| 125 |
+
return upscaled[:, :, 0] if image_layout else upscaled
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def build_model(info: ModelInfo) -> SteppeWanTransformer:
|
| 129 |
+
if info.latent_space != "wan_2_1":
|
| 130 |
+
raise ValueError(f"no network for latent space '{info.latent_space}'")
|
| 131 |
+
config = WanTransformerConfig(**info.config)
|
| 132 |
+
return SteppeWanTransformer(config, guided=info.kind == KIND_SINGLE_STEP)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def load_upscaler_file(path: str, dtype: torch.dtype = torch.bfloat16) -> SteppeUpscaler:
|
| 136 |
+
"""
|
| 137 |
+
returns:
|
| 138 |
+
upscaler on the CPU in `dtype`, evaluation mode
|
| 139 |
+
"""
|
| 140 |
+
info = parse_model_info(path, read_metadata(path))
|
| 141 |
+
if info is None:
|
| 142 |
+
raise ValueError(f"{path} is not a Steppe model file (no Steppe metadata)")
|
| 143 |
+
model = build_model(info)
|
| 144 |
+
model.load_state_dict(load_file(path))
|
| 145 |
+
model = model.to(dtype).eval().requires_grad_(False)
|
| 146 |
+
return SteppeUpscaler(model, info)
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def load_upscaler(name_or_path: str, directory: str | None = None, dtype: torch.dtype = torch.bfloat16) -> SteppeUpscaler:
|
| 150 |
+
"""
|
| 151 |
+
Loads a local model file, or a released model by file name (downloaded from Hugging Face into `directory`,
|
| 152 |
+
default: the huggingface_hub cache).
|
| 153 |
+
"""
|
| 154 |
+
if os.path.isfile(name_or_path):
|
| 155 |
+
return load_upscaler_file(name_or_path, dtype)
|
| 156 |
+
entry = catalog.CATALOG_BY_FILE_NAME.get(name_or_path) or catalog.CATALOG_BY_FILE_NAME.get(
|
| 157 |
+
f"{name_or_path}.safetensors"
|
| 158 |
+
)
|
| 159 |
+
if entry is None:
|
| 160 |
+
known = ", ".join(item.file_name for item in catalog.CATALOG)
|
| 161 |
+
raise FileNotFoundError(f"{name_or_path} is neither a file nor a released model ({known})")
|
| 162 |
+
if directory is None:
|
| 163 |
+
from huggingface_hub import hf_hub_download
|
| 164 |
+
|
| 165 |
+
path = hf_hub_download(repo_id=entry.repository, filename=entry.file_name)
|
| 166 |
+
else:
|
| 167 |
+
path = os.path.join(directory, entry.file_name)
|
| 168 |
+
if not os.path.isfile(path):
|
| 169 |
+
path = catalog.download_model(entry, directory)
|
| 170 |
+
upscaler = load_upscaler_file(path, dtype)
|
| 171 |
+
catalog.report_updates(entry.repository, entry.file_name, upscaler.info.version)
|
| 172 |
+
return upscaler
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
__all__ = ["ModelInfo", "SteppeUpscaler", "load_upscaler", "load_upscaler_file", "make_release_metadata"]
|
steppe/sampling.py
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Latent upscaling with Steppe models: raw VAE latents are normalized, padded to the window grid, upscaled by the
|
| 3 |
+
residual flow (Euler steps with classifier free guidance on the high frequency feature) or in one step by a
|
| 4 |
+
distilled student, cropped and denormalized. Long videos can be processed in overlapping temporal windows.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from dataclasses import dataclass, replace
|
| 8 |
+
from typing import Callable
|
| 9 |
+
|
| 10 |
+
import torch
|
| 11 |
+
import torch.nn.functional as functional
|
| 12 |
+
|
| 13 |
+
from .latent_spaces import LatentSpace
|
| 14 |
+
from .wan_transformer import WINDOW_SIZE, SteppeWanTransformer, from_residual
|
| 15 |
+
|
| 16 |
+
NOISE_SCALE_SPATIAL = 1.0
|
| 17 |
+
NOISE_SCALE_TEMPORAL = 0.8
|
| 18 |
+
STUDENT_SIGMA = 1.0
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
@dataclass(frozen=True)
|
| 22 |
+
class UpscaleSettings:
|
| 23 |
+
"""
|
| 24 |
+
hff: target high frequency feature (sharpness, [0...1]); None = null embedding, the model decides itself.
|
| 25 |
+
guidance: classifier free guidance scale for multi step models (positive hff vs negative hff), distilled
|
| 26 |
+
guidance input for single step models; 1 = no guidance.
|
| 27 |
+
negative_hff: hff of the negative guidance branch of multi step models; None = null embedding.
|
| 28 |
+
steps, shift: Euler steps and SD3 sigma shift of multi step models (ignored by single step models).
|
| 29 |
+
noise_scale: initial noise temperature; None = 1.0 with spatial upscaling, 0.8 for temporal only.
|
| 30 |
+
temporal_window: new source latent frames per window, 0 = the whole clip at once.
|
| 31 |
+
temporal_context: source latent frames of overlap before every window after the first, >= 1.
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
spatial: bool = True
|
| 35 |
+
temporal: bool = False
|
| 36 |
+
hff: float | None = 0.9
|
| 37 |
+
guidance: float = 1.0
|
| 38 |
+
negative_hff: float | None = None
|
| 39 |
+
steps: int = 20
|
| 40 |
+
shift: float = 4.0
|
| 41 |
+
noise_scale: float | None = None
|
| 42 |
+
seed: int = 0
|
| 43 |
+
temporal_window: int = 0
|
| 44 |
+
temporal_context: int = 2
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def shift_sigmas(sigmas: torch.Tensor, shift: float) -> torch.Tensor:
|
| 48 |
+
"""
|
| 49 |
+
args:
|
| 50 |
+
sigmas: [...], values: [0...1], 1 is pure noise
|
| 51 |
+
returns:
|
| 52 |
+
shifted_sigmas: [...], values: [0...1], moved towards 1 for shift > 1 (SD3)
|
| 53 |
+
"""
|
| 54 |
+
return shift * sigmas / (1.0 + (shift - 1.0) * sigmas)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def target_size_of(source_size: tuple[int, int, int], spatial: bool, temporal: bool) -> tuple[int, int, int]:
|
| 58 |
+
frames, height, width = source_size
|
| 59 |
+
if temporal:
|
| 60 |
+
frames = 1 + 2 * (frames - 1)
|
| 61 |
+
if spatial:
|
| 62 |
+
height, width = 2 * height, 2 * width
|
| 63 |
+
return frames, height, width
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def pad_to_window_grid(latents: torch.Tensor, spatial: bool) -> torch.Tensor:
|
| 67 |
+
"""
|
| 68 |
+
Replicate padding (bottom, right) so that the target latent grid is a multiple of the window size.
|
| 69 |
+
|
| 70 |
+
args:
|
| 71 |
+
latents: [B, C, T, H, W]
|
| 72 |
+
returns:
|
| 73 |
+
latents: [B, C, T, H_padded, W_padded]
|
| 74 |
+
"""
|
| 75 |
+
multiple = WINDOW_SIZE // 2 if spatial else WINDOW_SIZE
|
| 76 |
+
pad_height = -latents.shape[3] % multiple
|
| 77 |
+
pad_width = -latents.shape[4] % multiple
|
| 78 |
+
if pad_height == 0 and pad_width == 0:
|
| 79 |
+
return latents
|
| 80 |
+
return functional.pad(latents, (0, pad_width, 0, pad_height, 0, 0), mode="replicate")
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def count_model_passes(model: SteppeWanTransformer, settings: UpscaleSettings) -> int:
|
| 84 |
+
"""
|
| 85 |
+
returns:
|
| 86 |
+
network evaluations per sample and temporal window
|
| 87 |
+
"""
|
| 88 |
+
if model.guided:
|
| 89 |
+
return 1
|
| 90 |
+
return settings.steps * (2 if settings.guidance != 1.0 else 1)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def count_temporal_windows(source_frames: int, settings: UpscaleSettings) -> int:
|
| 94 |
+
if settings.temporal_window <= 0 or source_frames <= settings.temporal_window:
|
| 95 |
+
return 1
|
| 96 |
+
return 1 + -(-(source_frames - settings.temporal_window) // settings.temporal_window)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def hff_inputs(value: float | None, device: torch.device) -> tuple[torch.Tensor, torch.Tensor]:
|
| 100 |
+
"""
|
| 101 |
+
returns:
|
| 102 |
+
hff: [1], values: [0...1], hff_mask: [1], dtype: torch.bool, False = null embedding
|
| 103 |
+
"""
|
| 104 |
+
hff = torch.full((1,), 0.0 if value is None else float(value), device=device)
|
| 105 |
+
hff_mask = torch.full((1,), value is not None, dtype=torch.bool, device=device)
|
| 106 |
+
return hff, hff_mask
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
@torch.no_grad()
|
| 110 |
+
def sample_flow(
|
| 111 |
+
model: SteppeWanTransformer,
|
| 112 |
+
latents_source: torch.Tensor,
|
| 113 |
+
noise: torch.Tensor,
|
| 114 |
+
settings: UpscaleSettings,
|
| 115 |
+
on_pass: Callable[[], None],
|
| 116 |
+
) -> torch.Tensor:
|
| 117 |
+
"""
|
| 118 |
+
Euler sampling of the residual flow; guidance: negative + guidance * (positive - negative).
|
| 119 |
+
|
| 120 |
+
args:
|
| 121 |
+
latents_source: [1, C, T_lr, H_lr, W_lr], normalized
|
| 122 |
+
noise: [1, C, T_hr, H_hr, W_hr], noise_scale * unit gaussian
|
| 123 |
+
returns:
|
| 124 |
+
residual: [1, C, T_hr, H_hr, W_hr], dtype: torch.float32
|
| 125 |
+
"""
|
| 126 |
+
device = latents_source.device
|
| 127 |
+
dtype = model.dtype
|
| 128 |
+
samples = noise.float()
|
| 129 |
+
source = latents_source.to(dtype)
|
| 130 |
+
sigmas = shift_sigmas(torch.linspace(1.0, 0.0, settings.steps + 1, device=device), settings.shift)
|
| 131 |
+
positive_hff, positive_mask = hff_inputs(settings.hff, device)
|
| 132 |
+
negative_hff, negative_mask = hff_inputs(settings.negative_hff, device)
|
| 133 |
+
use_guidance = settings.guidance != 1.0
|
| 134 |
+
for current_sigma, next_sigma in zip(sigmas[:-1], sigmas[1:]):
|
| 135 |
+
sigma_batch = current_sigma.expand(1)
|
| 136 |
+
velocity = model(samples.to(dtype), sigma_batch, source, positive_hff, positive_mask).float()
|
| 137 |
+
on_pass()
|
| 138 |
+
if use_guidance:
|
| 139 |
+
negative_velocity = model(samples.to(dtype), sigma_batch, source, negative_hff, negative_mask).float()
|
| 140 |
+
velocity = negative_velocity + settings.guidance * (velocity - negative_velocity)
|
| 141 |
+
on_pass()
|
| 142 |
+
samples = samples + (next_sigma - current_sigma) * velocity
|
| 143 |
+
return samples
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
@torch.no_grad()
|
| 147 |
+
def sample_single_step(
|
| 148 |
+
model: SteppeWanTransformer,
|
| 149 |
+
latents_source: torch.Tensor,
|
| 150 |
+
noise: torch.Tensor,
|
| 151 |
+
settings: UpscaleSettings,
|
| 152 |
+
on_pass: Callable[[], None],
|
| 153 |
+
) -> torch.Tensor:
|
| 154 |
+
"""
|
| 155 |
+
args:
|
| 156 |
+
latents_source: [1, C, T_lr, H_lr, W_lr], normalized
|
| 157 |
+
noise: [1, C, T_hr, H_hr, W_hr], noise_scale * unit gaussian
|
| 158 |
+
returns:
|
| 159 |
+
residual: [1, C, T_hr, H_hr, W_hr], dtype: torch.float32
|
| 160 |
+
"""
|
| 161 |
+
device = latents_source.device
|
| 162 |
+
dtype = model.dtype
|
| 163 |
+
hff, hff_mask = hff_inputs(settings.hff, device)
|
| 164 |
+
guidance = torch.full((1,), float(settings.guidance), device=device)
|
| 165 |
+
sigmas = torch.full((1,), STUDENT_SIGMA, device=device)
|
| 166 |
+
velocity = model(noise.to(dtype), sigmas, latents_source.to(dtype), hff, hff_mask, guidance)
|
| 167 |
+
on_pass()
|
| 168 |
+
return noise.float() - velocity.float()
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
@torch.no_grad()
|
| 172 |
+
def upscale_window(
|
| 173 |
+
model: SteppeWanTransformer,
|
| 174 |
+
latents_source: torch.Tensor,
|
| 175 |
+
noise: torch.Tensor,
|
| 176 |
+
settings: UpscaleSettings,
|
| 177 |
+
on_pass: Callable[[], None],
|
| 178 |
+
) -> torch.Tensor:
|
| 179 |
+
"""
|
| 180 |
+
args:
|
| 181 |
+
latents_source: [1, C, T_lr, H_lr, W_lr], normalized, padded to the window grid
|
| 182 |
+
noise: [1, C, T_hr, H_hr, W_hr], noise_scale * unit gaussian
|
| 183 |
+
returns:
|
| 184 |
+
latents: [1, C, T_hr, H_hr, W_hr], normalized, dtype: torch.float32
|
| 185 |
+
"""
|
| 186 |
+
sampler = sample_single_step if model.guided else sample_flow
|
| 187 |
+
residual = sampler(model, latents_source, noise, settings, on_pass)
|
| 188 |
+
latents = from_residual(residual, latents_source)
|
| 189 |
+
if not settings.spatial:
|
| 190 |
+
latents[:, :, 0] = latents_source[:, :, 0].float()
|
| 191 |
+
return latents
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
@torch.no_grad()
|
| 195 |
+
def upscale_sample(
|
| 196 |
+
model: SteppeWanTransformer,
|
| 197 |
+
latents_source: torch.Tensor,
|
| 198 |
+
noise: torch.Tensor,
|
| 199 |
+
settings: UpscaleSettings,
|
| 200 |
+
on_pass: Callable[[], None],
|
| 201 |
+
) -> torch.Tensor:
|
| 202 |
+
"""
|
| 203 |
+
Whole clip at once or in temporal windows: window k covers new source frames [s, e) plus `temporal_context`
|
| 204 |
+
frames before them; only target frames of the new source frames are kept (target frame j <- source frame
|
| 205 |
+
ceil(j / 2) for temporal upscaling).
|
| 206 |
+
|
| 207 |
+
args:
|
| 208 |
+
latents_source: [1, C, T_lr, H_lr, W_lr], normalized, padded to the window grid
|
| 209 |
+
noise: [1, C, T_hr, H_hr, W_hr], noise_scale * unit gaussian for the whole clip
|
| 210 |
+
returns:
|
| 211 |
+
latents: [1, C, T_hr, H_hr, W_hr], normalized, dtype: torch.float32
|
| 212 |
+
"""
|
| 213 |
+
source_frames = latents_source.shape[2]
|
| 214 |
+
if count_temporal_windows(source_frames, settings) == 1:
|
| 215 |
+
return upscale_window(model, latents_source, noise, settings, on_pass)
|
| 216 |
+
window, context = settings.temporal_window, max(1, settings.temporal_context)
|
| 217 |
+
|
| 218 |
+
def target_index(source_index: int) -> int:
|
| 219 |
+
return 2 * source_index if settings.temporal else source_index
|
| 220 |
+
|
| 221 |
+
pieces = []
|
| 222 |
+
for start in range(0, source_frames, window):
|
| 223 |
+
end = min(source_frames, start + window)
|
| 224 |
+
first = max(0, start - context)
|
| 225 |
+
target_first, target_last = target_index(first), target_index(end - 1)
|
| 226 |
+
upscaled = upscale_window(
|
| 227 |
+
model,
|
| 228 |
+
latents_source[:, :, first:end],
|
| 229 |
+
noise[:, :, target_first : target_last + 1],
|
| 230 |
+
settings,
|
| 231 |
+
on_pass,
|
| 232 |
+
)
|
| 233 |
+
keep_from = 0 if start == 0 else target_index(start - 1) + 1 - target_first
|
| 234 |
+
pieces.append(upscaled[:, :, keep_from:])
|
| 235 |
+
return torch.cat(pieces, dim=2)
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
@torch.no_grad()
|
| 239 |
+
def upscale_latents(
|
| 240 |
+
model: SteppeWanTransformer,
|
| 241 |
+
latent_space: LatentSpace,
|
| 242 |
+
latents: torch.Tensor,
|
| 243 |
+
settings: UpscaleSettings,
|
| 244 |
+
device: torch.device,
|
| 245 |
+
on_pass: Callable[[], None] = lambda: None,
|
| 246 |
+
) -> torch.Tensor:
|
| 247 |
+
"""
|
| 248 |
+
Every sample uses its own noise from a CPU generator seeded with seed + sample index (reproducible across
|
| 249 |
+
devices).
|
| 250 |
+
|
| 251 |
+
args:
|
| 252 |
+
latents: [B, C, T, H, W], raw VAE latents
|
| 253 |
+
returns:
|
| 254 |
+
latents: [B, C, T_hr, H_hr, W_hr], raw VAE latents, dtype: torch.float32, on the CPU
|
| 255 |
+
"""
|
| 256 |
+
assert latents.ndim == 5 and latents.shape[1] == latent_space.channels, (
|
| 257 |
+
f"expected {latent_space.display_name} latents [B, {latent_space.channels}, T, H, W], "
|
| 258 |
+
f"got {tuple(latents.shape)}"
|
| 259 |
+
)
|
| 260 |
+
assert settings.spatial or settings.temporal, "enable spatial and / or temporal upscaling"
|
| 261 |
+
if settings.noise_scale is None:
|
| 262 |
+
settings = replace(
|
| 263 |
+
settings, noise_scale=NOISE_SCALE_SPATIAL if settings.spatial else NOISE_SCALE_TEMPORAL
|
| 264 |
+
)
|
| 265 |
+
target_size = target_size_of(tuple(latents.shape[2:]), settings.spatial, settings.temporal)
|
| 266 |
+
results = []
|
| 267 |
+
for index in range(latents.shape[0]):
|
| 268 |
+
normalized = latent_space.normalize(latents[index : index + 1].to(device))
|
| 269 |
+
padded = pad_to_window_grid(normalized, settings.spatial)
|
| 270 |
+
padded_target = target_size_of(tuple(padded.shape[2:]), settings.spatial, settings.temporal)
|
| 271 |
+
generator = torch.Generator().manual_seed(settings.seed + index)
|
| 272 |
+
noise = torch.randn((1, padded.shape[1], *padded_target), generator=generator)
|
| 273 |
+
noise = settings.noise_scale * noise.to(device)
|
| 274 |
+
upscaled = upscale_sample(model, padded, noise, settings, on_pass)
|
| 275 |
+
upscaled = upscaled[:, :, : target_size[0], : target_size[1], : target_size[2]]
|
| 276 |
+
results.append(latent_space.denormalize(upscaled).cpu())
|
| 277 |
+
return torch.cat(results)
|
steppe/wan_transformer.py
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Steppe Wan 2.1 latent upscaler network (inference only): plain window transformer on the full resolution latent
|
| 3 |
+
grid with adaLN-zero blocks, shifted 8x8 window attention with relative position bias and QK-norm, causal gated
|
| 4 |
+
depthwise temporal convolution, GELU MLP with a depthwise 3x3 convolution, RMS normalized condition vector,
|
| 5 |
+
learned source path and residual flow parameterization.
|
| 6 |
+
|
| 7 |
+
The same network serves both model kinds: the multi step flow model (velocity at any sigma, classifier free
|
| 8 |
+
guidance on the high frequency feature) and the single step students (extra guidance condition, always sigma 1).
|
| 9 |
+
Spatial attention and feed forward run in chunks of frames and the temporal convolution in chunks of rows, which
|
| 10 |
+
keeps long videos within memory without changing the result.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
import math
|
| 14 |
+
from dataclasses import dataclass
|
| 15 |
+
|
| 16 |
+
import torch
|
| 17 |
+
import torch.nn as nn
|
| 18 |
+
import torch.nn.functional as functional
|
| 19 |
+
|
| 20 |
+
LATENT_CHANNELS = 16
|
| 21 |
+
WINDOW_SIZE = 8
|
| 22 |
+
FREQUENCY_DIM = 256
|
| 23 |
+
SIGMA_SCALE = 1000.0
|
| 24 |
+
HFF_SCALE = 1000.0
|
| 25 |
+
GUIDANCE_SCALE = 500.0
|
| 26 |
+
MAX_NORM_GROUPS = 32
|
| 27 |
+
TEMPORAL_KERNEL = 2
|
| 28 |
+
TOKENS_PER_CHUNK = 65536
|
| 29 |
+
|
| 30 |
+
RESIDUAL_STD_SPATIAL = (
|
| 31 |
+
0.129, 0.221, 0.170, 0.153, 0.334, 0.249, 0.156, 0.212,
|
| 32 |
+
0.141, 0.161, 0.131, 0.228, 0.207, 0.338, 0.140, 0.214,
|
| 33 |
+
)
|
| 34 |
+
RESIDUAL_STD_TEMPORAL = (
|
| 35 |
+
0.211, 0.360, 0.248, 0.285, 0.417, 0.349, 0.236, 0.299,
|
| 36 |
+
0.222, 0.302, 0.218, 0.387, 0.375, 0.469, 0.244, 0.300,
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
@dataclass(frozen=True)
|
| 41 |
+
class WanTransformerConfig:
|
| 42 |
+
width: int = 1024
|
| 43 |
+
depth: int = 24
|
| 44 |
+
head_dim: int = 64
|
| 45 |
+
mlp_hidden: int = 4096
|
| 46 |
+
condition_dim: int = 512
|
| 47 |
+
source_encoder_width: int = 512
|
| 48 |
+
source_encoder_blocks: int = 2
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def causal_frame_indices(source_frames: int, target_frames: int, device: torch.device) -> torch.Tensor:
|
| 52 |
+
"""
|
| 53 |
+
Source latent frame of each target latent frame for the causal Wan VAE: target frame j <- source frame
|
| 54 |
+
ceil(j / 2).
|
| 55 |
+
|
| 56 |
+
returns:
|
| 57 |
+
indices: [T_hr], dtype: torch.long
|
| 58 |
+
"""
|
| 59 |
+
if target_frames == source_frames:
|
| 60 |
+
return torch.arange(target_frames, device=device)
|
| 61 |
+
assert target_frames - 1 == 2 * (source_frames - 1), (source_frames, target_frames)
|
| 62 |
+
return torch.div(torch.arange(target_frames, device=device) + 1, 2, rounding_mode="floor")
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def align_source(latents_source: torch.Tensor, target_size: tuple[int, int, int]) -> torch.Tensor:
|
| 66 |
+
"""
|
| 67 |
+
Causal frame index alignment and bilinear spatial resize of the source latents to the target grid.
|
| 68 |
+
|
| 69 |
+
args:
|
| 70 |
+
latents_source: [B, C, T_lr, H_lr, W_lr]
|
| 71 |
+
target_size: (T_hr, H_hr, W_hr)
|
| 72 |
+
returns:
|
| 73 |
+
latents_aligned: [B, C, T_hr, H_hr, W_hr]
|
| 74 |
+
"""
|
| 75 |
+
if target_size[0] != latents_source.shape[2]:
|
| 76 |
+
indices = causal_frame_indices(latents_source.shape[2], target_size[0], latents_source.device)
|
| 77 |
+
latents_source = latents_source.index_select(2, indices)
|
| 78 |
+
if tuple(target_size[1:]) != tuple(latents_source.shape[3:]):
|
| 79 |
+
latents_source = functional.interpolate(
|
| 80 |
+
latents_source, size=target_size, mode="trilinear", align_corners=False
|
| 81 |
+
)
|
| 82 |
+
return latents_source
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def residual_scale(
|
| 86 |
+
source_shape: torch.Size, target_size: tuple[int, int, int], device: torch.device
|
| 87 |
+
) -> torch.Tensor:
|
| 88 |
+
"""
|
| 89 |
+
Per channel residual std: spatial table if the spatial size changes, temporal table otherwise.
|
| 90 |
+
|
| 91 |
+
returns:
|
| 92 |
+
scale: [1, C, 1, 1, 1], dtype: torch.float32
|
| 93 |
+
"""
|
| 94 |
+
spatial = tuple(target_size[1:]) != tuple(source_shape[3:])
|
| 95 |
+
table = RESIDUAL_STD_SPATIAL if spatial else RESIDUAL_STD_TEMPORAL
|
| 96 |
+
return torch.tensor(table, device=device, dtype=torch.float32)[None, :, None, None, None]
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def from_residual(residual: torch.Tensor, latents_source: torch.Tensor) -> torch.Tensor:
|
| 100 |
+
"""
|
| 101 |
+
args:
|
| 102 |
+
residual: [B, C, T_hr, H_hr, W_hr]
|
| 103 |
+
latents_source: [B, C, T_lr, H_lr, W_lr], normalized
|
| 104 |
+
returns:
|
| 105 |
+
latents_target: [B, C, T_hr, H_hr, W_hr], normalized, dtype: torch.float32
|
| 106 |
+
"""
|
| 107 |
+
target_size = tuple(residual.shape[2:])
|
| 108 |
+
base = align_source(latents_source.float(), target_size)
|
| 109 |
+
return base + residual_scale(latents_source.shape, target_size, residual.device) * residual.float()
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def make_group_norm(channels: int) -> nn.GroupNorm:
|
| 113 |
+
groups = min(MAX_NORM_GROUPS, channels)
|
| 114 |
+
while channels % groups != 0:
|
| 115 |
+
groups -= 1
|
| 116 |
+
return nn.GroupNorm(groups, channels, eps=1e-6)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def sinusoidal_embedding(values: torch.Tensor, scale: float) -> torch.Tensor:
|
| 120 |
+
"""
|
| 121 |
+
args:
|
| 122 |
+
values: [N]
|
| 123 |
+
returns:
|
| 124 |
+
embedding: [N, FREQUENCY_DIM], dtype: torch.float32
|
| 125 |
+
"""
|
| 126 |
+
half_dim = FREQUENCY_DIM // 2
|
| 127 |
+
frequencies = torch.exp(
|
| 128 |
+
-math.log(10000.0) * torch.arange(half_dim, device=values.device, dtype=torch.float32) / half_dim
|
| 129 |
+
)
|
| 130 |
+
angles = values.float()[:, None] * scale * frequencies[None, :] # [N, half_dim]
|
| 131 |
+
return torch.cat([angles.sin(), angles.cos()], dim=1)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
def make_projection(condition_dim: int) -> nn.Sequential:
|
| 135 |
+
return nn.Sequential(
|
| 136 |
+
nn.Linear(FREQUENCY_DIM, condition_dim), nn.SiLU(), nn.Linear(condition_dim, condition_dim)
|
| 137 |
+
)
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
class ConditioningEncoder(nn.Module):
|
| 141 |
+
"""
|
| 142 |
+
RMS normalized sum of MLP embeddings of the noise level, the high frequency feature (or its learned null
|
| 143 |
+
embedding) and, for single step students, the distilled guidance scale.
|
| 144 |
+
"""
|
| 145 |
+
|
| 146 |
+
def __init__(self, condition_dim: int, guided: bool) -> None:
|
| 147 |
+
super().__init__()
|
| 148 |
+
self.sigma_projection = make_projection(condition_dim)
|
| 149 |
+
self.hff_projection = make_projection(condition_dim)
|
| 150 |
+
self.null_hff = nn.Parameter(torch.zeros(condition_dim))
|
| 151 |
+
if guided:
|
| 152 |
+
self.guidance_projection = make_projection(condition_dim)
|
| 153 |
+
|
| 154 |
+
def forward(
|
| 155 |
+
self,
|
| 156 |
+
sigmas: torch.Tensor,
|
| 157 |
+
hff: torch.Tensor,
|
| 158 |
+
hff_mask: torch.Tensor,
|
| 159 |
+
guidance: torch.Tensor | None = None,
|
| 160 |
+
) -> torch.Tensor:
|
| 161 |
+
"""
|
| 162 |
+
args:
|
| 163 |
+
sigmas: [B], values: [0...1], 1 is pure noise
|
| 164 |
+
hff: [B], values: [0...1]
|
| 165 |
+
hff_mask: [B], dtype: torch.bool, False = null hff embedding
|
| 166 |
+
guidance: [B], >= 1, only for guided (single step) models
|
| 167 |
+
returns:
|
| 168 |
+
condition: [B, condition_dim]
|
| 169 |
+
"""
|
| 170 |
+
weight_dtype = self.sigma_projection[0].weight.dtype
|
| 171 |
+
sigma_embedding = self.sigma_projection(sinusoidal_embedding(sigmas, SIGMA_SCALE).to(weight_dtype))
|
| 172 |
+
hff_embedding = self.hff_projection(sinusoidal_embedding(hff, HFF_SCALE).to(weight_dtype))
|
| 173 |
+
hff_embedding = torch.where(
|
| 174 |
+
hff_mask[:, None], hff_embedding, self.null_hff.to(hff_embedding.dtype)[None]
|
| 175 |
+
)
|
| 176 |
+
condition = sigma_embedding + hff_embedding
|
| 177 |
+
if hasattr(self, "guidance_projection"):
|
| 178 |
+
assert guidance is not None, "single step models need a guidance value"
|
| 179 |
+
guidance_embedding = self.guidance_projection(
|
| 180 |
+
sinusoidal_embedding(guidance - 1.0, GUIDANCE_SCALE).to(weight_dtype)
|
| 181 |
+
)
|
| 182 |
+
condition = condition + guidance_embedding
|
| 183 |
+
return functional.rms_norm(condition, (condition.shape[-1],))
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
class PlainResidualBlock(nn.Module):
|
| 187 |
+
def __init__(self, channels: int) -> None:
|
| 188 |
+
super().__init__()
|
| 189 |
+
self.norm_first = make_group_norm(channels)
|
| 190 |
+
self.conv_first = nn.Conv2d(channels, channels, 3, padding=1)
|
| 191 |
+
self.norm_second = make_group_norm(channels)
|
| 192 |
+
self.conv_second = nn.Conv2d(channels, channels, 3, padding=1)
|
| 193 |
+
|
| 194 |
+
def forward(self, features: torch.Tensor) -> torch.Tensor:
|
| 195 |
+
hidden = self.conv_first(functional.silu(self.norm_first(features)))
|
| 196 |
+
return features + self.conv_second(functional.silu(self.norm_second(hidden)))
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
class SourceEncoder(nn.Module):
|
| 200 |
+
"""
|
| 201 |
+
Learned upsampling of the source latents: residual blocks at the source resolution, pixel shuffle 2x spatial
|
| 202 |
+
upsampling, causal phase temporal upsampling, projection to the transformer width.
|
| 203 |
+
"""
|
| 204 |
+
|
| 205 |
+
def __init__(self, channels: int, output_channels: int, num_blocks: int) -> None:
|
| 206 |
+
super().__init__()
|
| 207 |
+
self.input_conv = nn.Conv2d(LATENT_CHANNELS, channels, 3, padding=1)
|
| 208 |
+
self.blocks = nn.Sequential(*(PlainResidualBlock(channels) for _ in range(num_blocks)))
|
| 209 |
+
self.spatial_norm = make_group_norm(channels)
|
| 210 |
+
self.spatial_upsample = nn.Conv2d(channels, 4 * channels, 3, padding=1)
|
| 211 |
+
self.temporal_phases = nn.Conv2d(2 * channels, 2 * channels, 1)
|
| 212 |
+
self.output = nn.Conv2d(channels, output_channels, 1)
|
| 213 |
+
|
| 214 |
+
def forward(self, latents_source: torch.Tensor, target_size: tuple[int, int, int]) -> torch.Tensor:
|
| 215 |
+
"""
|
| 216 |
+
args:
|
| 217 |
+
latents_source: [B, C, T_lr, H_lr, W_lr]
|
| 218 |
+
target_size: (T_hr, H_hr, W_hr)
|
| 219 |
+
returns:
|
| 220 |
+
features: [B * T_hr, output_channels, H_hr, W_hr]
|
| 221 |
+
"""
|
| 222 |
+
batch_size, _, source_frames, source_height, source_width = latents_source.shape
|
| 223 |
+
target_frames, target_height, target_width = target_size
|
| 224 |
+
folded = latents_source.permute(0, 2, 1, 3, 4).reshape(
|
| 225 |
+
batch_size * source_frames, LATENT_CHANNELS, source_height, source_width
|
| 226 |
+
)
|
| 227 |
+
features = self.blocks(self.input_conv(folded)) # [B * T_lr, D, h, w]
|
| 228 |
+
if (target_height, target_width) != (source_height, source_width):
|
| 229 |
+
assert target_height == 2 * source_height and target_width == 2 * source_width
|
| 230 |
+
features = functional.pixel_shuffle(
|
| 231 |
+
self.spatial_upsample(functional.silu(self.spatial_norm(features))), 2
|
| 232 |
+
)
|
| 233 |
+
channels = features.shape[1]
|
| 234 |
+
if target_frames != source_frames:
|
| 235 |
+
assert target_frames - 1 == 2 * (source_frames - 1)
|
| 236 |
+
features = features.reshape(batch_size, source_frames, channels, target_height, target_width)
|
| 237 |
+
previous = torch.cat([features[:, :1], features[:, :-1]], dim=1)
|
| 238 |
+
pair = torch.cat([features, previous], dim=2).reshape(
|
| 239 |
+
batch_size * source_frames, 2 * channels, target_height, target_width
|
| 240 |
+
)
|
| 241 |
+
phases = self.temporal_phases(pair).reshape(
|
| 242 |
+
batch_size, source_frames, 2, channels, target_height, target_width
|
| 243 |
+
)
|
| 244 |
+
odd = features[:, 1:] + phases[:, 1:, 0] # target frames 2k - 1
|
| 245 |
+
even = features[:, 1:] + phases[:, 1:, 1] # target frames 2k
|
| 246 |
+
rest = torch.stack([odd, even], dim=2).reshape(
|
| 247 |
+
batch_size, 2 * (source_frames - 1), channels, target_height, target_width
|
| 248 |
+
)
|
| 249 |
+
features = torch.cat([features[:, :1], rest], dim=1).reshape(
|
| 250 |
+
batch_size * target_frames, channels, target_height, target_width
|
| 251 |
+
)
|
| 252 |
+
return self.output(features)
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
def window_partition(tokens: torch.Tensor) -> torch.Tensor:
|
| 256 |
+
"""
|
| 257 |
+
args:
|
| 258 |
+
tokens: [N, H, W, D]
|
| 259 |
+
returns:
|
| 260 |
+
windows: [N, windows, WINDOW_SIZE * WINDOW_SIZE, D]
|
| 261 |
+
"""
|
| 262 |
+
count, height, width, dim = tokens.shape
|
| 263 |
+
rows, columns = height // WINDOW_SIZE, width // WINDOW_SIZE
|
| 264 |
+
tokens = tokens.reshape(count, rows, WINDOW_SIZE, columns, WINDOW_SIZE, dim).permute(0, 1, 3, 2, 4, 5)
|
| 265 |
+
return tokens.reshape(count, rows * columns, WINDOW_SIZE * WINDOW_SIZE, dim)
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
def window_merge(windows: torch.Tensor, height: int, width: int) -> torch.Tensor:
|
| 269 |
+
"""
|
| 270 |
+
args:
|
| 271 |
+
windows: [N, windows, WINDOW_SIZE * WINDOW_SIZE, D]
|
| 272 |
+
returns:
|
| 273 |
+
tokens: [N, H, W, D]
|
| 274 |
+
"""
|
| 275 |
+
count, _, _, dim = windows.shape
|
| 276 |
+
rows, columns = height // WINDOW_SIZE, width // WINDOW_SIZE
|
| 277 |
+
windows = windows.reshape(count, rows, columns, WINDOW_SIZE, WINDOW_SIZE, dim).permute(0, 1, 3, 2, 4, 5)
|
| 278 |
+
return windows.reshape(count, height, width, dim)
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
def shifted_window_mask(height: int, width: int, shift: int, device: torch.device) -> torch.Tensor:
|
| 282 |
+
"""
|
| 283 |
+
Swin mask for cyclically shifted windows: tokens attend only within their original region.
|
| 284 |
+
|
| 285 |
+
returns:
|
| 286 |
+
mask: [windows, WINDOW_SIZE ** 2, WINDOW_SIZE ** 2], dtype: torch.bool, True = attend
|
| 287 |
+
"""
|
| 288 |
+
region = torch.zeros(height, width, device=device)
|
| 289 |
+
label = 0
|
| 290 |
+
for row_slice in (slice(0, -WINDOW_SIZE), slice(-WINDOW_SIZE, -shift), slice(-shift, None)):
|
| 291 |
+
for column_slice in (slice(0, -WINDOW_SIZE), slice(-WINDOW_SIZE, -shift), slice(-shift, None)):
|
| 292 |
+
region[row_slice, column_slice] = label
|
| 293 |
+
label += 1
|
| 294 |
+
region_windows = window_partition(region[None, :, :, None])[0, :, :, 0] # [windows, window tokens]
|
| 295 |
+
return region_windows[:, :, None] == region_windows[:, None, :]
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
class TransformerBlock(nn.Module):
|
| 299 |
+
"""
|
| 300 |
+
DiT style block with adaLN-zero modulation: (shifted) window self-attention, causal gated depthwise temporal
|
| 301 |
+
convolution (skipped for single frames), GELU MLP with a depthwise 3x3 convolution.
|
| 302 |
+
"""
|
| 303 |
+
|
| 304 |
+
def __init__(self, config: WanTransformerConfig, shift: bool) -> None:
|
| 305 |
+
super().__init__()
|
| 306 |
+
dim = config.width
|
| 307 |
+
self.head_dim = config.head_dim
|
| 308 |
+
self.heads = dim // config.head_dim
|
| 309 |
+
self.shift = WINDOW_SIZE // 2 if shift else 0
|
| 310 |
+
self.modulation = nn.Sequential(nn.SiLU(), nn.Linear(config.condition_dim, 9 * dim))
|
| 311 |
+
self.norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6)
|
| 312 |
+
self.spatial_qkv = nn.Linear(dim, 3 * dim)
|
| 313 |
+
self.spatial_output = nn.Linear(dim, dim)
|
| 314 |
+
self.query_norm = nn.RMSNorm(config.head_dim, eps=1e-6)
|
| 315 |
+
self.key_norm = nn.RMSNorm(config.head_dim, eps=1e-6)
|
| 316 |
+
self.relative_bias = nn.Parameter(torch.zeros(self.heads, (2 * WINDOW_SIZE - 1) ** 2))
|
| 317 |
+
coordinates = torch.stack(
|
| 318 |
+
torch.meshgrid(torch.arange(WINDOW_SIZE), torch.arange(WINDOW_SIZE), indexing="ij")
|
| 319 |
+
).flatten(1) # [2, window tokens]
|
| 320 |
+
relative = coordinates[:, :, None] - coordinates[:, None, :] + WINDOW_SIZE - 1
|
| 321 |
+
self.register_buffer(
|
| 322 |
+
"relative_index", relative[0] * (2 * WINDOW_SIZE - 1) + relative[1], persistent=False
|
| 323 |
+
)
|
| 324 |
+
self.temporal_input = nn.Linear(dim, 2 * dim)
|
| 325 |
+
self.temporal_weight = nn.Parameter(torch.zeros(TEMPORAL_KERNEL, dim))
|
| 326 |
+
self.temporal_output = nn.Linear(dim, dim)
|
| 327 |
+
self.feed_forward_input = nn.Linear(dim, config.mlp_hidden)
|
| 328 |
+
self.feed_forward_conv = nn.Conv2d(
|
| 329 |
+
config.mlp_hidden, config.mlp_hidden, 3, padding=1, groups=config.mlp_hidden
|
| 330 |
+
)
|
| 331 |
+
self.feed_forward_output = nn.Linear(config.mlp_hidden, dim)
|
| 332 |
+
|
| 333 |
+
def _spatial_attention(self, tokens: torch.Tensor, shift_mask: torch.Tensor | None) -> torch.Tensor:
|
| 334 |
+
"""
|
| 335 |
+
args:
|
| 336 |
+
tokens: [N, H, W, D]
|
| 337 |
+
shift_mask: [windows, t, t], dtype: torch.bool, required for shifted blocks
|
| 338 |
+
returns:
|
| 339 |
+
attended: [N, H, W, D]
|
| 340 |
+
"""
|
| 341 |
+
count, height, width, dim = tokens.shape
|
| 342 |
+
if self.shift:
|
| 343 |
+
tokens = torch.roll(tokens, (-self.shift, -self.shift), dims=(1, 2))
|
| 344 |
+
windows = window_partition(self.spatial_qkv(tokens)) # [N, windows, t, 3D]
|
| 345 |
+
num_windows, window_tokens = windows.shape[1], windows.shape[2]
|
| 346 |
+
qkv = windows.reshape(count * num_windows, window_tokens, 3, self.heads, self.head_dim).permute(
|
| 347 |
+
2, 0, 3, 1, 4
|
| 348 |
+
)
|
| 349 |
+
qkv = torch.stack([self.query_norm(qkv[0]), self.key_norm(qkv[1]), qkv[2]])
|
| 350 |
+
bias = self.relative_bias[:, self.relative_index].to(qkv.dtype)[None] # [1, heads, t, t]
|
| 351 |
+
if self.shift:
|
| 352 |
+
bias = bias.masked_fill(~shift_mask[:, None], float("-inf")) # [windows, heads, t, t]
|
| 353 |
+
bias = bias.expand(count, -1, -1, -1, -1).reshape(
|
| 354 |
+
count * num_windows, self.heads, window_tokens, window_tokens
|
| 355 |
+
)
|
| 356 |
+
attended = functional.scaled_dot_product_attention(qkv[0], qkv[1], qkv[2], attn_mask=bias)
|
| 357 |
+
attended = attended.permute(0, 2, 1, 3).reshape(count, num_windows, window_tokens, dim)
|
| 358 |
+
attended = window_merge(self.spatial_output(attended), height, width)
|
| 359 |
+
if self.shift:
|
| 360 |
+
attended = torch.roll(attended, (self.shift, self.shift), dims=(1, 2))
|
| 361 |
+
return attended
|
| 362 |
+
|
| 363 |
+
def _temporal_mixing(self, tokens: torch.Tensor, num_frames: int) -> torch.Tensor:
|
| 364 |
+
"""
|
| 365 |
+
Causal gated depthwise temporal convolution: out_t = W_o (silu(g_t) * sum_k w_k * v_{t - k}).
|
| 366 |
+
|
| 367 |
+
args:
|
| 368 |
+
tokens: [B * T, H, W, D]
|
| 369 |
+
returns:
|
| 370 |
+
mixed: [B * T, H, W, D]
|
| 371 |
+
"""
|
| 372 |
+
count, height, width, dim = tokens.shape
|
| 373 |
+
batch_size = count // num_frames
|
| 374 |
+
gate, value = (
|
| 375 |
+
self.temporal_input(tokens).reshape(batch_size, num_frames, height, width, 2 * dim).chunk(2, dim=-1)
|
| 376 |
+
)
|
| 377 |
+
padded = functional.pad(value, (0, 0, 0, 0, 0, 0, TEMPORAL_KERNEL - 1, 0)) # [B, T + k - 1, H, W, D]
|
| 378 |
+
mixed = sum(
|
| 379 |
+
self.temporal_weight[offset]
|
| 380 |
+
* padded[:, TEMPORAL_KERNEL - 1 - offset : TEMPORAL_KERNEL - 1 - offset + num_frames]
|
| 381 |
+
for offset in range(TEMPORAL_KERNEL)
|
| 382 |
+
)
|
| 383 |
+
mixed = (functional.silu(gate) * mixed).reshape(count, height, width, dim)
|
| 384 |
+
return self.temporal_output(mixed)
|
| 385 |
+
|
| 386 |
+
def _feed_forward(self, tokens: torch.Tensor) -> torch.Tensor:
|
| 387 |
+
hidden = self.feed_forward_input(tokens).permute(0, 3, 1, 2) # [N, F, H, W]
|
| 388 |
+
hidden = self.feed_forward_conv(hidden).permute(0, 2, 3, 1)
|
| 389 |
+
return self.feed_forward_output(functional.gelu(hidden, approximate="tanh"))
|
| 390 |
+
|
| 391 |
+
def forward(
|
| 392 |
+
self,
|
| 393 |
+
tokens: torch.Tensor,
|
| 394 |
+
condition: torch.Tensor,
|
| 395 |
+
num_frames: int,
|
| 396 |
+
shift_mask: torch.Tensor | None,
|
| 397 |
+
) -> torch.Tensor:
|
| 398 |
+
"""
|
| 399 |
+
Updates the tokens in place, chunk by chunk.
|
| 400 |
+
|
| 401 |
+
args:
|
| 402 |
+
tokens: [B * T, H, W, D]
|
| 403 |
+
condition: [B * T, condition_dim]
|
| 404 |
+
num_frames: T
|
| 405 |
+
shift_mask: [windows, t, t], dtype: torch.bool
|
| 406 |
+
returns:
|
| 407 |
+
tokens: [B * T, H, W, D]
|
| 408 |
+
"""
|
| 409 |
+
count, height, width, _ = tokens.shape
|
| 410 |
+
modulation = self.modulation(condition)[:, None, None, :].chunk(9, dim=-1) # 9 x [N, 1, 1, D]
|
| 411 |
+
shift_a, scale_a, gate_a, shift_t, scale_t, gate_t, shift_f, scale_f, gate_f = modulation
|
| 412 |
+
frames_per_chunk = max(1, TOKENS_PER_CHUNK // (height * width))
|
| 413 |
+
for start in range(0, count, frames_per_chunk):
|
| 414 |
+
part = slice(start, start + frames_per_chunk)
|
| 415 |
+
modulated = self.norm(tokens[part]) * (1 + scale_a[part]) + shift_a[part]
|
| 416 |
+
tokens[part] += gate_a[part] * self._spatial_attention(modulated, shift_mask)
|
| 417 |
+
if num_frames > 1:
|
| 418 |
+
rows_per_chunk = max(1, TOKENS_PER_CHUNK // (count * width))
|
| 419 |
+
for start in range(0, height, rows_per_chunk):
|
| 420 |
+
rows = slice(start, start + rows_per_chunk)
|
| 421 |
+
modulated = self.norm(tokens[:, rows]) * (1 + scale_t) + shift_t
|
| 422 |
+
tokens[:, rows] += gate_t * self._temporal_mixing(modulated, num_frames)
|
| 423 |
+
for start in range(0, count, frames_per_chunk):
|
| 424 |
+
part = slice(start, start + frames_per_chunk)
|
| 425 |
+
modulated = self.norm(tokens[part]) * (1 + scale_f[part]) + shift_f[part]
|
| 426 |
+
tokens[part] += gate_f[part] * self._feed_forward(modulated)
|
| 427 |
+
return tokens
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
class SteppeWanTransformer(nn.Module):
|
| 431 |
+
"""
|
| 432 |
+
Velocity model of the residual flow on normalized Wan 2.1 latents. `guided` adds the distilled guidance
|
| 433 |
+
condition of the single step students.
|
| 434 |
+
"""
|
| 435 |
+
|
| 436 |
+
def __init__(self, config: WanTransformerConfig, guided: bool) -> None:
|
| 437 |
+
super().__init__()
|
| 438 |
+
dim = config.width
|
| 439 |
+
self.config = config
|
| 440 |
+
self.guided = guided
|
| 441 |
+
self.conditioning = ConditioningEncoder(config.condition_dim, guided)
|
| 442 |
+
self.frame_projection = nn.Sequential(nn.Linear(FREQUENCY_DIM, dim), nn.SiLU(), nn.Linear(dim, dim))
|
| 443 |
+
self.input_conv = nn.Conv2d(2 * LATENT_CHANNELS, dim, 3, padding=1)
|
| 444 |
+
self.source_encoder = SourceEncoder(config.source_encoder_width, dim, config.source_encoder_blocks)
|
| 445 |
+
self.blocks = nn.ModuleList(
|
| 446 |
+
TransformerBlock(config, shift=index % 2 == 1) for index in range(config.depth)
|
| 447 |
+
)
|
| 448 |
+
self.output_modulation = nn.Sequential(nn.SiLU(), nn.Linear(config.condition_dim, 2 * dim))
|
| 449 |
+
self.output_norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6)
|
| 450 |
+
self.output = nn.Linear(dim, LATENT_CHANNELS)
|
| 451 |
+
|
| 452 |
+
@property
|
| 453 |
+
def dtype(self) -> torch.dtype:
|
| 454 |
+
return self.input_conv.weight.dtype
|
| 455 |
+
|
| 456 |
+
def forward(
|
| 457 |
+
self,
|
| 458 |
+
noisy_residual: torch.Tensor,
|
| 459 |
+
sigmas: torch.Tensor,
|
| 460 |
+
latents_source: torch.Tensor,
|
| 461 |
+
hff: torch.Tensor,
|
| 462 |
+
hff_mask: torch.Tensor,
|
| 463 |
+
guidance: torch.Tensor | None = None,
|
| 464 |
+
) -> torch.Tensor:
|
| 465 |
+
"""
|
| 466 |
+
args:
|
| 467 |
+
noisy_residual: [B, C, T, H, W], H and W multiples of WINDOW_SIZE
|
| 468 |
+
sigmas: [B], values: [0...1], 1 is pure noise
|
| 469 |
+
latents_source: [B, C, T_lr, H_lr, W_lr], normalized Wan 2.1 latents
|
| 470 |
+
hff: [B], values: [0...1]
|
| 471 |
+
hff_mask: [B], dtype: torch.bool, False = null hff embedding
|
| 472 |
+
guidance: [B], >= 1, only for guided (single step) models
|
| 473 |
+
returns:
|
| 474 |
+
velocity: [B, C, T, H, W] (noise - residual), dtype: model dtype
|
| 475 |
+
"""
|
| 476 |
+
condition = self.conditioning(sigmas, hff, hff_mask, guidance)
|
| 477 |
+
batch_size, channels, num_frames, height, width = noisy_residual.shape
|
| 478 |
+
condition = condition.repeat_interleave(num_frames, dim=0) # [B * T, D_c]
|
| 479 |
+
latents_aligned = align_source(latents_source, (num_frames, height, width))
|
| 480 |
+
stacked = torch.cat([noisy_residual, latents_aligned.to(noisy_residual.dtype)], dim=1)
|
| 481 |
+
folded = stacked.permute(0, 2, 1, 3, 4).reshape(batch_size * num_frames, 2 * channels, height, width)
|
| 482 |
+
features = self.input_conv(folded) # [B * T, D, H, W]
|
| 483 |
+
features = features + self.source_encoder(latents_source.to(features.dtype), (num_frames, height, width))
|
| 484 |
+
frame_indices = torch.arange(num_frames, device=features.device).repeat(batch_size)
|
| 485 |
+
frame_embedding = self.frame_projection(sinusoidal_embedding(frame_indices, 1.0).to(features.dtype))
|
| 486 |
+
tokens = (features.permute(0, 2, 3, 1) + frame_embedding[:, None, None, :]).contiguous() # [B * T, H, W, D]
|
| 487 |
+
del features, stacked, folded, latents_aligned
|
| 488 |
+
shift_mask = shifted_window_mask(height, width, WINDOW_SIZE // 2, tokens.device)
|
| 489 |
+
for block in self.blocks:
|
| 490 |
+
tokens = block(tokens, condition, num_frames, shift_mask)
|
| 491 |
+
shift, scale = self.output_modulation(condition)[:, None, None, :].chunk(2, dim=-1)
|
| 492 |
+
velocity = self.output(self.output_norm(tokens) * (1 + scale) + shift) # [B * T, H, W, C]
|
| 493 |
+
return velocity.reshape(batch_size, num_frames, height, width, channels).permute(0, 4, 1, 2, 3)
|
tests/output/decode_bicubic.png
ADDED
|
Git LFS Details
|
tests/output/input.png
ADDED
|
Git LFS Details
|
tests/output/steppe_wan_2_1_200M_1step_hff-1.0_g1.0.png
ADDED
|
Git LFS Details
|
tests/output/steppe_wan_2_1_200M_1step_hff0.9_g2.0.png
ADDED
|
Git LFS Details
|
tests/output/steppe_wan_2_1_200M_base_hff0.9_g1.0.png
ADDED
|
Git LFS Details
|
tests/output/steppe_wan_2_1_200M_base_hff0.9_g4.0.png
ADDED
|
Git LFS Details
|
tests/output/steppe_wan_2_1_20M_1step_hff-1.0_g1.0.png
ADDED
|
Git LFS Details
|
tests/output/steppe_wan_2_1_20M_1step_hff0.9_g2.0.png
ADDED
|
Git LFS Details
|
tests/test_comfyui.py
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
End to end test of the nodes inside a ComfyUI installation (no server): Wan 2.1 VAE encode of an image, Steppe
|
| 3 |
+
upscaling with every released model, VAE decode, PNGs in tests/output; plus a long video latent for memory and
|
| 4 |
+
speed. Run with the ComfyUI Python environment.
|
| 5 |
+
|
| 6 |
+
Usage: python tests/test_comfyui.py --comfyui ~/comfyui --models-dir ../Steppe-Wan2.1 --image photo.jpg
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import argparse
|
| 10 |
+
import importlib.util
|
| 11 |
+
import sys
|
| 12 |
+
import time
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
import numpy as np
|
| 16 |
+
import torch
|
| 17 |
+
from PIL import Image
|
| 18 |
+
|
| 19 |
+
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
|
| 20 |
+
OUTPUT_DIRECTORY = REPOSITORY_ROOT / "tests" / "output"
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def import_node_pack():
|
| 24 |
+
spec = importlib.util.spec_from_file_location(
|
| 25 |
+
"ComfyUI_Steppe", REPOSITORY_ROOT / "__init__.py", submodule_search_locations=[str(REPOSITORY_ROOT)]
|
| 26 |
+
)
|
| 27 |
+
module = importlib.util.module_from_spec(spec)
|
| 28 |
+
sys.modules["ComfyUI_Steppe"] = module
|
| 29 |
+
spec.loader.exec_module(module)
|
| 30 |
+
return module
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def load_image(path: Path, size: int) -> torch.Tensor:
|
| 34 |
+
"""
|
| 35 |
+
returns:
|
| 36 |
+
image: [1, H, W, 3], pixel_values: [0...1], center crop resized to size x size
|
| 37 |
+
"""
|
| 38 |
+
image = Image.open(path).convert("RGB")
|
| 39 |
+
side = min(image.size)
|
| 40 |
+
left, top = (image.width - side) // 2, (image.height - side) // 2
|
| 41 |
+
image = image.crop((left, top, left + side, top + side)).resize((size, size), Image.BICUBIC)
|
| 42 |
+
return torch.from_numpy(np.asarray(image).astype(np.float32) / 255.0)[None]
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def save_image(image: torch.Tensor, name: str) -> None:
|
| 46 |
+
OUTPUT_DIRECTORY.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
array = (image[0].clamp(0, 1).cpu().numpy() * 255.0).round().astype(np.uint8)
|
| 48 |
+
Image.fromarray(array).save(OUTPUT_DIRECTORY / name)
|
| 49 |
+
print(f" saved tests/output/{name}")
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def main() -> None:
|
| 53 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 54 |
+
parser.add_argument("--comfyui", type=Path, required=True)
|
| 55 |
+
parser.add_argument("--models-dir", type=Path, required=True)
|
| 56 |
+
parser.add_argument("--image", type=Path, required=True)
|
| 57 |
+
parser.add_argument("--vae", default="wan_2.1_vae.safetensors")
|
| 58 |
+
parser.add_argument("--size", type=int, default=512)
|
| 59 |
+
arguments = parser.parse_args()
|
| 60 |
+
|
| 61 |
+
sys.path.insert(0, str(arguments.comfyui))
|
| 62 |
+
import comfy.model_management
|
| 63 |
+
import folder_paths
|
| 64 |
+
import nodes as comfy_nodes
|
| 65 |
+
|
| 66 |
+
folder_paths.add_model_folder_path("latent_upscale_models", str(arguments.models_dir.resolve()), is_default=True)
|
| 67 |
+
pack = import_node_pack()
|
| 68 |
+
steppe_nodes = sys.modules["ComfyUI_Steppe.nodes"]
|
| 69 |
+
mappings = pack.NODE_CLASS_MAPPINGS
|
| 70 |
+
|
| 71 |
+
model_names = mappings["SteppeLoadUpscaler"].INPUT_TYPES()["required"]["model_name"][0]
|
| 72 |
+
print(f"model list: {model_names}")
|
| 73 |
+
(vae,) = comfy_nodes.VAELoader().load_vae(arguments.vae)
|
| 74 |
+
image = load_image(arguments.image, arguments.size)
|
| 75 |
+
save_image(image, "input.png")
|
| 76 |
+
(latent,) = comfy_nodes.VAEEncode().encode(vae, image)
|
| 77 |
+
print(f"encoded latent {tuple(latent['samples'].shape)}")
|
| 78 |
+
(decoded,) = comfy_nodes.VAEDecode().decode(vae, latent)
|
| 79 |
+
bicubic = torch.nn.functional.interpolate(decoded.reshape(1, *decoded.shape[-3:]).movedim(-1, 1), scale_factor=2, mode="bicubic").movedim(1, -1)
|
| 80 |
+
save_image(bicubic, "decode_bicubic.png")
|
| 81 |
+
(measured,) = mappings["SteppeMeasureHFF"]().measure(image)
|
| 82 |
+
print(f"hff of the input image: {measured}")
|
| 83 |
+
|
| 84 |
+
upscale = mappings["SteppeUpscaleLatent"]()
|
| 85 |
+
for model_name in [name for name in model_names if name.startswith("steppe_")]:
|
| 86 |
+
(upscaler,) = mappings["SteppeLoadUpscaler"]().load(model_name, "auto")
|
| 87 |
+
single_step = upscaler.upscaler.is_single_step
|
| 88 |
+
for hff, guidance in ((0.9, 2.0), (-1.0, 1.0)) if single_step else ((0.9, 1.0), (0.9, 4.0)):
|
| 89 |
+
torch.cuda.synchronize()
|
| 90 |
+
start = time.perf_counter()
|
| 91 |
+
(upscaled,) = upscale.upscale(upscaler, latent, True, False, hff, guidance, 20, 0)
|
| 92 |
+
torch.cuda.synchronize()
|
| 93 |
+
elapsed = time.perf_counter() - start
|
| 94 |
+
(decoded,) = comfy_nodes.VAEDecode().decode(vae, upscaled)
|
| 95 |
+
print(f"{model_name} hff {hff} guidance {guidance}: latent {tuple(upscaled['samples'].shape)}, upscale {elapsed * 1000:.0f} ms")
|
| 96 |
+
save_image(decoded.reshape(1, *decoded.shape[-3:]), f"{Path(model_name).stem}_hff{hff}_g{guidance}.png")
|
| 97 |
+
|
| 98 |
+
(upscaler,) = mappings["SteppeLoadUpscaler"]().load("steppe_wan_2_1_200M_1step.safetensors", "auto")
|
| 99 |
+
video = {"samples": torch.randn(1, 16, 21, 60, 104) * 1.5}
|
| 100 |
+
advanced = mappings["SteppeUpscaleLatentAdvanced"]()
|
| 101 |
+
for spatial, temporal, window in ((True, True, 0), (True, True, 9), (False, True, 0)):
|
| 102 |
+
comfy.model_management.soft_empty_cache()
|
| 103 |
+
torch.cuda.reset_peak_memory_stats()
|
| 104 |
+
start = time.perf_counter()
|
| 105 |
+
(upscaled,) = advanced.upscale(upscaler, video, spatial, temporal, 0.9, 2.0, 20, 0, -1.0, 4.0, -1.0, window, 2)
|
| 106 |
+
torch.cuda.synchronize()
|
| 107 |
+
elapsed = time.perf_counter() - start
|
| 108 |
+
peak = torch.cuda.max_memory_allocated() / 2**30
|
| 109 |
+
print(f"video 81 frames 480x832, spatial {spatial} temporal {temporal} window {window}: {tuple(upscaled['samples'].shape)}, {elapsed:.1f} s, peak {peak:.1f} GiB")
|
| 110 |
+
del steppe_nodes
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
if __name__ == "__main__":
|
| 114 |
+
with torch.inference_mode():
|
| 115 |
+
main()
|
tests/test_parity.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Parity of the production implementation with the STDev research code: the same checkpoint, latents, settings and
|
| 3 |
+
seed must give the same upscaled latents. Needs a CUDA GPU, the STDev repository (STDEV_PATH, default
|
| 4 |
+
../STDev) and its development checkpoints in STDEV_PATH/models/latent_upscale_models.
|
| 5 |
+
|
| 6 |
+
Usage: python tests/test_parity.py
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import glob
|
| 10 |
+
import os
|
| 11 |
+
import sys
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
|
| 14 |
+
import torch
|
| 15 |
+
|
| 16 |
+
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
|
| 17 |
+
STDEV_PATH = Path(os.environ.get("STDEV_PATH", REPOSITORY_ROOT.parent / "STDev"))
|
| 18 |
+
sys.path.insert(0, str(REPOSITORY_ROOT))
|
| 19 |
+
sys.path.insert(0, str(STDEV_PATH / "src"))
|
| 20 |
+
|
| 21 |
+
from steppe import UpscaleSettings, load_upscaler_file, wan_transformer # noqa: E402
|
| 22 |
+
from stdev.comfy_nodes.wan_2_1 import distilled_sampling, sampling # noqa: E402
|
| 23 |
+
from stdev.wan_distill.student import WanStudentTransformer # noqa: E402
|
| 24 |
+
from stdev.wan_pretrain.model import ModelConfig, WanUpscalerTransformer # noqa: E402
|
| 25 |
+
|
| 26 |
+
CHECKPOINT_DIRECTORY = STDEV_PATH / "models" / "latent_upscale_models"
|
| 27 |
+
TOLERANCE = 0.02
|
| 28 |
+
WINDOW_TOLERANCE = 0.1
|
| 29 |
+
CASES = (
|
| 30 |
+
("image, padded grid", (1, 16, 1, 30, 44), True, False),
|
| 31 |
+
("video, spatial and temporal", (1, 16, 5, 24, 32), True, True),
|
| 32 |
+
("video, temporal only", (2, 16, 4, 32, 40), False, True),
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def newest_checkpoint(pattern: str) -> str:
|
| 37 |
+
paths = sorted(glob.glob(str(CHECKPOINT_DIRECTORY / pattern)))
|
| 38 |
+
assert paths, f"no checkpoint matching {pattern} in {CHECKPOINT_DIRECTORY}"
|
| 39 |
+
return paths[-1]
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def load_reference(path: str, student: bool) -> torch.nn.Module:
|
| 43 |
+
upscaler = load_upscaler_file(path, torch.float32)
|
| 44 |
+
architecture = WanStudentTransformer if student else WanUpscalerTransformer
|
| 45 |
+
reference = architecture(ModelConfig(**upscaler.info.config))
|
| 46 |
+
reference.load_state_dict(upscaler.model.state_dict())
|
| 47 |
+
return reference.to(torch.bfloat16).eval().requires_grad_(False)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def raw_latents(shape: tuple[int, ...], device: torch.device) -> torch.Tensor:
|
| 51 |
+
generator = torch.Generator().manual_seed(1234)
|
| 52 |
+
mean = torch.tensor(sampling.LATENTS_MEAN)[None, :, None, None, None]
|
| 53 |
+
std = torch.tensor(sampling.LATENTS_STD)[None, :, None, None, None]
|
| 54 |
+
return (torch.randn(shape, generator=generator) * std + mean).to(device)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def report(name: str, ours: torch.Tensor, reference: torch.Tensor, tolerance: float = TOLERANCE) -> bool:
|
| 58 |
+
assert ours.shape == reference.shape, (name, ours.shape, reference.shape)
|
| 59 |
+
difference = (ours - reference).abs()
|
| 60 |
+
relative = (difference.mean() / reference.abs().mean()).item()
|
| 61 |
+
passed = relative < tolerance
|
| 62 |
+
print(f" {'ok ' if passed else 'FAIL'} {name}: shape {tuple(ours.shape)}, mean relative difference {relative:.5f}, max {difference.max().item():.4f}")
|
| 63 |
+
return passed
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def check_flow_model(device: torch.device) -> bool:
|
| 67 |
+
path = newest_checkpoint("wan_2_1_wan_pretrain_v1_*.safetensors")
|
| 68 |
+
print(f"flow model {Path(path).name}")
|
| 69 |
+
ours = load_upscaler_file(path, torch.bfloat16)
|
| 70 |
+
ours.model.to(device)
|
| 71 |
+
reference = load_reference(path, student=False).to(device)
|
| 72 |
+
passed = True
|
| 73 |
+
for name, shape, spatial, temporal in CASES:
|
| 74 |
+
latents = raw_latents(shape, device)
|
| 75 |
+
noise_scale = 1.0 if spatial else 0.8
|
| 76 |
+
reference_settings = sampling.UpscaleSettings(
|
| 77 |
+
spatial=spatial, temporal=temporal, steps=4, cfg=3.0, hff=0.9, negative_hff=None,
|
| 78 |
+
shift=4.0, noise_scale=noise_scale, seed=7,
|
| 79 |
+
)
|
| 80 |
+
expected = sampling.upscale_latents(reference, latents, reference_settings, device, lambda: None)
|
| 81 |
+
settings = UpscaleSettings(spatial=spatial, temporal=temporal, steps=4, guidance=3.0, hff=0.9, seed=7)
|
| 82 |
+
passed &= report(name, ours.upscale(latents, settings), expected)
|
| 83 |
+
return passed
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def check_student(pattern: str, device: torch.device) -> bool:
|
| 87 |
+
path = newest_checkpoint(pattern)
|
| 88 |
+
print(f"single step model {Path(path).name}")
|
| 89 |
+
ours = load_upscaler_file(path, torch.bfloat16)
|
| 90 |
+
ours.model.to(device)
|
| 91 |
+
reference = load_reference(path, student=True).to(device)
|
| 92 |
+
passed = True
|
| 93 |
+
for name, shape, spatial, temporal in CASES:
|
| 94 |
+
for hff in (0.9, None):
|
| 95 |
+
latents = raw_latents(shape, device)
|
| 96 |
+
reference_settings = distilled_sampling.DistilledSettings(
|
| 97 |
+
spatial=spatial, temporal=temporal, guidance=2.0, hff=hff, seed=3
|
| 98 |
+
)
|
| 99 |
+
expected = distilled_sampling.upscale_latents_single_step(
|
| 100 |
+
reference, latents, reference_settings, device, lambda: None
|
| 101 |
+
)
|
| 102 |
+
settings = UpscaleSettings(spatial=spatial, temporal=temporal, guidance=2.0, hff=hff, seed=3)
|
| 103 |
+
passed &= report(f"{name}, hff {hff}", ours.upscale(latents, settings), expected)
|
| 104 |
+
return passed
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def check_temporal_windows(device: torch.device) -> bool:
|
| 108 |
+
path = newest_checkpoint("wan_2_1_wan_small_s20m_*.safetensors")
|
| 109 |
+
print("temporal windows (an approximation: random latents, loose tolerance)")
|
| 110 |
+
ours = load_upscaler_file(path, torch.bfloat16)
|
| 111 |
+
ours.model.to(device)
|
| 112 |
+
latents = raw_latents((1, 16, 11, 16, 16), device)
|
| 113 |
+
passed = True
|
| 114 |
+
for spatial, temporal in ((True, True), (True, False), (False, True)):
|
| 115 |
+
whole = ours.upscale(latents, UpscaleSettings(spatial=spatial, temporal=temporal, seed=1))
|
| 116 |
+
windowed = ours.upscale(
|
| 117 |
+
latents,
|
| 118 |
+
UpscaleSettings(spatial=spatial, temporal=temporal, seed=1, temporal_window=4, temporal_context=2),
|
| 119 |
+
)
|
| 120 |
+
passed &= report(f"spatial {spatial}, temporal {temporal}", windowed, whole, WINDOW_TOLERANCE)
|
| 121 |
+
return passed
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def check_chunking(device: torch.device) -> bool:
|
| 125 |
+
path = newest_checkpoint("wan_2_1_wan_distill_v1_*.safetensors")
|
| 126 |
+
print("frame and row chunking (must be exact)")
|
| 127 |
+
ours = load_upscaler_file(path, torch.bfloat16)
|
| 128 |
+
ours.model.to(device)
|
| 129 |
+
latents = raw_latents((1, 16, 5, 24, 32), device)
|
| 130 |
+
settings = UpscaleSettings(spatial=True, temporal=True, seed=5)
|
| 131 |
+
whole = ours.upscale(latents, settings)
|
| 132 |
+
original = wan_transformer.TOKENS_PER_CHUNK
|
| 133 |
+
wan_transformer.TOKENS_PER_CHUNK = 1000
|
| 134 |
+
try:
|
| 135 |
+
chunked = ours.upscale(latents, settings)
|
| 136 |
+
finally:
|
| 137 |
+
wan_transformer.TOKENS_PER_CHUNK = original
|
| 138 |
+
return report("chunked vs whole", chunked, whole, 1e-3)
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def main() -> None:
|
| 142 |
+
device = torch.device("cuda")
|
| 143 |
+
results = [
|
| 144 |
+
check_flow_model(device),
|
| 145 |
+
check_student("wan_2_1_wan_distill_v1_*.safetensors", device),
|
| 146 |
+
check_student("wan_2_1_wan_small_s20m_*.safetensors", device),
|
| 147 |
+
check_temporal_windows(device),
|
| 148 |
+
check_chunking(device),
|
| 149 |
+
]
|
| 150 |
+
print("PASSED" if all(results) else "FAILED")
|
| 151 |
+
sys.exit(0 if all(results) else 1)
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
if __name__ == "__main__":
|
| 155 |
+
main()
|