Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: openrail++
|
| 3 |
+
library_name: coreai
|
| 4 |
+
pipeline_tag: image-to-image
|
| 5 |
+
tags:
|
| 6 |
+
- super-resolution
|
| 7 |
+
- diffusion
|
| 8 |
+
- core-ai
|
| 9 |
+
- apple
|
| 10 |
+
- on-device
|
| 11 |
+
- adcsr
|
| 12 |
+
- stable-diffusion
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# AdcSR ×4 Super-Resolution — Core AI
|
| 16 |
+
|
| 17 |
+
On-device **×4 super-resolution** with **AdcSR** ([Adversarial Diffusion Compression](https://github.com/Guaishou74851/AdcSR),
|
| 18 |
+
CVPR 2025) converted for Apple's **Core AI** stack. AdcSR compresses the one-step diffusion model
|
| 19 |
+
[OSEDiff](https://github.com/cswry/OSEDiff) into a small **diffusion-GAN**: a pruned Stable
|
| 20 |
+
Diffusion 2.1 UNet + a half-size VAE decoder, run in **one forward pass** — no iterative denoising,
|
| 21 |
+
no prompt, no noise — so it is fast and small enough to run fully on-device, including iPhone.
|
| 22 |
+
|
| 23 |
+
## What it is
|
| 24 |
+
|
| 25 |
+
- **fp16, ~870 MB.** On the GPU the Core AI output matches the fp32 reference (cosine 1.000008).
|
| 26 |
+
- **Image → image, one step.** Input a low-resolution tile, get a 4× tile back. No text, no noise.
|
| 27 |
+
- **456 M parameters** (pruned SD-2.1 UNet + half VAE decoder).
|
| 28 |
+
|
| 29 |
+
## I/O contract (per tile)
|
| 30 |
+
|
| 31 |
+
- **input:** `lr` `[1,3,128,128]` in `[-1,1]` (a low-resolution tile).
|
| 32 |
+
- **output:** `sr` `[1,3,512,512]` in `[-1,1]` (×4), with the reference's per-image color-match baked in.
|
| 33 |
+
|
| 34 |
+
## Usage (CoreAIKit)
|
| 35 |
+
|
| 36 |
+
```swift
|
| 37 |
+
import CoreAIKitVision
|
| 38 |
+
|
| 39 |
+
let sr = try await SuperResolver(model: .adcsrX4) // downloads this repo on first use
|
| 40 |
+
let big = try await sr.upscale(cgImage) // ×4; tiles any-size input + feather-blends
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
`SuperResolver` splits any-size input into overlapping 128-px LR windows, runs each, and blends.
|
| 44 |
+
Load uses explicit GPU specialization options (GraphModel does this) — the runtime's *default*-
|
| 45 |
+
options load path has a GPU-delegate JIT bug, but an explicit `.gpu` load is clean.
|
| 46 |
+
|
| 47 |
+
## License & attribution
|
| 48 |
+
|
| 49 |
+
- **AdcSR** (method + the pruning/training code): Apache-2.0 — Bingchen Li et al., *Adversarial
|
| 50 |
+
Diffusion Compression for Real-World Image Super-Resolution*, CVPR 2025.
|
| 51 |
+
- **Weights** are derived from **Stable Diffusion 2.1** (via OSEDiff) and therefore carry the
|
| 52 |
+
**CreativeML Open RAIL++-M** license — commercial use is permitted under its use-based
|
| 53 |
+
restrictions, the same license under which Apple distributes Stable Diffusion for Core ML.
|
| 54 |
+
|
| 55 |
+
This Core AI conversion inherits both. See `LICENSE` (Apache-2.0, AdcSR) and the SD-2.1 OpenRAIL++-M
|
| 56 |
+
terms.
|