dipta007 commited on
Commit
59d9b25
·
verified ·
1 Parent(s): 0772376

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +32 -22
README.md CHANGED
@@ -19,7 +19,7 @@ tags:
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)
@@ -28,16 +28,23 @@ A tiny (7.1M-parameter) LoRA adapter that makes Chain-of-Zoom's recursive super-
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 |
@@ -54,31 +61,34 @@ Recursive SR (Chain-of-Zoom) reuses a 4x backbone step after step to reach 16x-2
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):
@@ -93,8 +103,8 @@ Under Chain-of-Zoom's exact protocol on a curated 4K benchmark and six test sets
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).
@@ -112,4 +122,4 @@ Early-stopped on held-out validation at ~epoch 37 (step 9300); best val 0.216. T
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.
 
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. Shipped both as the LoRA adapter and as a **fully-merged transformer you can download and use directly**.
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)
 
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 model 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 to train, easy to use.** A rank-16 LoRA (**7.1M** trainable params) trained on only **1,000** curated 4K images; shipped as both the adapter and a merged, drop-in transformer.
35
+
36
+ ## Files in this repo
37
+ | File | What it is |
38
+ |---|---|
39
+ | `merged_transformer.safetensors` | **The complete OracleZoom SR transformer** (SD3 + OSEDiff's SR-LoRA + our PLD adapter, all baked in), fp32, ~8.35 GB. Download-and-use: drop it in as the transformer, no LoRA step. |
40
+ | `adapter_model.safetensors` + `adapter_config.json` | The rank-16 PLD LoRA **alone** (~28 MB), if you prefer to apply it onto your own OSEDiff transformer. |
41
+ | `train_meta.json` | Training recipe / provenance. |
42
 
43
  ## Model Overview
44
  | Property | Value |
45
  |---|---|
46
+ | Model type | LoRA adapter (PEFT) for a one-step SR backbone, + merged transformer |
47
+ | Backbone | OSEDiff on Stable Diffusion 3-medium |
48
  | Prompt extractor (frozen) | Qwen2.5-VL-3B-Instruct |
49
  | Trainable params | 7.1M |
50
  | LoRA | r = 16, alpha = 32, dropout = 0.0 |
 
61
 
62
  **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.
63
 
 
 
64
  ## Quickstart
65
+ Both paths run inside the [OPD-Zoom](https://github.com/dipta007/OPD-Zoom) / Chain-of-Zoom pipeline.
66
 
67
  ```bash
 
68
  git clone https://github.com/dipta007/OPD-Zoom && cd OPD-Zoom
 
 
69
  huggingface-cli download dipta007/OracleZoom --local-dir ckpt/OracleZoom
70
+ ```
71
 
72
+ **Option A - merged transformer (recommended, no LoRA step).** `merged_transformer.safetensors` already contains SD3 + OSEDiff's SR-LoRA + our PLD adapter, so you just load it as the SR transformer's weights:
73
+ ```python
74
+ from safetensors.torch import load_file
75
+ sd = load_file("ckpt/OracleZoom/merged_transformer.safetensors")
76
+ # `transformer` = the OSEDiff SD3Transformer2DModel built by the pipeline (build_sr)
77
+ transformer.load_state_dict(sd, strict=False)
78
  ```
79
 
80
+ **Option B - LoRA adapter.** Apply the rank-16 adapter onto the OSEDiff transformer with PEFT:
81
  ```python
82
  from peft import PeftModel
83
+ transformer = PeftModel.from_pretrained(transformer, "dipta007/OracleZoom")
84
+ ```
85
+ Or point the repo's inference at the adapter directly:
86
+ ```bash
87
+ python -m opd_zoom.teacher.oracle_infer \
88
+ --mode student --pld_lora ckpt/OracleZoom \
89
+ --gt_dir <your_images> --out <out_dir> --rec_num 4
90
  ```
91
+ Either way the VLM prompter is unchanged, so per-image inference cost equals Chain-of-Zoom's.
92
 
93
  ## Results
94
  Under Chain-of-Zoom's exact protocol on a curated 4K benchmark and six test sets (in-domain 4K, DIV8K, DRealSR, RealSR, FFHQ, Flickr2K):
 
103
  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.
104
 
105
  ## Intended Use
106
+ - **In-scope:** research on faithful extreme (recursive) super-resolution; as the SR-backbone inside the Chain-of-Zoom recursion on natural photographs.
107
+ - **Out-of-scope:** a standalone single-shot SR model (it is the SR backbone for the CoZ loop); forensic/evidentiary use (detail past 4x is generated, not recovered); real-camera-zoom claims (the benchmark uses synthetic center-crop zoom).
108
 
109
  ## Training
110
  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).
 
122
  Please also cite Chain-of-Zoom and OSEDiff, whose components this builds on.
123
 
124
  ## License
125
+ Released for **research, non-commercial** use (CC-BY-NC-4.0). This model is built 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.