Upload patch-forcing
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- patch-forcing/.codex +0 -0
- patch-forcing/.gitignore +16 -0
- patch-forcing/README.md +198 -0
- patch-forcing/assets/denoising-schedule-performance.png +3 -0
- patch-forcing/assets/fpf-inference.png +3 -0
- patch-forcing/assets/fpf.png +3 -0
- patch-forcing/assets/srm-comparison.png +3 -0
- patch-forcing/assets/uncertainty.png +3 -0
- patch-forcing/checkpoints/pft-b_step400k_ema.ckpt +3 -0
- patch-forcing/checkpoints/sd_ae.ckpt +3 -0
- patch-forcing/checkpoints/sd_ae_full.ckpt +3 -0
- patch-forcing/configs/autoencoder/flux2_ae.yaml +4 -0
- patch-forcing/configs/autoencoder/sd_ae.yaml +4 -0
- patch-forcing/configs/autoencoder/tiny_ae.yaml +6 -0
- patch-forcing/configs/config.yaml +93 -0
- patch-forcing/configs/data/dummy256.yaml +17 -0
- patch-forcing/configs/data/imagenet256.yaml +44 -0
- patch-forcing/configs/data/t2i-256.yaml +51 -0
- patch-forcing/configs/experiment/imnet-dit-b.yaml +24 -0
- patch-forcing/configs/experiment/imnet-dit-b_lognorm.yaml +34 -0
- patch-forcing/configs/experiment/imnet-dit-xl.yaml +24 -0
- patch-forcing/configs/experiment/imnet-dit-xl_lognorm.yaml +34 -0
- patch-forcing/configs/experiment/imnet-pft-b.yaml +24 -0
- patch-forcing/configs/experiment/imnet-pft-xl.yaml +24 -0
- patch-forcing/configs/experiment/t2i-pft1.2b-qwen.yaml +34 -0
- patch-forcing/configs/lr_scheduler/constant.yaml +4 -0
- patch-forcing/configs/lr_scheduler/cosine.yaml +6 -0
- patch-forcing/configs/lr_scheduler/exp.yaml +10 -0
- patch-forcing/configs/lr_scheduler/iter_exp.yaml +6 -0
- patch-forcing/configs/model/dit-b.yaml +10 -0
- patch-forcing/configs/model/dit-xl.yaml +10 -0
- patch-forcing/configs/model/pft-b.yaml +11 -0
- patch-forcing/configs/model/pft-xl.yaml +11 -0
- patch-forcing/configs/model/t2i-pft-1.2b.yaml +16 -0
- patch-forcing/configs/sampler/dual-loop.yaml +5 -0
- patch-forcing/configs/sampler/euler-pf.yaml +2 -0
- patch-forcing/configs/sampler/euler.yaml +2 -0
- patch-forcing/configs/sampler/look-ahead.yaml +5 -0
- patch-forcing/configs/trainer/flow.yaml +19 -0
- patch-forcing/configs/trainer/patch_flow.yaml +28 -0
- patch-forcing/configs/trainer/patch_flow_t2i.yaml +38 -0
- patch-forcing/logs/debug/train-official/2026-04-22/T230557/events.out.tfevents.1776870357.hk01dgx015.877147.0 +3 -0
- patch-forcing/logs/debug/train-official/2026-04-22/T230729/events.out.tfevents.1776870449.hk01dgx015.885834.0 +3 -0
- patch-forcing/logs/debug/train-official/2026-04-22/T230841/events.out.tfevents.1776870521.hk01dgx015.890508.0 +3 -0
- patch-forcing/logs/debug/train-official/2026-04-22/T230921/config.yaml +164 -0
- patch-forcing/logs/debug/train-official/2026-04-22/T230921/events.out.tfevents.1776870561.hk01dgx015.893414.0 +3 -0
- patch-forcing/logs/debug/train-official/2026-04-22/T231137/config.yaml +164 -0
- patch-forcing/logs/debug/train-official/2026-04-22/T231137/events.out.tfevents.1776870697.hk01dgx015.903650.0 +3 -0
- patch-forcing/patch_flow/__init__.py +6 -0
- patch-forcing/patch_flow/__pycache__/__init__.cpython-312.pyc +0 -0
patch-forcing/.codex
ADDED
|
File without changes
|
patch-forcing/.gitignore
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sandbox
|
| 2 |
+
checkpoints
|
| 3 |
+
results
|
| 4 |
+
logs
|
| 5 |
+
wandb
|
| 6 |
+
outputs
|
| 7 |
+
|
| 8 |
+
*__pycache__*
|
| 9 |
+
.idea
|
| 10 |
+
venv
|
| 11 |
+
|
| 12 |
+
*.DS_Store
|
| 13 |
+
*._.DS_Store
|
| 14 |
+
shardsFaceHQ
|
| 15 |
+
testy.ipynb
|
| 16 |
+
third_party
|
patch-forcing/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<h2 align="center">Denoising, Fast and Slow: Difficulty-Aware Adaptive Sampling for Image Generation</h2>
|
| 3 |
+
<p align="center">
|
| 4 |
+
<b>
|
| 5 |
+
Johannes Schusterbauer<sup>*</sup> · Ming Gui<sup>*</sup> · Yusong Li · Pingchuan Ma · Felix Krause · Björn Ommer
|
| 6 |
+
</b>
|
| 7 |
+
<p align="center">
|
| 8 |
+
CompVis Group @ LMU Munich, Munich Center for Machine Learning (MCML)
|
| 9 |
+
</p>
|
| 10 |
+
<p align="center">
|
| 11 |
+
CVPR 2026
|
| 12 |
+
</p>
|
| 13 |
+
</p>
|
| 14 |
+
</p>
|
| 15 |
+
<div align="center">
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
[]()
|
| 19 |
+
[](https://github.com/CompVis/patch-forcing)
|
| 20 |
+
|
| 21 |
+
<p align="center"> <sup>*</sup> <i>equal contribution</i> </p>
|
| 22 |
+
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
<p align="center">
|
| 27 |
+
<img src="assets/fpf.png" alt="Patch Forcing overview" width="60%">
|
| 28 |
+
</p>
|
| 29 |
+
|
| 30 |
+
# 🚀 TL;DR
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
**Patch Forcing turns denoising into a spatially adaptive process.** During training, different image patches receive heterogeneous timesteps. While conceptually straightforward, this only works well with a dedicated timestep sampler that controls how much clean information is exposed per sample, closing the train–test gap where inference starts from pure noise. This framework enables dynamic sampling strategies, where easy regions can be denoised faster and provide cleaner context for harder ones.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
🔥 **Contributions**
|
| 37 |
+
- Patch-wise timesteps $\rightarrow$ enables heterogeneous denoising
|
| 38 |
+
- LTG timestep sampler $\rightarrow$ fixes train-test mismatch
|
| 39 |
+
- Patch difficulty-guided sampling $\rightarrow$ allocates compute adaptively
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
<img src="assets/fpf-inference.png" alt="Patch Forcing inference" width="100%">
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
# 📖 Overview
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
Natural images are highly spatially heterogeneous: some regions (e.g. backgrounds) are easy to denoise, while others (e.g. fine structures, text) require more refinement and context.
|
| 49 |
+
However, standard diffusion and flow-based models treat all regions equally, applying the same timestep and compute everywhere.
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
**Key idea**: move from global to patch-wise denoising, where different regions follow different noise trajectories.
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
### Training
|
| 56 |
+
|
| 57 |
+
Naively assigning random timesteps per patch does *not work*. When timesteps are sampled independently and uniformly, most training samples contain a mix of noisy and already partially clean regions. As a result, the model learns to rely on this implicit context, even though such states never occur at inference, where generation starts from pure noise. This creates a clear train–test mismatch.
|
| 58 |
+
|
| 59 |
+
<p align="center">
|
| 60 |
+
<img src="assets/srm-comparison.png" alt="Schedule Comparison" width="100%">
|
| 61 |
+
</p>
|
| 62 |
+
|
| 63 |
+
Prior work (SRM) addresses this by controlling the average amount of information per sample. While this partially mitigates the issue, it does not fully resolve it: even if the average is well-behaved, individual patches can still be nearly clean. In practice, this means that almost every training example still contains highly informative regions.
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
Our key idea is to instead **control the maximum information** available in each sample. Concretely, we first sample a maximum timestep and then restrict all patch-wise timesteps to lie below it. This prevents any region from becoming too clean during training and ensures that the model consistently operates in regimes that match inference.
|
| 67 |
+
|
| 68 |
+
With this simple change, heterogeneous patch-wise denoising works! Even without any adaptive sampling at inference, this training strategy already improves generation quality over standard diffusion models with uniform timesteps.
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
### Inference
|
| 72 |
+
|
| 73 |
+
To fully leverage patch-wise denoising at inference, we need to decide **which regions should be denoised faster** and **which require more refinement**. For this, we augment the model with a lightweight uncertainty (difficulty) head that predicts, for each patch, how reliable the current denoising velocity prediction is.
|
| 74 |
+
|
| 75 |
+
<p align="center">
|
| 76 |
+
<img src="assets/uncertainty.png" alt="Uncertainty" width="40%">
|
| 77 |
+
</p>
|
| 78 |
+
|
| 79 |
+
With heterogeneous denoising and the uncertainty head, we base our adaptive samplers on three key findings:
|
| 80 |
+
|
| 81 |
+
- **context helps denoising** $\rightarrow$ advancing confident (easy) regions provides cleaner context that improves predictions in harder regions
|
| 82 |
+
- **uncertainty reflects patch difficulty** $\rightarrow$ higher uncertainty correlates with higher validation loss
|
| 83 |
+
- **more context reduces uncertainty** $\rightarrow$ cleaner neighboring regions make difficult patches easier to denoise
|
| 84 |
+
|
| 85 |
+
These findings naturally lead to adaptive sampling strategies that allocate compute where it is most useful. Instead of denoising all patches uniformly, we use the predicted uncertainty to guide the process: easy regions are advanced more aggressively, while difficult ones receive additional refinement.
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
<p align="center">
|
| 89 |
+
<img src="assets/denoising-schedule-performance.png" alt="ImageNet Results" width="100%">
|
| 90 |
+
</p>
|
| 91 |
+
|
| 92 |
+
- The **dual-loop** sampler alternates between quickly advancing confident patches and refining uncertain ones with smaller steps.
|
| 93 |
+
- The **look-ahead** sampler goes one step further by explicitly advancing confident patches into the future and using their cleaner states as context for denoising harder regions.
|
| 94 |
+
|
| 95 |
+
**Together, these strategies turn patch-wise heterogeneity into adaptive inference, improving generation quality under the same compute budget by focusing effort where it matters most.**
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
Please refer to our paper for a more detailed description of our framework. 😉
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
# 🛠️ Code Setup
|
| 102 |
+
|
| 103 |
+
This codebase is based on Python `3.12` and the packages listed in `requirements.txt`.
|
| 104 |
+
|
| 105 |
+
First, clone the repository:
|
| 106 |
+
|
| 107 |
+
```bash
|
| 108 |
+
git clone git@github.com:CompVis/patch-forcing.git
|
| 109 |
+
cd patch-forcing
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
Then create the environment and install the dependencies:
|
| 113 |
+
|
| 114 |
+
```bash
|
| 115 |
+
conda create -n pft python=3.12
|
| 116 |
+
conda activate pft
|
| 117 |
+
pip install -r requirements.txt
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
If the default install fails on your machine, follow the safer install order noted in ?`requirements.txt`: install `torch` and `torchvision` first, then `flash-attn`, then the remaining requirements.
|
| 121 |
+
|
| 122 |
+
We release two Patch Forcing checkpoints: [PFT-B](https://ommer-lab.com/files/pft/pft-b_step400k_ema.ckpt) and [PFT-XL](https://ommer-lab.com/files/pft/pft-xl_step400k_ema.ckpt). The checkpoints contain the EMA weights, as well as the model config.
|
| 123 |
+
|
| 124 |
+
### Class-Conditional Generation
|
| 125 |
+
|
| 126 |
+
#### Inference
|
| 127 |
+
|
| 128 |
+
To generate class-conditional samples use:
|
| 129 |
+
|
| 130 |
+
```bash
|
| 131 |
+
python scripts/sample.py \
|
| 132 |
+
--ckpt /path/to/model.ckpt \
|
| 133 |
+
--sample-fn-config configs/sampler/dual-loop.yaml \
|
| 134 |
+
--num-sampling-steps 100 \
|
| 135 |
+
--cfg-scale 4.0
|
| 136 |
+
# ... you can add sampler specific args via dot-notation
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
For FID samples use `scripts/sample_ddp.py`:
|
| 140 |
+
|
| 141 |
+
```bash
|
| 142 |
+
torchrun --standalone --nproc_per_node=8 scripts/sample_ddp.py \
|
| 143 |
+
--ckpt /path/to/model.ckpt \
|
| 144 |
+
--sample-fn-config configs/sampler/euler-pf.yaml \
|
| 145 |
+
--per-proc-batch-size 64 \
|
| 146 |
+
--num-fid-samples 50000 \
|
| 147 |
+
--num-sampling-steps 100 \
|
| 148 |
+
--cfg-scale 1.0
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
If your checkpoint comes from training and does not already contain the compact `config` + `state_dict` format expected by the samplers, convert it first:
|
| 152 |
+
|
| 153 |
+
```bash
|
| 154 |
+
python scripts/convert_ckpt.py /path/to/training.ckpt
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
#### Training
|
| 159 |
+
|
| 160 |
+
You can train new models via `train.py`. The repository is based on `hydra`, and the base config lives in `configs/config.yaml`. Experiments in `configs/experiment` overwrite this base config. Use CLI overrides to swap configs or change individual fields, for example `python train.py experiment=imnet-pft-b name=imnet/my-run data=dummy256 train_params.max_steps=10000`.
|
| 161 |
+
|
| 162 |
+
To directly use the ImageNet-256 webdataset file, configure the ImageNet-256 shard locations in `configs/data/imagenet256.yaml`.
|
| 163 |
+
For debugging, use you can use `configs/data/dummy256.yaml`.
|
| 164 |
+
|
| 165 |
+
Train the main class-conditional experiments with:
|
| 166 |
+
|
| 167 |
+
```bash
|
| 168 |
+
python train.py experiment=imnet-pft-b
|
| 169 |
+
python train.py experiment=imnet-pft-xl
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
If you want to use your own dataloader, make sure it returns a dictionary with `image` (bchw tensor normalized to $[-1, 1]$) and `label`.
|
| 173 |
+
|
| 174 |
+
### Text-to-Image
|
| 175 |
+
|
| 176 |
+
For text-to-image training, first fill in the gaps in `configs/data/t2i-256.yaml` and then you can train them with
|
| 177 |
+
|
| 178 |
+
```bash
|
| 179 |
+
python train.py experiment=t2i-pft1.2b-qwen
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
The batch should contain a dict with `image`, text (set corresponding text key in trainer), and `img_meta` if you want to include crop size conditioning via RoPE (see `patch_flow/data_utils.py` for more info). The default loader uses random caption sampling (as we used multiple caption lengths during training).
|
| 183 |
+
|
| 184 |
+
You can use `scripts/t2i_sample.py` to sample images based on a text prompt.
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
## 🎓 Citation
|
| 188 |
+
|
| 189 |
+
If you use our work in your research, please use the following BibTeX entry. 🙂
|
| 190 |
+
|
| 191 |
+
```bibtex
|
| 192 |
+
@InProceedings{schusterbauer2025patchforcing,
|
| 193 |
+
title={Denoising, Fast and Slow: Difficulty-Aware Adaptive Sampling for Image Generation},
|
| 194 |
+
author={Johannes Schusterbauer and Ming Gui and Yusong Li and Pingchuan Ma and Felix Krause and Björn Ommer},
|
| 195 |
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
| 196 |
+
year={2026}
|
| 197 |
+
}
|
| 198 |
+
```
|
patch-forcing/assets/denoising-schedule-performance.png
ADDED
|
Git LFS Details
|
patch-forcing/assets/fpf-inference.png
ADDED
|
Git LFS Details
|
patch-forcing/assets/fpf.png
ADDED
|
Git LFS Details
|
patch-forcing/assets/srm-comparison.png
ADDED
|
Git LFS Details
|
patch-forcing/assets/uncertainty.png
ADDED
|
Git LFS Details
|
patch-forcing/checkpoints/pft-b_step400k_ema.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:941eeaf3a9c19639b57b22542614e6bd006b69f58437e825aedbd1baee188b57
|
| 3 |
+
size 522055289
|
patch-forcing/checkpoints/sd_ae.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d06a99897e89e3f973096adb8762fa7e260638157064330c6b8c325594b54ad9
|
| 3 |
+
size 334676563
|
patch-forcing/checkpoints/sd_ae_full.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b204ad0cae549e0a7e298d803d57e36363760dec71c63109c1da3e1147ec520
|
| 3 |
+
size 334695179
|
patch-forcing/configs/autoencoder/flux2_ae.yaml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: FLUX2AutoencoderKL
|
| 2 |
+
target: jutils.nn.ae_flux2.FLUX2AutoencoderKL # first stage model (KL-Autoencoder from FLUX.2)
|
| 3 |
+
params:
|
| 4 |
+
ckpt_path: checkpoints/flux2_ae.ckpt
|
patch-forcing/configs/autoencoder/sd_ae.yaml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: AutoencoderKL
|
| 2 |
+
target: jutils.nn.kl_autoencoder.AutoencoderKL # first stage model (KL-Autoencoder from LDM)
|
| 3 |
+
params:
|
| 4 |
+
ckpt_path: checkpoints/sd_ae.ckpt
|
patch-forcing/configs/autoencoder/tiny_ae.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: TinyAutoencoderKL
|
| 2 |
+
target: jutils.nn.tiny_autoencoder.TinyAutoencoderKL
|
| 3 |
+
params:
|
| 4 |
+
encoder_path: checkpoints/taesd_encoder.pth
|
| 5 |
+
decoder_path: checkpoints/taesd_decoder.pth
|
| 6 |
+
latent_channels: 4
|
patch-forcing/configs/config.yaml
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- _self_
|
| 3 |
+
- model: dit-b
|
| 4 |
+
- data: dummy256 # dummy data
|
| 5 |
+
- autoencoder: tiny_ae
|
| 6 |
+
- lr_scheduler: null
|
| 7 |
+
- trainer: flow
|
| 8 |
+
- experiment: null # must be last in defaults list as it can override all others
|
| 9 |
+
|
| 10 |
+
# disable hydra logging
|
| 11 |
+
- override hydra/hydra_logging: disabled
|
| 12 |
+
- override hydra/job_logging: disabled
|
| 13 |
+
|
| 14 |
+
# ----------------------------------------
|
| 15 |
+
name: debug/your_exp
|
| 16 |
+
|
| 17 |
+
# ----------------------------------------
|
| 18 |
+
# logging
|
| 19 |
+
use_wandb: False
|
| 20 |
+
use_wandb_offline: False
|
| 21 |
+
wandb_project: patch-forcing
|
| 22 |
+
|
| 23 |
+
tags: []
|
| 24 |
+
|
| 25 |
+
# checkpoint loading
|
| 26 |
+
load_weights: null
|
| 27 |
+
load_strict: True
|
| 28 |
+
# resume_step: 0 # can be used for load_weights to specify step (not required for resume_checkpoint)
|
| 29 |
+
resume_checkpoint: null
|
| 30 |
+
|
| 31 |
+
# checkpoint saving (lightning callback)
|
| 32 |
+
checkpoint_params: # filename refers to number of gradient updates
|
| 33 |
+
every_n_train_steps: 10000 # gradient update steps
|
| 34 |
+
save_top_k: -1 # needs to be -1, otherwise it overwrites
|
| 35 |
+
verbose: True
|
| 36 |
+
save_last: True
|
| 37 |
+
auto_insert_metric_name: False
|
| 38 |
+
|
| 39 |
+
# ----------------------------------------
|
| 40 |
+
train_params:
|
| 41 |
+
max_steps: -1
|
| 42 |
+
max_epochs: -1
|
| 43 |
+
num_sanity_val_steps: 0
|
| 44 |
+
accumulate_grad_batches: 1
|
| 45 |
+
log_every_n_steps: 1 # gradient update steps
|
| 46 |
+
limit_val_batches: 8 # per GPU
|
| 47 |
+
val_check_interval: 5000 # steps, regardless of gradient accumulation
|
| 48 |
+
precision: bf16-mixed
|
| 49 |
+
clip_grad_norm: 1.0
|
| 50 |
+
|
| 51 |
+
callbacks:
|
| 52 |
+
- target: lightning.pytorch.callbacks.LearningRateMonitor
|
| 53 |
+
params:
|
| 54 |
+
logging_interval: 'step'
|
| 55 |
+
|
| 56 |
+
# ----------------------------------------
|
| 57 |
+
# profiling
|
| 58 |
+
profile: false
|
| 59 |
+
profiling:
|
| 60 |
+
warmup: 40
|
| 61 |
+
active: 1
|
| 62 |
+
filename: profile.json
|
| 63 |
+
cpu: true
|
| 64 |
+
cuda: true
|
| 65 |
+
record_shapes: false
|
| 66 |
+
profile_memory: false
|
| 67 |
+
with_flops: false
|
| 68 |
+
|
| 69 |
+
# ----------------------------------------
|
| 70 |
+
# distributed
|
| 71 |
+
num_nodes: 1
|
| 72 |
+
devices: -1
|
| 73 |
+
auto_requeue: False
|
| 74 |
+
tqdm_refresh_rate: 1 # set higher on slurm (otherwise prints tqdm every step)
|
| 75 |
+
deepspeed_stage: 0
|
| 76 |
+
p2p_disable: False
|
| 77 |
+
slurm_id: null
|
| 78 |
+
cuda_prefetch: False
|
| 79 |
+
cuda_prefetch_factor: 2
|
| 80 |
+
ddp_kwargs:
|
| 81 |
+
find_unused_parameters: False # default: False
|
| 82 |
+
gradient_as_bucket_view: True # default: False
|
| 83 |
+
bucket_cap_mb: 100 # default: 25
|
| 84 |
+
broadcast_buffers: True # default: True
|
| 85 |
+
|
| 86 |
+
# ----------------------------------------
|
| 87 |
+
user: ${oc.env:USER}
|
| 88 |
+
|
| 89 |
+
# don't log and save files
|
| 90 |
+
hydra:
|
| 91 |
+
output_subdir: null
|
| 92 |
+
run:
|
| 93 |
+
dir: .
|
patch-forcing/configs/data/dummy256.yaml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Dummy_256
|
| 2 |
+
num_classes: 1000
|
| 3 |
+
target: patch_flow.dataloader.DataModuleFromConfig
|
| 4 |
+
params:
|
| 5 |
+
batch_size: 16
|
| 6 |
+
num_workers: 4
|
| 7 |
+
train:
|
| 8 |
+
target: patch_flow.dataloader.DummyDataset
|
| 9 |
+
params:
|
| 10 |
+
image: [3, 256, 256]
|
| 11 |
+
label: [1]
|
| 12 |
+
|
| 13 |
+
validation:
|
| 14 |
+
target: patch_flow.dataloader.DummyDataset
|
| 15 |
+
params:
|
| 16 |
+
image: [3, 256, 256]
|
| 17 |
+
label: [1]
|
patch-forcing/configs/data/imagenet256.yaml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: ImageNet_256px
|
| 2 |
+
num_classes: 1000
|
| 3 |
+
target: patch_flow.dataloader.WebDataModuleFromConfig
|
| 4 |
+
params:
|
| 5 |
+
tar_base: ... # TODO: add path to tar files: path/to/tars
|
| 6 |
+
batch_size: 32
|
| 7 |
+
num_workers: 4
|
| 8 |
+
val_num_workers: 1
|
| 9 |
+
multinode: True
|
| 10 |
+
train:
|
| 11 |
+
shards: ... # TODO: add shards like this: 'train/{000000..999999}.tar'
|
| 12 |
+
shuffle: 100
|
| 13 |
+
image_key: jpeg
|
| 14 |
+
rename:
|
| 15 |
+
image: jpeg
|
| 16 |
+
label: cls
|
| 17 |
+
image_transforms:
|
| 18 |
+
- target: torchvision.transforms.RandomHorizontalFlip
|
| 19 |
+
params:
|
| 20 |
+
p: 0.5
|
| 21 |
+
- target: torchvision.transforms.Resize
|
| 22 |
+
params:
|
| 23 |
+
size: 256
|
| 24 |
+
interpolation: 2
|
| 25 |
+
antialias: True
|
| 26 |
+
- target: torchvision.transforms.CenterCrop
|
| 27 |
+
params:
|
| 28 |
+
size: 256
|
| 29 |
+
|
| 30 |
+
validation:
|
| 31 |
+
shards: ... # TODO: validation shards:'val/{000000..000100}.tar'
|
| 32 |
+
image_key: jpeg
|
| 33 |
+
rename:
|
| 34 |
+
image: jpeg
|
| 35 |
+
label: cls
|
| 36 |
+
image_transforms:
|
| 37 |
+
- target: torchvision.transforms.Resize
|
| 38 |
+
params:
|
| 39 |
+
size: 256
|
| 40 |
+
interpolation: 2
|
| 41 |
+
antialias: True
|
| 42 |
+
- target: torchvision.transforms.CenterCrop
|
| 43 |
+
params:
|
| 44 |
+
size: 256
|
patch-forcing/configs/data/t2i-256.yaml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.dataloader.WebDataModuleFromConfig
|
| 2 |
+
params:
|
| 3 |
+
tar_base: ... # TODO: add path to tar files: path/to/tars
|
| 4 |
+
batch_size: 8
|
| 5 |
+
num_workers: 8
|
| 6 |
+
val_batch_size: 16
|
| 7 |
+
val_num_workers: 1
|
| 8 |
+
multinode: True
|
| 9 |
+
|
| 10 |
+
train:
|
| 11 |
+
shards: ... # TODO: add shards like this: 'train/{000000..999999}.tar'
|
| 12 |
+
shuffle: 100
|
| 13 |
+
image_key: jpg
|
| 14 |
+
rename:
|
| 15 |
+
image: jpg
|
| 16 |
+
dataset_transforms:
|
| 17 |
+
target: patch_flow.data_utils.TransformComposer
|
| 18 |
+
params:
|
| 19 |
+
transforms:
|
| 20 |
+
# crop-size conditioning via RoPE
|
| 21 |
+
- target: patch_flow.data_utils.ResizeCropWithMetaInfo
|
| 22 |
+
params:
|
| 23 |
+
size: 256
|
| 24 |
+
img_key: image
|
| 25 |
+
meta_key: img_meta
|
| 26 |
+
# if available, caption sampling with probs per caption type/length
|
| 27 |
+
- target: patch_flow.data_utils.CaptionSampler
|
| 28 |
+
params:
|
| 29 |
+
out_txt_key: txt
|
| 30 |
+
txt_sampling_cfg:
|
| 31 |
+
txt: 1
|
| 32 |
+
long: 2
|
| 33 |
+
medium: 3
|
| 34 |
+
short: 4
|
| 35 |
+
keywords: 2
|
| 36 |
+
|
| 37 |
+
validation:
|
| 38 |
+
shards: ... # TODO: validation shards:'val/{000000..000100}.tar'
|
| 39 |
+
image_key: jpg
|
| 40 |
+
rename:
|
| 41 |
+
image: jpg
|
| 42 |
+
txt: medium # use medium caption for val
|
| 43 |
+
image_transforms:
|
| 44 |
+
- target: torchvision.transforms.Resize
|
| 45 |
+
params:
|
| 46 |
+
size: 256
|
| 47 |
+
interpolation: 2
|
| 48 |
+
antialias: True
|
| 49 |
+
- target: torchvision.transforms.CenterCrop
|
| 50 |
+
params:
|
| 51 |
+
size: 256
|
patch-forcing/configs/experiment/imnet-dit-b.yaml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- override /trainer: flow
|
| 4 |
+
- override /data: imagenet256
|
| 5 |
+
- override /model: dit-b
|
| 6 |
+
- override /autoencoder: sd_ae
|
| 7 |
+
- override /lr_scheduler: constant
|
| 8 |
+
|
| 9 |
+
name: debug/imnet256/dit-b
|
| 10 |
+
|
| 11 |
+
model:
|
| 12 |
+
params:
|
| 13 |
+
compile: true
|
| 14 |
+
|
| 15 |
+
data:
|
| 16 |
+
params:
|
| 17 |
+
batch_size: 64
|
| 18 |
+
val_batch_size: 32
|
| 19 |
+
|
| 20 |
+
train_params:
|
| 21 |
+
max_steps: 400000
|
| 22 |
+
limit_val_batches: 40
|
| 23 |
+
val_check_interval: 10000
|
| 24 |
+
precision: bf16-mixed
|
patch-forcing/configs/experiment/imnet-dit-b_lognorm.yaml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- override /trainer: flow
|
| 4 |
+
- override /data: imagenet256
|
| 5 |
+
- override /model: dit-b
|
| 6 |
+
- override /autoencoder: sd_ae
|
| 7 |
+
- override /lr_scheduler: constant
|
| 8 |
+
|
| 9 |
+
name: debug/imnet256/dit-b/lognorm/l0.0_s1.0
|
| 10 |
+
|
| 11 |
+
model:
|
| 12 |
+
params:
|
| 13 |
+
compile: true
|
| 14 |
+
|
| 15 |
+
trainer:
|
| 16 |
+
params:
|
| 17 |
+
flow:
|
| 18 |
+
params:
|
| 19 |
+
timestep_sampler:
|
| 20 |
+
target: patch_flow.flow.LogitNormalSampler
|
| 21 |
+
params:
|
| 22 |
+
loc: 0.0
|
| 23 |
+
scale: 1.0
|
| 24 |
+
|
| 25 |
+
data:
|
| 26 |
+
params:
|
| 27 |
+
batch_size: 64
|
| 28 |
+
val_batch_size: 32
|
| 29 |
+
|
| 30 |
+
train_params:
|
| 31 |
+
max_steps: 400000
|
| 32 |
+
limit_val_batches: 40
|
| 33 |
+
val_check_interval: 10000
|
| 34 |
+
precision: bf16-mixed
|
patch-forcing/configs/experiment/imnet-dit-xl.yaml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- override /trainer: flow
|
| 4 |
+
- override /data: imagenet256
|
| 5 |
+
- override /model: dit-xl
|
| 6 |
+
- override /autoencoder: sd_ae
|
| 7 |
+
- override /lr_scheduler: constant
|
| 8 |
+
|
| 9 |
+
name: debug/imnet256/dit-xl
|
| 10 |
+
|
| 11 |
+
model:
|
| 12 |
+
params:
|
| 13 |
+
compile: true
|
| 14 |
+
|
| 15 |
+
data:
|
| 16 |
+
params:
|
| 17 |
+
batch_size: 32
|
| 18 |
+
val_batch_size: 32
|
| 19 |
+
|
| 20 |
+
train_params:
|
| 21 |
+
max_steps: 400000
|
| 22 |
+
limit_val_batches: 40
|
| 23 |
+
val_check_interval: 10000
|
| 24 |
+
precision: bf16-mixed
|
patch-forcing/configs/experiment/imnet-dit-xl_lognorm.yaml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- override /trainer: flow
|
| 4 |
+
- override /data: imagenet256
|
| 5 |
+
- override /model: dit-xl
|
| 6 |
+
- override /autoencoder: sd_ae
|
| 7 |
+
- override /lr_scheduler: constant
|
| 8 |
+
|
| 9 |
+
name: debug/imnet256/dit-xl/lognorm/l0.0_s1.0
|
| 10 |
+
|
| 11 |
+
model:
|
| 12 |
+
params:
|
| 13 |
+
compile: true
|
| 14 |
+
|
| 15 |
+
trainer:
|
| 16 |
+
params:
|
| 17 |
+
flow:
|
| 18 |
+
params:
|
| 19 |
+
timestep_sampler:
|
| 20 |
+
target: patch_flow.flow.LogitNormalSampler
|
| 21 |
+
params:
|
| 22 |
+
loc: 0.0
|
| 23 |
+
scale: 1.0
|
| 24 |
+
|
| 25 |
+
data:
|
| 26 |
+
params:
|
| 27 |
+
batch_size: 32
|
| 28 |
+
val_batch_size: 32
|
| 29 |
+
|
| 30 |
+
train_params:
|
| 31 |
+
max_steps: 400000
|
| 32 |
+
limit_val_batches: 40
|
| 33 |
+
val_check_interval: 10000
|
| 34 |
+
precision: bf16-mixed
|
patch-forcing/configs/experiment/imnet-pft-b.yaml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- override /trainer: patch_flow
|
| 4 |
+
- override /data: imagenet256
|
| 5 |
+
- override /model: pft-b
|
| 6 |
+
- override /autoencoder: sd_ae
|
| 7 |
+
- override /lr_scheduler: constant
|
| 8 |
+
|
| 9 |
+
name: debug/imnet256/pft-b
|
| 10 |
+
|
| 11 |
+
model:
|
| 12 |
+
params:
|
| 13 |
+
compile: true
|
| 14 |
+
|
| 15 |
+
data:
|
| 16 |
+
params:
|
| 17 |
+
batch_size: 64
|
| 18 |
+
val_batch_size: 32
|
| 19 |
+
|
| 20 |
+
train_params:
|
| 21 |
+
max_steps: 400000
|
| 22 |
+
limit_val_batches: 40
|
| 23 |
+
val_check_interval: 10000
|
| 24 |
+
precision: bf16-mixed
|
patch-forcing/configs/experiment/imnet-pft-xl.yaml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- override /trainer: patch_flow
|
| 4 |
+
- override /data: imagenet256
|
| 5 |
+
- override /model: pft-xl
|
| 6 |
+
- override /autoencoder: sd_ae
|
| 7 |
+
- override /lr_scheduler: constant
|
| 8 |
+
|
| 9 |
+
name: debug/imnet256/pft-xl
|
| 10 |
+
|
| 11 |
+
model:
|
| 12 |
+
params:
|
| 13 |
+
compile: true
|
| 14 |
+
|
| 15 |
+
data:
|
| 16 |
+
params:
|
| 17 |
+
batch_size: 32
|
| 18 |
+
val_batch_size: 32
|
| 19 |
+
|
| 20 |
+
train_params:
|
| 21 |
+
max_steps: 400000
|
| 22 |
+
limit_val_batches: 40
|
| 23 |
+
val_check_interval: 10000
|
| 24 |
+
precision: bf16-mixed
|
patch-forcing/configs/experiment/t2i-pft1.2b-qwen.yaml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @package _global_
|
| 2 |
+
defaults:
|
| 3 |
+
- override /trainer: patch_flow_t2i
|
| 4 |
+
- override /data: t2i-256 # change to your data config
|
| 5 |
+
- override /model: t2i-pft-1.2b
|
| 6 |
+
- override /autoencoder: flux2_ae
|
| 7 |
+
- override /lr_scheduler: constant
|
| 8 |
+
|
| 9 |
+
name: debug/t2i/coyo/qwen2b/pf-1.2b
|
| 10 |
+
|
| 11 |
+
compile: true
|
| 12 |
+
|
| 13 |
+
data:
|
| 14 |
+
params:
|
| 15 |
+
batch_size: 32
|
| 16 |
+
val_batch_size: 32
|
| 17 |
+
num_workers: 8
|
| 18 |
+
|
| 19 |
+
model:
|
| 20 |
+
params:
|
| 21 |
+
in_dim: 32 # must match latent space dim
|
| 22 |
+
compile: ${compile}
|
| 23 |
+
|
| 24 |
+
trainer:
|
| 25 |
+
params:
|
| 26 |
+
text_encoder:
|
| 27 |
+
params:
|
| 28 |
+
compile: ${compile}
|
| 29 |
+
|
| 30 |
+
train_params:
|
| 31 |
+
max_steps: 400000
|
| 32 |
+
limit_val_batches: 10
|
| 33 |
+
val_check_interval: 10000
|
| 34 |
+
precision: bf16-mixed
|
patch-forcing/configs/lr_scheduler/constant.yaml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: constant
|
| 2 |
+
target: jutils.nn.lr_schedulers.get_constant_schedule_with_warmup
|
| 3 |
+
params:
|
| 4 |
+
num_warmup_steps: 1000
|
patch-forcing/configs/lr_scheduler/cosine.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: cosine
|
| 2 |
+
target: jutils.nn.lr_schedulers.get_cosine_schedule_with_warmup
|
| 3 |
+
params:
|
| 4 |
+
num_warmup_steps: 1000
|
| 5 |
+
num_training_steps: 100000
|
| 6 |
+
num_cycles: 0.5
|
patch-forcing/configs/lr_scheduler/exp.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Warmup-Stable-Decay (WSD) learning rate schedule according to the paper:
|
| 2 |
+
# 'MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies'
|
| 3 |
+
# - Hu et al. (2024)
|
| 4 |
+
# Max training steps in WSD annealing phase: 3 * t_decay
|
| 5 |
+
# t_decay should be ~2% of the previous training steps with constant lr
|
| 6 |
+
name: exponential
|
| 7 |
+
target: jutils.nn.lr_schedulers.get_exponential_decay_schedule
|
| 8 |
+
params:
|
| 9 |
+
num_warmup_steps: 0
|
| 10 |
+
t_decay: 2000
|
patch-forcing/configs/lr_scheduler/iter_exp.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: iter_exponential
|
| 2 |
+
target: jutils.nn.lr_schedulers.get_iter_exponential_schedule
|
| 3 |
+
params:
|
| 4 |
+
num_warmup_steps: 1000
|
| 5 |
+
num_training_steps: 100000
|
| 6 |
+
final_ratio: 0.05
|
patch-forcing/configs/model/dit-b.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.models.dit.DiT
|
| 2 |
+
params:
|
| 3 |
+
in_channels: 4
|
| 4 |
+
input_size: 32
|
| 5 |
+
depth: 12
|
| 6 |
+
hidden_size: 768
|
| 7 |
+
patch_size: 2
|
| 8 |
+
num_heads: 12
|
| 9 |
+
num_classes: 1000
|
| 10 |
+
compile: true
|
patch-forcing/configs/model/dit-xl.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.models.dit.DiT
|
| 2 |
+
params:
|
| 3 |
+
in_channels: 4
|
| 4 |
+
input_size: 32
|
| 5 |
+
depth: 28
|
| 6 |
+
hidden_size: 1152
|
| 7 |
+
patch_size: 2
|
| 8 |
+
num_heads: 16
|
| 9 |
+
num_classes: 1000
|
| 10 |
+
compile: true
|
patch-forcing/configs/model/pft-b.yaml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.models.pf_transformer.PatchForcingDiT
|
| 2 |
+
params:
|
| 3 |
+
in_channels: 4
|
| 4 |
+
input_size: 32
|
| 5 |
+
depth: 12
|
| 6 |
+
hidden_size: 768
|
| 7 |
+
patch_size: 2
|
| 8 |
+
num_heads: 12
|
| 9 |
+
num_classes: 1000
|
| 10 |
+
compile: true
|
| 11 |
+
predict_uncertainty: true
|
patch-forcing/configs/model/pft-xl.yaml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.models.pf_transformer.PatchForcingDiT
|
| 2 |
+
params:
|
| 3 |
+
in_channels: 4
|
| 4 |
+
input_size: 32
|
| 5 |
+
depth: 28
|
| 6 |
+
hidden_size: 1152
|
| 7 |
+
patch_size: 2
|
| 8 |
+
num_heads: 16
|
| 9 |
+
num_classes: 1000
|
| 10 |
+
compile: true
|
| 11 |
+
predict_uncertainty: true
|
patch-forcing/configs/model/t2i-pft-1.2b.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# params: 1,239,969,008
|
| 2 |
+
target: patch_flow.models.pf_transformer_t2i.PatchForcingTransformerT2I
|
| 3 |
+
params:
|
| 4 |
+
in_dim: 4
|
| 5 |
+
depth: 28
|
| 6 |
+
hidden_dim: 1536
|
| 7 |
+
head_dim: 96 # 16 heads
|
| 8 |
+
mapping_dim: 384
|
| 9 |
+
mapping_depth: 2
|
| 10 |
+
patch_size: 2
|
| 11 |
+
# text things
|
| 12 |
+
txt_in_dim: 2048 # must match text encoder output dim!
|
| 13 |
+
txt_refiner_dim: 1536
|
| 14 |
+
txt_refiner_head_dim: 128 # 12 heads
|
| 15 |
+
txt_refiner_depth: 2
|
| 16 |
+
compile: false
|
patch-forcing/configs/sampler/dual-loop.yaml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.integrators.DualLoopSampler
|
| 2 |
+
params:
|
| 3 |
+
p: 0.4
|
| 4 |
+
n_inner: 4
|
| 5 |
+
patch_size: 2
|
patch-forcing/configs/sampler/euler-pf.yaml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.integrators.EulerPF
|
| 2 |
+
params: {}
|
patch-forcing/configs/sampler/euler.yaml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.integrators.Euler
|
| 2 |
+
params: {}
|
patch-forcing/configs/sampler/look-ahead.yaml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.integrators.LookAheadSampler
|
| 2 |
+
params:
|
| 3 |
+
p: 0.4
|
| 4 |
+
patch_size: 2
|
| 5 |
+
context_t_ratio: 1.4
|
patch-forcing/configs/trainer/flow.yaml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.trainer.LatentFlowTrainer
|
| 2 |
+
params:
|
| 3 |
+
model: ${oc.select:model, null}
|
| 4 |
+
first_stage: ${oc.select:autoencoder, null}
|
| 5 |
+
flow:
|
| 6 |
+
target: patch_flow.flow.Flow
|
| 7 |
+
params:
|
| 8 |
+
timestep_sampler: null
|
| 9 |
+
|
| 10 |
+
# learning
|
| 11 |
+
lr: 1e-4
|
| 12 |
+
weight_decay: 0.0
|
| 13 |
+
ema_rate: 0.9999
|
| 14 |
+
lr_scheduler_cfg: ${oc.select:lr_scheduler, null}
|
| 15 |
+
|
| 16 |
+
# sampling
|
| 17 |
+
sample_kwargs:
|
| 18 |
+
num_steps: 50
|
| 19 |
+
progress: False
|
patch-forcing/configs/trainer/patch_flow.yaml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.trainer.LatentPatchForcingTrainer
|
| 2 |
+
|
| 3 |
+
params:
|
| 4 |
+
model: ${oc.select:model, null}
|
| 5 |
+
first_stage: ${oc.select:autoencoder, null}
|
| 6 |
+
|
| 7 |
+
# patch flow forcing
|
| 8 |
+
flow:
|
| 9 |
+
target: patch_flow.flow_pf.PatchFlowForcing
|
| 10 |
+
params:
|
| 11 |
+
patch_size: 2
|
| 12 |
+
timestep_sampler:
|
| 13 |
+
target: patch_flow.timestep_schedules.LogitNormalTruncatedGaussian
|
| 14 |
+
params:
|
| 15 |
+
std: 0.6
|
| 16 |
+
loc: 0.7
|
| 17 |
+
scale: 1.0
|
| 18 |
+
|
| 19 |
+
# learning
|
| 20 |
+
lr: 1e-4
|
| 21 |
+
weight_decay: 0.0
|
| 22 |
+
ema_rate: 0.9999
|
| 23 |
+
lr_scheduler_cfg: ${oc.select:lr_scheduler, null}
|
| 24 |
+
|
| 25 |
+
# sampling
|
| 26 |
+
sample_kwargs:
|
| 27 |
+
num_steps: 50
|
| 28 |
+
progress: False
|
patch-forcing/configs/trainer/patch_flow_t2i.yaml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
target: patch_flow.trainer_t2i.PatchForcingT2ITrainer
|
| 2 |
+
|
| 3 |
+
params:
|
| 4 |
+
model: ${oc.select:model, null}
|
| 5 |
+
first_stage: ${oc.select:autoencoder, null}
|
| 6 |
+
|
| 7 |
+
# patch flow forcing
|
| 8 |
+
flow:
|
| 9 |
+
target: patch_flow.flow_pf.PatchFlowForcing
|
| 10 |
+
params:
|
| 11 |
+
patch_size: 2
|
| 12 |
+
timestep_sampler:
|
| 13 |
+
target: patch_flow.timestep_schedules.LogitNormalTruncatedGaussian
|
| 14 |
+
params:
|
| 15 |
+
std: 0.6
|
| 16 |
+
loc: 0.5
|
| 17 |
+
scale: 1.0
|
| 18 |
+
|
| 19 |
+
# text conditioning
|
| 20 |
+
text_encoder:
|
| 21 |
+
target: patch_flow.text_encoder.Qwen3VLEmbedder2B
|
| 22 |
+
params:
|
| 23 |
+
compile: true
|
| 24 |
+
text_dropout_prob: 0.1
|
| 25 |
+
text_key: txt
|
| 26 |
+
|
| 27 |
+
# learning
|
| 28 |
+
lr: 1e-4
|
| 29 |
+
weight_decay: 0.0
|
| 30 |
+
ema_rate: 0.9999
|
| 31 |
+
lr_scheduler_cfg: ${oc.select:lr_scheduler, null}
|
| 32 |
+
rope_jittering: true
|
| 33 |
+
uncertainty_weight: 0.01
|
| 34 |
+
|
| 35 |
+
# sampling
|
| 36 |
+
sample_kwargs:
|
| 37 |
+
num_steps: 50
|
| 38 |
+
progress: False
|
patch-forcing/logs/debug/train-official/2026-04-22/T230557/events.out.tfevents.1776870357.hk01dgx015.877147.0
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:63290c0b8c9d9af6d3294511792d3a0cdc1c4be2d31e9a1ec38b932fe6602d9c
|
| 3 |
+
size 88
|
patch-forcing/logs/debug/train-official/2026-04-22/T230729/events.out.tfevents.1776870449.hk01dgx015.885834.0
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a23848ee37a3d93543e06d3859c9d702ed5bfa875c5392a59ce431e8f3ebfde9
|
| 3 |
+
size 88
|
patch-forcing/logs/debug/train-official/2026-04-22/T230841/events.out.tfevents.1776870521.hk01dgx015.890508.0
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c9f0c11a0a7f2e5cdb0ae4b64f6153552484d0fe2aa5f3db2396ed046ced5375
|
| 3 |
+
size 88
|
patch-forcing/logs/debug/train-official/2026-04-22/T230921/config.yaml
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: debug/train-official
|
| 2 |
+
use_wandb: false
|
| 3 |
+
use_wandb_offline: false
|
| 4 |
+
wandb_project: patch-forcing
|
| 5 |
+
tags: []
|
| 6 |
+
load_weights: null
|
| 7 |
+
load_strict: true
|
| 8 |
+
resume_checkpoint: null
|
| 9 |
+
checkpoint_params:
|
| 10 |
+
every_n_train_steps: 10000
|
| 11 |
+
save_top_k: -1
|
| 12 |
+
verbose: true
|
| 13 |
+
save_last: true
|
| 14 |
+
auto_insert_metric_name: false
|
| 15 |
+
train_params:
|
| 16 |
+
max_steps: 1
|
| 17 |
+
max_epochs: -1
|
| 18 |
+
num_sanity_val_steps: 0
|
| 19 |
+
accumulate_grad_batches: 1
|
| 20 |
+
log_every_n_steps: 1
|
| 21 |
+
limit_val_batches: 0
|
| 22 |
+
val_check_interval: 10000
|
| 23 |
+
precision: bf16-mixed
|
| 24 |
+
clip_grad_norm: 1.0
|
| 25 |
+
callbacks:
|
| 26 |
+
- target: lightning.pytorch.callbacks.LearningRateMonitor
|
| 27 |
+
params:
|
| 28 |
+
logging_interval: step
|
| 29 |
+
profile: false
|
| 30 |
+
profiling:
|
| 31 |
+
warmup: 40
|
| 32 |
+
active: 1
|
| 33 |
+
filename: profile.json
|
| 34 |
+
cpu: true
|
| 35 |
+
cuda: true
|
| 36 |
+
record_shapes: false
|
| 37 |
+
profile_memory: false
|
| 38 |
+
with_flops: false
|
| 39 |
+
num_nodes: 1
|
| 40 |
+
devices: -1
|
| 41 |
+
auto_requeue: false
|
| 42 |
+
tqdm_refresh_rate: 1
|
| 43 |
+
deepspeed_stage: 0
|
| 44 |
+
p2p_disable: false
|
| 45 |
+
slurm_id: null
|
| 46 |
+
cuda_prefetch: false
|
| 47 |
+
cuda_prefetch_factor: 2
|
| 48 |
+
ddp_kwargs:
|
| 49 |
+
find_unused_parameters: false
|
| 50 |
+
gradient_as_bucket_view: true
|
| 51 |
+
bucket_cap_mb: 100
|
| 52 |
+
broadcast_buffers: true
|
| 53 |
+
user: dyvm6xrauser11
|
| 54 |
+
model:
|
| 55 |
+
target: patch_flow.models.pf_transformer.PatchForcingDiT
|
| 56 |
+
params:
|
| 57 |
+
in_channels: 4
|
| 58 |
+
input_size: 32
|
| 59 |
+
depth: 12
|
| 60 |
+
hidden_size: 768
|
| 61 |
+
patch_size: 2
|
| 62 |
+
num_heads: 12
|
| 63 |
+
num_classes: 1000
|
| 64 |
+
compile: false
|
| 65 |
+
predict_uncertainty: true
|
| 66 |
+
data:
|
| 67 |
+
name: Dummy_256
|
| 68 |
+
num_classes: 1000
|
| 69 |
+
target: patch_flow.dataloader.DataModuleFromConfig
|
| 70 |
+
params:
|
| 71 |
+
batch_size: 2
|
| 72 |
+
num_workers: 0
|
| 73 |
+
train:
|
| 74 |
+
target: patch_flow.dataloader.DummyDataset
|
| 75 |
+
params:
|
| 76 |
+
image:
|
| 77 |
+
- 3
|
| 78 |
+
- 256
|
| 79 |
+
- 256
|
| 80 |
+
label:
|
| 81 |
+
- 1
|
| 82 |
+
validation:
|
| 83 |
+
target: patch_flow.dataloader.DummyDataset
|
| 84 |
+
params:
|
| 85 |
+
image:
|
| 86 |
+
- 3
|
| 87 |
+
- 256
|
| 88 |
+
- 256
|
| 89 |
+
label:
|
| 90 |
+
- 1
|
| 91 |
+
val_batch_size: 32
|
| 92 |
+
autoencoder:
|
| 93 |
+
name: AutoencoderKL
|
| 94 |
+
target: jutils.nn.kl_autoencoder.AutoencoderKL
|
| 95 |
+
params:
|
| 96 |
+
ckpt_path: checkpoints/sd_ae.ckpt
|
| 97 |
+
lr_scheduler:
|
| 98 |
+
name: constant
|
| 99 |
+
target: jutils.nn.lr_schedulers.get_constant_schedule_with_warmup
|
| 100 |
+
params:
|
| 101 |
+
num_warmup_steps: 1000
|
| 102 |
+
trainer:
|
| 103 |
+
target: patch_flow.trainer.LatentPatchForcingTrainer
|
| 104 |
+
params:
|
| 105 |
+
model:
|
| 106 |
+
target: patch_flow.models.pf_transformer.PatchForcingDiT
|
| 107 |
+
params:
|
| 108 |
+
in_channels: 4
|
| 109 |
+
input_size: 32
|
| 110 |
+
depth: 12
|
| 111 |
+
hidden_size: 768
|
| 112 |
+
patch_size: 2
|
| 113 |
+
num_heads: 12
|
| 114 |
+
num_classes: 1000
|
| 115 |
+
compile: false
|
| 116 |
+
predict_uncertainty: true
|
| 117 |
+
first_stage:
|
| 118 |
+
name: AutoencoderKL
|
| 119 |
+
target: jutils.nn.kl_autoencoder.AutoencoderKL
|
| 120 |
+
params:
|
| 121 |
+
ckpt_path: checkpoints/sd_ae.ckpt
|
| 122 |
+
flow:
|
| 123 |
+
target: patch_flow.flow_pf.PatchFlowForcing
|
| 124 |
+
params:
|
| 125 |
+
patch_size: 2
|
| 126 |
+
timestep_sampler:
|
| 127 |
+
target: patch_flow.timestep_schedules.LogitNormalTruncatedGaussian
|
| 128 |
+
params:
|
| 129 |
+
std: 0.6
|
| 130 |
+
loc: 0.7
|
| 131 |
+
scale: 1.0
|
| 132 |
+
lr: 0.0001
|
| 133 |
+
weight_decay: 0.0
|
| 134 |
+
ema_rate: 0.9999
|
| 135 |
+
lr_scheduler_cfg:
|
| 136 |
+
name: constant
|
| 137 |
+
target: jutils.nn.lr_schedulers.get_constant_schedule_with_warmup
|
| 138 |
+
params:
|
| 139 |
+
num_warmup_steps: 1000
|
| 140 |
+
sample_kwargs:
|
| 141 |
+
num_steps: 50
|
| 142 |
+
progress: false
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
# ----------------------------------------
|
| 146 |
+
# Command : python train.py experiment=imnet-pft-b data=dummy256 autoencoder=sd_ae model.params.compile=false train_params.max_steps=1 train_params.limit_val_batches=0 data.params.batch_size=2 data.params.num_workers=0 name=debug/train-official
|
| 147 |
+
# Name : debug/train-official/2026-04-22/T230921
|
| 148 |
+
# Log dir : logs/debug/train-official/2026-04-22/T230921
|
| 149 |
+
# Trainer Module : patch_flow.trainer.LatentPatchForcingTrainer
|
| 150 |
+
# Params : 130,306,580
|
| 151 |
+
# Data : Dummy_256
|
| 152 |
+
# Batchsize : 2
|
| 153 |
+
# Devices : 1
|
| 154 |
+
# Num nodes : 1
|
| 155 |
+
# Gradient accum : 1
|
| 156 |
+
# Global batchsize: 2
|
| 157 |
+
# Val samples : 0
|
| 158 |
+
# LR : 0.00010
|
| 159 |
+
# LR scheduler : constant
|
| 160 |
+
# Resume ckpt : None
|
| 161 |
+
# Load weights : None
|
| 162 |
+
# Profiling : None
|
| 163 |
+
# Precision : bf16-mixed
|
| 164 |
+
# ----------------------------------------
|
patch-forcing/logs/debug/train-official/2026-04-22/T230921/events.out.tfevents.1776870561.hk01dgx015.893414.0
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:34d8ad9baee80b59a43949e8910506bf281afc9f4dd37017cad6083e7aa581a1
|
| 3 |
+
size 4240
|
patch-forcing/logs/debug/train-official/2026-04-22/T231137/config.yaml
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: debug/train-official
|
| 2 |
+
use_wandb: false
|
| 3 |
+
use_wandb_offline: false
|
| 4 |
+
wandb_project: patch-forcing
|
| 5 |
+
tags: []
|
| 6 |
+
load_weights: null
|
| 7 |
+
load_strict: true
|
| 8 |
+
resume_checkpoint: null
|
| 9 |
+
checkpoint_params:
|
| 10 |
+
every_n_train_steps: 10000
|
| 11 |
+
save_top_k: -1
|
| 12 |
+
verbose: true
|
| 13 |
+
save_last: true
|
| 14 |
+
auto_insert_metric_name: false
|
| 15 |
+
train_params:
|
| 16 |
+
max_steps: 1
|
| 17 |
+
max_epochs: -1
|
| 18 |
+
num_sanity_val_steps: 0
|
| 19 |
+
accumulate_grad_batches: 1
|
| 20 |
+
log_every_n_steps: 1
|
| 21 |
+
limit_val_batches: 0
|
| 22 |
+
val_check_interval: 1000
|
| 23 |
+
precision: bf16-mixed
|
| 24 |
+
clip_grad_norm: 1.0
|
| 25 |
+
callbacks:
|
| 26 |
+
- target: lightning.pytorch.callbacks.LearningRateMonitor
|
| 27 |
+
params:
|
| 28 |
+
logging_interval: step
|
| 29 |
+
profile: false
|
| 30 |
+
profiling:
|
| 31 |
+
warmup: 40
|
| 32 |
+
active: 1
|
| 33 |
+
filename: profile.json
|
| 34 |
+
cpu: true
|
| 35 |
+
cuda: true
|
| 36 |
+
record_shapes: false
|
| 37 |
+
profile_memory: false
|
| 38 |
+
with_flops: false
|
| 39 |
+
num_nodes: 1
|
| 40 |
+
devices: -1
|
| 41 |
+
auto_requeue: false
|
| 42 |
+
tqdm_refresh_rate: 1
|
| 43 |
+
deepspeed_stage: 0
|
| 44 |
+
p2p_disable: false
|
| 45 |
+
slurm_id: null
|
| 46 |
+
cuda_prefetch: false
|
| 47 |
+
cuda_prefetch_factor: 2
|
| 48 |
+
ddp_kwargs:
|
| 49 |
+
find_unused_parameters: false
|
| 50 |
+
gradient_as_bucket_view: true
|
| 51 |
+
bucket_cap_mb: 100
|
| 52 |
+
broadcast_buffers: true
|
| 53 |
+
user: dyvm6xrauser11
|
| 54 |
+
model:
|
| 55 |
+
target: patch_flow.models.pf_transformer.PatchForcingDiT
|
| 56 |
+
params:
|
| 57 |
+
in_channels: 4
|
| 58 |
+
input_size: 32
|
| 59 |
+
depth: 12
|
| 60 |
+
hidden_size: 768
|
| 61 |
+
patch_size: 2
|
| 62 |
+
num_heads: 12
|
| 63 |
+
num_classes: 1000
|
| 64 |
+
compile: false
|
| 65 |
+
predict_uncertainty: true
|
| 66 |
+
data:
|
| 67 |
+
name: Dummy_256
|
| 68 |
+
num_classes: 1000
|
| 69 |
+
target: patch_flow.dataloader.DataModuleFromConfig
|
| 70 |
+
params:
|
| 71 |
+
batch_size: 2
|
| 72 |
+
num_workers: 0
|
| 73 |
+
train:
|
| 74 |
+
target: patch_flow.dataloader.DummyDataset
|
| 75 |
+
params:
|
| 76 |
+
image:
|
| 77 |
+
- 3
|
| 78 |
+
- 256
|
| 79 |
+
- 256
|
| 80 |
+
label:
|
| 81 |
+
- 1
|
| 82 |
+
validation:
|
| 83 |
+
target: patch_flow.dataloader.DummyDataset
|
| 84 |
+
params:
|
| 85 |
+
image:
|
| 86 |
+
- 3
|
| 87 |
+
- 256
|
| 88 |
+
- 256
|
| 89 |
+
label:
|
| 90 |
+
- 1
|
| 91 |
+
val_batch_size: 32
|
| 92 |
+
autoencoder:
|
| 93 |
+
name: AutoencoderKL
|
| 94 |
+
target: jutils.nn.kl_autoencoder.AutoencoderKL
|
| 95 |
+
params:
|
| 96 |
+
ckpt_path: checkpoints/sd_ae.ckpt
|
| 97 |
+
lr_scheduler:
|
| 98 |
+
name: constant
|
| 99 |
+
target: jutils.nn.lr_schedulers.get_constant_schedule_with_warmup
|
| 100 |
+
params:
|
| 101 |
+
num_warmup_steps: 1000
|
| 102 |
+
trainer:
|
| 103 |
+
target: patch_flow.trainer.LatentPatchForcingTrainer
|
| 104 |
+
params:
|
| 105 |
+
model:
|
| 106 |
+
target: patch_flow.models.pf_transformer.PatchForcingDiT
|
| 107 |
+
params:
|
| 108 |
+
in_channels: 4
|
| 109 |
+
input_size: 32
|
| 110 |
+
depth: 12
|
| 111 |
+
hidden_size: 768
|
| 112 |
+
patch_size: 2
|
| 113 |
+
num_heads: 12
|
| 114 |
+
num_classes: 1000
|
| 115 |
+
compile: false
|
| 116 |
+
predict_uncertainty: true
|
| 117 |
+
first_stage:
|
| 118 |
+
name: AutoencoderKL
|
| 119 |
+
target: jutils.nn.kl_autoencoder.AutoencoderKL
|
| 120 |
+
params:
|
| 121 |
+
ckpt_path: checkpoints/sd_ae.ckpt
|
| 122 |
+
flow:
|
| 123 |
+
target: patch_flow.flow_pf.PatchFlowForcing
|
| 124 |
+
params:
|
| 125 |
+
patch_size: 2
|
| 126 |
+
timestep_sampler:
|
| 127 |
+
target: patch_flow.timestep_schedules.LogitNormalTruncatedGaussian
|
| 128 |
+
params:
|
| 129 |
+
std: 0.6
|
| 130 |
+
loc: 0.7
|
| 131 |
+
scale: 1.0
|
| 132 |
+
lr: 0.0001
|
| 133 |
+
weight_decay: 0.0
|
| 134 |
+
ema_rate: 0.9999
|
| 135 |
+
lr_scheduler_cfg:
|
| 136 |
+
name: constant
|
| 137 |
+
target: jutils.nn.lr_schedulers.get_constant_schedule_with_warmup
|
| 138 |
+
params:
|
| 139 |
+
num_warmup_steps: 1000
|
| 140 |
+
sample_kwargs:
|
| 141 |
+
num_steps: 50
|
| 142 |
+
progress: false
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
# ----------------------------------------
|
| 146 |
+
# Command : python train.py experiment=imnet-pft-b data=dummy256 autoencoder=sd_ae model.params.compile=false train_params.max_steps=100 train_params.val_check_interval=1000 train_params.limit_val_batches=0 data.params.batch_size=4 data.params.num_workers=0 name=debug/train-official train_params.max_steps=1 train_params.limit_val_batches=0 data.params.batch_size=2
|
| 147 |
+
# Name : debug/train-official/2026-04-22/T231137
|
| 148 |
+
# Log dir : logs/debug/train-official/2026-04-22/T231137
|
| 149 |
+
# Trainer Module : patch_flow.trainer.LatentPatchForcingTrainer
|
| 150 |
+
# Params : 130,306,580
|
| 151 |
+
# Data : Dummy_256
|
| 152 |
+
# Batchsize : 2
|
| 153 |
+
# Devices : 1
|
| 154 |
+
# Num nodes : 1
|
| 155 |
+
# Gradient accum : 1
|
| 156 |
+
# Global batchsize: 2
|
| 157 |
+
# Val samples : 0
|
| 158 |
+
# LR : 0.00010
|
| 159 |
+
# LR scheduler : constant
|
| 160 |
+
# Resume ckpt : None
|
| 161 |
+
# Load weights : None
|
| 162 |
+
# Profiling : None
|
| 163 |
+
# Precision : bf16-mixed
|
| 164 |
+
# ----------------------------------------
|
patch-forcing/logs/debug/train-official/2026-04-22/T231137/events.out.tfevents.1776870697.hk01dgx015.903650.0
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:996fddb9ba0dc6174fc3b71dffaef0a062f657e98f88b4ce39029d827c480d7c
|
| 3 |
+
size 4309
|
patch-forcing/patch_flow/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
| 4 |
+
|
| 5 |
+
from omegaconf import OmegaConf
|
| 6 |
+
OmegaConf.register_new_resolver("mul", lambda a, b: a * b)
|
patch-forcing/patch_flow/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (681 Bytes). View file
|
|
|