dipta007 commited on
Commit
cdcb732
·
verified ·
1 Parent(s): 672e126

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +115 -0
  2. adapter_config.json +41 -0
  3. adapter_model.safetensors +3 -0
  4. train_meta.json +1 -0
README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ base_model: stabilityai/stable-diffusion-3-medium-diffusers
4
+ library_name: peft
5
+ pipeline_tag: image-to-image
6
+ language: en
7
+ tags:
8
+ - super-resolution
9
+ - image-super-resolution
10
+ - extreme-zoom
11
+ - chain-of-zoom
12
+ - diffusion
13
+ - lora
14
+ - peft
15
+ - privileged-distillation
16
+ - faithfulness
17
+ ---
18
+
19
+ # OracleZoom
20
+
21
+ **Privileged-Latent Distillation for faithful extreme super-resolution.**
22
+ A tiny (7.1M-parameter) LoRA adapter that makes Chain-of-Zoom's recursive super-resolution add *faithful* detail instead of hallucinating, all the way to 256x.
23
+
24
+ [![GitHub](https://img.shields.io/badge/Code-OPD--Zoom-black?logo=github)](https://github.com/dipta007/OPD-Zoom)
25
+ [![Base](https://img.shields.io/badge/Backbone-OSEDiff%20/%20SD3-blue)](https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers)
26
+ [![Method](https://img.shields.io/badge/Method-Chain--of--Zoom-orange)](https://github.com/dipta007/OPD-Zoom)
27
+ [![Paper](https://img.shields.io/badge/Paper-WACV%202027%20(in%20submission)-red)](https://github.com/dipta007/OPD-Zoom)
28
+ [![License](https://img.shields.io/badge/License-CC--BY--NC--4.0-lightgrey)](https://creativecommons.org/licenses/by-nc/4.0/)
29
+
30
+ ## Highlights
31
+ - **Faithful, not just sharp.** At extreme zoom the backbone must *invent* detail; the question is whether it is faithful or hallucinated. This adapter teaches faithfulness.
32
+ - **Holds where baselines collapse.** CLIPIQA **0.71 at 256x** while Chain-of-Zoom (CoZ) and five SOTA SR backbones fall to <=0.58; most faithful of all methods at 4x (LPIPS **0.20** vs CoZ 0.22).
33
+ - **Judged more faithful.** Two cross-family vision-language judges (InternVL + Gemini) prefer this zoom **68-78%** of the time at 64-256x and flag the strongest baseline hallucinating **2-5x more**.
34
+ - **Tiny and drop-in.** A rank-16 LoRA (**7.1M** trainable params) trained on only **1,000** curated 4K images; it drops into CoZ's recursion with no other changes.
35
+
36
+ ## Model Overview
37
+ | Property | Value |
38
+ |---|---|
39
+ | Model type | LoRA adapter (PEFT) for a one-step SR backbone |
40
+ | Backbone (frozen) | OSEDiff on Stable Diffusion 3-medium |
41
+ | Prompt extractor (frozen) | Qwen2.5-VL-3B-Instruct |
42
+ | Trainable params | 7.1M |
43
+ | LoRA | r = 16, alpha = 32, dropout = 0.0 |
44
+ | LoRA targets | `to_q, to_k, to_v, add_q_proj, add_k_proj, add_v_proj` (SD3 transformer) |
45
+ | Training data | 1,000 curated 4K photographs (supervised at 4x only) |
46
+ | Objective | decode-space LPIPS + anchored cycle-consistency - beta_reward * TOPIQ-NR + beta_kl * KL-to-base + EMA |
47
+ | Key weights | beta_reward 0.4, beta_kl 8.0, w_cyc 1.0, lambda_ema 0.1 (EMA decay 0.95) |
48
+ | Recursion at test | 4 steps (4x / 16x / 64x / 256x), 512x512 center crop |
49
+
50
+ ## Method
51
+ Recursive SR (Chain-of-Zoom) reuses a 4x backbone step after step to reach 16x-256x. Each step is **blind**: it sees only a blurred crop of its own previous output and must invent the missing detail, so errors compound and the invention may be hallucinated.
52
+
53
+ **Privileged-latent distillation (the idea).** A *privileged teacher* is shown the ground-truth high-resolution patch **at training time only** and distills its real detail into the blind student, in **decode space** (a perceptual loss between the student's decoded image and the real patch). Only a small LoRA adapter is trained; the backbone, VAE, and prompter stay frozen.
54
+
55
+ **A KL leash keeps the deep reward faithful (the safeguard).** Ground truth exists only at 4x. To carry the distilled prior into the deeper recursion, the student chases a differentiable detail reward (TOPIQ-NR) through the real zoom. Left free, such a reward games the metric with a repetitive crosshatch; **leashed** to the deployed backbone by a KL trust region (a latent distance for a one-step map), it sharpens detail without drifting into hallucination.
56
+
57
+ Full derivation and ablations are in the [OPD-Zoom repo](https://github.com/dipta007/OPD-Zoom).
58
+
59
+ ## Quickstart
60
+ This is the trained artifact of OracleZoom: a PEFT LoRA on the SD3 transformer that OSEDiff uses as the SR backbone inside Chain-of-Zoom. It plugs into the OPD-Zoom pipeline.
61
+
62
+ ```bash
63
+ # 1) get the pipeline
64
+ git clone https://github.com/dipta007/OPD-Zoom && cd OPD-Zoom
65
+
66
+ # 2) get this adapter
67
+ huggingface-cli download dipta007/OracleZoom --local-dir ckpt/OracleZoom
68
+
69
+ # 3) run the 4-recursion zoom with the adapter as the student SR LoRA
70
+ python -m opd_zoom.teacher.oracle_infer \
71
+ --mode student --pld_lora ckpt/OracleZoom \
72
+ --gt_dir <your_images> --out <out_dir> --rec_num 4
73
+ ```
74
+
75
+ Loading just the adapter with PEFT:
76
+ ```python
77
+ from peft import PeftModel
78
+ # `sd3_transformer` is the SD3Transformer2DModel used by the OSEDiff backbone
79
+ model = PeftModel.from_pretrained(sd3_transformer, "dipta007/OracleZoom")
80
+ ```
81
+ The adapter is `inference_mode` and merges into the backbone at no added latency; the VLM prompter is unchanged, so per-image inference cost equals Chain-of-Zoom's.
82
+
83
+ ## Results
84
+ Under Chain-of-Zoom's exact protocol on a curated 4K benchmark and six test sets (in-domain 4K, DIV8K, DRealSR, RealSR, FFHQ, Flickr2K):
85
+
86
+ | Axis | Metric | Ours | CoZ / best baseline |
87
+ |---|---|---|---|
88
+ | Sharpness (no-reference) | CLIPIQA @256x | **0.71** | <= 0.58 |
89
+ | Fidelity @4x (ground truth exists) | LPIPS | **0.20** | 0.22 (CoZ) |
90
+ | Deep faithfulness (MLLM judge, 64-256x) | preferred vs CoZ | **68-78%** | - |
91
+ | Deep faithfulness | hallucination rate vs CoZ | **2-5x lower** | - |
92
+
93
+ Sharpness is the axis prior methods are built for; the decisive gap is **faithfulness**, verified by full-reference metrics at 4x and by two cross-family MLLM judges plus a blinded human study past 4x.
94
+
95
+ ## Intended Use
96
+ - **In-scope:** research on faithful extreme (recursive) super-resolution; as the SR-backbone adapter inside the Chain-of-Zoom recursion on natural photographs.
97
+ - **Out-of-scope:** a standalone single-shot SR model (it is a drop-in LoRA for the CoZ loop, not a full model); forensic or evidentiary use (detail past 4x is generated, not recovered); real-camera-zoom claims (the benchmark uses synthetic center-crop zoom).
98
+
99
+ ## Training
100
+ Early-stopped on held-out validation at ~epoch 37 (step 9300); best val 0.216. Trained on one 8xH200 node (single GPU trains the adapter). Full config in `train_meta.json` and the [repo](https://github.com/dipta007/OPD-Zoom).
101
+
102
+ ## Citation
103
+ ```bibtex
104
+ @inproceedings{dipta2027oraclezoom,
105
+ title={OracleZoom: Privileged-Latent Distillation for Faithful Extreme Super-Resolution},
106
+ author={Shubhashis Roy Dipta},
107
+ year={2027},
108
+ note={In submission, WACV 2027},
109
+ url={https://github.com/dipta007/OPD-Zoom}
110
+ }
111
+ ```
112
+ Please also cite Chain-of-Zoom and OSEDiff, whose components this builds on.
113
+
114
+ ## License
115
+ Released for **research, non-commercial** use (CC-BY-NC-4.0). This adapter is trained on top of OSEDiff / Stable Diffusion 3 and used with a Qwen2.5-VL prompter inside Chain-of-Zoom; the respective upstream licenses apply to those components.
adapter_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": {
4
+ "base_model_class": "SD3Transformer2DModel",
5
+ "parent_library": "diffusers.models.transformers.transformer_sd3"
6
+ },
7
+ "base_model_name_or_path": null,
8
+ "bias": "none",
9
+ "corda_config": null,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 32,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.0,
22
+ "megatron_config": null,
23
+ "megatron_core": "megatron.core",
24
+ "modules_to_save": null,
25
+ "peft_type": "LORA",
26
+ "r": 16,
27
+ "rank_pattern": {},
28
+ "revision": null,
29
+ "target_modules": [
30
+ "add_q_proj",
31
+ "to_v",
32
+ "add_k_proj",
33
+ "to_q",
34
+ "to_k",
35
+ "add_v_proj"
36
+ ],
37
+ "task_type": null,
38
+ "trainable_token_indices": null,
39
+ "use_dora": false,
40
+ "use_rslora": false
41
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:612b3ac0c2ec152bf674ccacf05e9d0a964cba9cc7f77d87bd19c55a6876bc86
3
+ size 28350704
train_meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"best_val": 0.21588097116095012, "best_step": 9300, "best_epoch": 37, "stopped_early": true, "w_deep": 1.0, "deep_factor": 4, "lambda_ema": 0.1, "ema_decay": 0.95, "no_ema": false, "full_grad": true, "beta_reward": 0.4, "reward_metric": "topiq_nr", "beta_kl": 8.0, "lora_on": "transformer", "full_param": false, "lora_rank": 16, "n_train": 1000, "n_val": 2000}