Model card and the original license
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176Apache LicenseVersion 2.0, January 2004http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized bythe copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and allother entities that control, are controlled by, or are under commoncontrol with that entity. For the purposes of this definition,"control" means (i) the power, direct or indirect, to cause thedirection or management of such entity, whether by contract orotherwise, or (ii) ownership of fifty percent (50%) or more of theoutstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entityexercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,including but not limited to software source code, documentationsource, and configuration files.
"Object" form shall mean any form resulting from mechanicaltransformation or translation of a Source form, including butnot limited to compiled object code, generated documentation,and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source orObject form, made available under the License, as indicated by acopyright notice that is included in or attached to the work(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Objectform, that is based on (or derived from) the Work and for which theeditorial revisions, annotations, elaborations, or other modificationsrepresent, as a whole, an original work of authorship. For the purposesof this License, Derivative Works shall not include works that remainseparable from, or merely link (or bind by name) to the interfaces of,the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, includingthe original version of the Work and any modifications or additionsto that Work or Derivative Works thereof, that is intentionallysubmitted to Licensor for inclusion in the Work by the copyright owneror by an individual or Legal Entity authorized to submit on behalf ofthe copyright owner. For the purposes of this definition, "submitted"means any form of electronic, verbal, or written communication sentto the Licensor or its representatives, including but not limited tocommunication on electronic mailing lists, source code control systems,and issue tracking systems that are managed by, or on behalf of, theLicensor for the purpose of discussing and improving the Work, butexcluding communication that is conspicuously marked or otherwisedesignated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entityon behalf of whom a Contribution has been received by Licensor andsubsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions ofthis License, each Contributor hereby grants to You a perpetual,worldwide, non-exclusive, no-charge, royalty-free, irrevocablecopyright license to reproduce, prepare Derivative Works of,publicly display, publicly perform, sublicense, and distribute theWork and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions ofthis License, each Contributor hereby grants to You a perpetual,worldwide, non-exclusive, no-charge, royalty-free, irrevocable(except as stated in this section) patent license to make, have made,use, offer to sell, sell, import, and otherwise transfer the Work,where such license applies only to those patent claims licensableby such Contributor that are necessarily infringed by theirContribution(s) alone or by combination of their Contribution(s)with the Work to which such Contribution(s) was submitted. If Youinstitute patent litigation against any entity (including across-claim or counterclaim in a lawsuit) alleging that the Workor a Contribution incorporated within the Work constitutes director contributory patent infringement, then any patent licensesgranted to You under this License for that Work shall terminateas of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of theWork or Derivative Works thereof in any medium, with or withoutmodifications, and in Source or Object form, provided that Youmeet the following conditions:
(a) You must give any other recipients of the Work orDerivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent noticesstating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Worksthat You distribute, all copyright, patent, trademark, andattribution notices from the Source form of the Work,excluding those notices that do not pertain to any part ofthe Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of itsdistribution, then any Derivative Works that You distribute mustinclude a readable copy of the attribution notices containedwithin such NOTICE file, excluding those notices that do notpertain to any part of the Derivative Works, in at least oneof the following places: within a NOTICE text file distributedas part of the Derivative Works; within the Source form ordocumentation, if provided along with the Derivative Works; or,within a display generated by the Derivative Works, if andwherever such third-party notices normally appear. The contentsof the NOTICE file are for informational purposes only anddo not modify the License. You may add Your own attributionnotices within Derivative Works that You distribute, alongsideor as an addendum to the NOTICE text from the Work, providedthat such additional attribution notices cannot be construedas modifying the License.
You may add Your own copyright statement to Your modifications andmay provide additional or different license terms and conditionsfor use, reproduction, or distribution of Your modifications, orfor any such Derivative Works as a whole, provided Your use,reproduction, and distribution of the Work otherwise complies withthe conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,any Contribution intentionally submitted for inclusion in the Workby You to the Licensor shall be under the terms and conditions ofthis License, without any additional terms or conditions.Notwithstanding the above, nothing herein shall supersede or modifythe terms of any separate license agreement you may have executedwith Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the tradenames, trademarks, service marks, or product names of the Licensor,except as required for reasonable and customary use in describing theorigin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law oragreed to in writing, Licensor provides the Work (and eachContributor provides its Contributions) on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied, including, without limitation, any warranties or conditionsof TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR APARTICULAR PURPOSE. You are solely responsible for determining theappropriateness of using or redistributing the Work and assume anyrisks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,whether in tort (including negligence), contract, or otherwise,unless required by applicable law (such as deliberate and grosslynegligent acts) or agreed to in writing, shall any Contributor beliable to You for damages, including any direct, indirect, special,incidental, or consequential damages of any character arising as aresult of this License or out of the use or inability to use theWork (including but not limited to damages for loss of goodwill,work stoppage, computer failure or malfunction, or any and allother commercial damages or losses), even if such Contributorhas been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributingthe Work or Derivative Works thereof, You may choose to offer,and charge a fee for, acceptance of support, warranty, indemnity,or other liability obligations and/or rights consistent with thisLicense. However, in accepting such obligations, You may act onlyon Your own behalf and on Your sole responsibility, not on behalfof any other Contributor, and only if You agree to indemnify,defend, and hold each Contributor harmless for any liabilityincurred by, or claims asserted against, such Contributor by reasonof your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407---base_model: CSWRY/VOSRbase_model_relation: quantizedlicense: apache-2.0pipeline_tag: image-to-imagelibrary_name: onnxtags:- onnx- moonbox- vosr- super-resolution- upscaling- image-to-image- diffusion- one-step---
# VOSR 2.0 ONNX
ONNX builds of [VOSR 2.0](https://github.com/cswry/VOSR), made by Moonbox for on-device use with ONNX Runtime (CUDA, DirectML, CPU).Each precision is a folder with one graph per part of the pipeline; large weights sit next to each graph as ONNXexternal data (`*.onnx.data`), so keep a folder's files together.
## Files
The last column is how far each graph's output is from the original PyTorch model run in fp32 on the same inputs(relative RMS error). fp32 is the yardstick because the original's own bf16 run is not exact either. Image-qualityscores are added as each precision passes the image eval.
| Precision | File | Size | sha256 | Checked against fp32 ||---|---|---|---|---|| int8 | [`int8/image_encoder/model.onnx`](https://huggingface.co/moonbox-dev/VOSR-2.0-ONNX/blob/main/int8/image_encoder/model.onnx) | 0.46 GB | `991f96af4a0d` | 1.8e-03 (fp16 graph) || int8 | [`int8/transformer/model.onnx`](https://huggingface.co/moonbox-dev/VOSR-2.0-ONNX/blob/main/int8/transformer/model.onnx) | 1.41 GB | `e38ab9630515` | 36.7 / 35.1 dB vs fp32 on Set14 / BSD100 (int8 weights) || int8 | [`int8/vae_decoder/model.onnx`](https://huggingface.co/moonbox-dev/VOSR-2.0-ONNX/blob/main/int8/vae_decoder/model.onnx) | 0.05 GB | `3ca755f97a8d` | 2.9e-04 (fp16 graph) || int8 | [`int8/vae_encoder/model.onnx`](https://huggingface.co/moonbox-dev/VOSR-2.0-ONNX/blob/main/int8/vae_encoder/model.onnx) | 0.04 GB | `c3efac4d5f17` | 3.1e-04 (fp16 graph) |
## How to run
VOSR 2.0 is a one-step generative 4x upscaler (CVPR 2026): a 1.4 B diffusion transformer that restores a picture in asingle step, conditioned on the bicubic-upscaled input's Qwen-Image VAE latent and its DINOv2-L features. These foldershold its four graphs for 512 x 512 tiles: `image_encoder` (DINOv2-L, layer 17), `vae_encoder`, `transformer` (theone flow step) and `vae_decoder`. The tiling and VOSR's wavelet colour fix run outside the graphs, as below.
**Run it** (ONNX Runtime; a picture is upscaled 4x with bicubic, cut into 512 px tiles with 64 px overlap,restored tile by tile and blended, then colour-fixed against the bicubic picture):
```pythonimport cv2, numpy as np, onnxruntime as ortfrom PIL import Image
d, prov = "int8", ["CUDAExecutionProvider", "CPUExecutionProvider"]g = {p: ort.InferenceSession(f"{d}/{p}/model.onnx", providers=prov) for p in ("image_encoder", "vae_encoder", "transformer", "vae_decoder")}rng = np.random.default_rng(42)
def tile(x): # x: [1, 3, 512, 512] in -1..1 tok = g["image_encoder"].run(None, {"lq": x})[0] lat = g["vae_encoder"].run(None, {"lq": x})[0] z = g["transformer"].run(None, {"lq_latent": lat, "noise": rng.standard_normal(lat.shape, np.float32), "tokens": tok})[0] return g["vae_decoder"].run(None, {"latent": z})[0][0]
lr = Image.open("photo.png").convert("RGB")up = lr.resize((lr.width * 4, lr.height * 4), Image.BICUBIC)x = np.asarray(up, np.float32).transpose(2, 0, 1) / 127.5 - 1H, W = x.shape[1:]x = np.pad(x, ((0, 0), (0, max(512 - H, 0)), (0, max(512 - W, 0))), mode="reflect")Hp, Wp = x.shape[1:]pos = lambda n: sorted({*range(0, max(n - 512, 0) + 1, 448), max(n - 512, 0)})ramp = np.minimum(np.arange(512) + 1, 64) / 64; w2 = np.outer(np.minimum(ramp, ramp[::-1]), np.minimum(ramp, ramp[::-1]))acc, wsum = np.zeros_like(x), np.zeros((Hp, Wp))for y0 in pos(Hp): for x0 in pos(Wp): acc[:, y0:y0 + 512, x0:x0 + 512] += tile(x[None, :, y0:y0 + 512, x0:x0 + 512].copy()) * w2 wsum[y0:y0 + 512, x0:x0 + 512] += w2sr = ((acc / wsum)[:, :H, :W].transpose(1, 2, 0) + 1) / 2src = np.asarray(up, np.float32) / 255 # wavelet colour fix (VOSR's default)sr = np.clip(cv2.GaussianBlur(src, (0, 0), 5) + sr - cv2.GaussianBlur(sr.astype(np.float32), (0, 0), 5), 0, 1)Image.fromarray((sr * 255).astype(np.uint8)).save("photo_x4.png")```
The original tiles in latent space and blends latents; tiling in pixels as above is simpler, but on pictures largerthan one tile it is not identical to the PyTorch pipeline.
**Precisions.** int8: the transformer's weights int8 per output channel (weight-only), other graphs as in fp16.int4: the transformer's MatMul weights 4-bit (MatMulNBits, block 32) and its other weights int8, other graphs as infp16. No fp16 or bf16 transformer: converting the 5.6 GB fp32 graph needed more memory than our build machine has,and VOSR's code mixes fp32 and fp16 tensors when exported in half precision. The example above uses `int8`.
**Benchmark.** Set14 and BSD100 at 4x (bicubic-downscaled inputs), the pipeline above on an RTX 3080 Laptop GPU withONNX Runtime 1.30: each precision's PSNR against the fp32 pipeline's output (same noise), and PSNR / SSIM (Y channel,4 px border cropped) against the ground truth. VOSR is a generative model trained for real-world degradations: itadds plausible detail, which PSNR penalizes, so compare precisions with each other rather than with PSNR-orientedupscalers.
| Pipeline | Size | vs fp32 PSNR (Set14 / BSD100) | PSNR-Y / SSIM-Y Set14 | PSNR-Y / SSIM-Y BSD100 | Time / picture | Peak VRAM ||---|---|---|---|---|---|---|| fp32 (reference, not published) | 6.68 GB | - | 25.82 / 0.698 | 24.96 / 0.655 | 0.61 s | 10.5 GB || int8 | 1.96 GB | 36.7 / 35.1 dB | 25.82 / 0.698 | 24.95 / 0.655 | 0.52 s | 5.5 GB || int4 | 1.46 GB | 30.6 / 30.1 dB | 25.57 / 0.690 | 24.79 / 0.646 | 0.54 s | 4.5 GB |
## How these were made
From [VOSR 2.0](https://github.com/cswry/VOSR) at revision `516f292b99`: each part exported with `torch.onnx`, then converted or quantizedwith ONNX Runtime's tools (fp16 / bf16 casts, int8 and int4 weight quantization). Every graph was checked againstthe original before upload; the `sha256` column above is what the files must hash to.
## License
Apache-2.0. These files are a derivative of the original model and carry its license: it is copied in thisrepository, and it governs your use of these files. The original model card follows unchanged.
---
# Original model card
<div align="center">
<p align="center"> <img src="https://raw.githubusercontent.com/cswry/VOSR/516f292b99cf23c76fdc33351e86dc4f97711fe8/assets/logo.png" alt="VOSR logo" width="72%"></p>
# VOSR: A Vision-Only Generative Model for Image Super-Resolution
<p align="center"><i>A framework for native generative image restoration.</i></p>
#### 🚩 Accepted by CVPR 2026
[](https://arxiv.org/pdf/2604.03225)[](https://modelscope.cn/models/LULALULALU/VOSR_CKPT)[](https://huggingface.co/CSWRY/VOSR)[](https://modelscope.cn/datasets/LULALULALU/ScreenSR)[](https://huggingface.co/datasets/CSWRY/ScreenSR)
[Rongyuan Wu](https://scholar.google.com/citations?user=A-U8zE8AAAAJ&hl=zh-CN)<sup>1,2,*</sup> |[Lingchen Sun](https://scholar.google.com/citations?user=ZCDjTn8AAAAJ&hl=zh-CN)<sup>1,2,*</sup> |[Zhengqiang Zhang](https://scholar.google.com/citations?user=UX26wSMAAAAJ&hl=en)<sup>1,2</sup> |[Xiangtao Kong](https://scholar.google.com/citations?user=lueNzSgAAAAJ&hl=zh-CN)<sup>1,2</sup> <br>[Jixin Zhao](https://scholar.google.com/citations?user=0Z89rfUAAAAJ)<sup>1,2</sup> |[Shihao Wang](https://scholar.google.com/citations?user=7TWugs4AAAAJ&hl=zh-CN)<sup>1</sup> |[Lei Zhang](https://www4.comp.polyu.edu.hk/~cslzhang/)<sup>1,2,†</sup>
<sup>1</sup> The Hong Kong Polytechnic University <sup>2</sup> OPPO Research Institute
<sup>*</sup> Equal contribution. <sup>†</sup> Corresponding author.
</div>
<!-- Optional teaser image --><!--  -->
<p align="center"> <img src="https://raw.githubusercontent.com/cswry/VOSR/516f292b99cf23c76fdc33351e86dc4f97711fe8/assets/overview.jpg" alt="VOSR overview" width="100%"></p><p align="center"><em>Overview of the VOSR framework, including the overall pipeline and our condition / guidance design.</em></p>
## 📌 Quick Links
- [📰 News](#news)- [🧰 Preparation](#preparation)- [🏋️ Training](#training)- [🔍 Inference](#inference)- [📮 Contact](#contact)- [📚 Citation](#citation)
<a id="news"></a>## 📰 News
- 2026.08.22 **VOSR 2.0** released: a one-step 1.4B DiT, vision-only model with improved fine-structure restoration. See [visual comparison](https://cswry.github.io/vosr2/). Thanks to [ylchen333](https://github.com/ylchen333) for bringing VOSR to ComfyUI with [ComfyUI-VOSR2](https://github.com/ylchen333/ComfyUI-VOSR2).
- 2026.04.10 Public release: training and inference code, [pretrained checkpoints](https://modelscope.cn/models/LULALULALU/VOSR_CKPT), bundled VAE / decoder assets, and the [ScreenSR](https://modelscope.cn/datasets/LULALULALU/ScreenSR) benchmark. Setup and file layout: [Preparation](#preparation); commands: [Training](#training) and [Inference](#inference).
---
<p align="center"> <img src="https://raw.githubusercontent.com/cswry/VOSR/516f292b99cf23c76fdc33351e86dc4f97711fe8/assets/vosr_comparison_figure.png" alt="VOSR performance, efficiency, and training cost comparison" width="100%"></p><p align="center"><em>Comparison with prior methods in performance, inference efficiency, and training cost.</em></p>
<p align="center"> <img src="https://raw.githubusercontent.com/cswry/VOSR/516f292b99cf23c76fdc33351e86dc4f97711fe8/assets/vis_comp.jpg" alt="Qualitative comparison on natural and text-rich images" width="100%"></p><p align="center"><em>VOSR better preserves fine structures and text readability.</em></p>
<a id="preparation"></a>## 🧰 Preparation
### Dependencies and Installation
```bash## clone this repositorygit clone https://github.com/cswry/VOSR.gitcd VOSR
# create an environment with python >= 3.8conda create -n vosr python=3.8conda activate vosrpip install -r requirements.txt```
### 📦 Model Weights
Download all pretrained weights from [ModelScope](https://modelscope.cn/models/LULALULALU/VOSR_CKPT) or [Hugging Face](https://huggingface.co/CSWRY/VOSR), and place them under `preset/ckpts/`. The expected structure:
```textpreset/ckpts/|-- Qwen-Image-vae-2d/ # Qwen-Image VAE (2D, for 1.4B models)|-- stable-diffusion-2-1-base/ # SD2.1 VAE (for 0.5B models)|-- sd21_lwdecoder.pth # Lightweight decoder for SD2.1 VAE|-- torch_cache/ # DINOv2 pretrained weights|-- VOSR2/ # VOSR 2.0 one-step (1.4B) model|-- VOSR_0.5B_ms/ # 0.5B multi-step model|-- VOSR_0.5B_os/ # 0.5B one-step (distilled) model|-- VOSR_1.4B_ms/ # 1.4B multi-step model`-- VOSR_1.4B_os/ # 1.4B one-step (distilled) model```
#### VAE and decoder
For `VOSR-0.5B`, we provide `sd21_lwdecoder.pth`, a lightweight replacement for the original SD2.1 VAE decoder. It achieves comparable overall visual quality in our evaluation, while performing slightly better on text-rich and document-like images.
When scaling to `VOSR-1.4B`, we adopt the 16-channel Qwen-Image VAE to better preserve input fidelity. Although Qwen-Image is designed for T2I generation, it is released in a video-VAE form, which is unnecessarily slow for image SR inference. We therefore provide `Qwen-Image-vae-2d`, an image-only 2D variant extracted from the original model to remove the overhead of the full 3D design.
### 🗂️ Training Data
We support two data loading modes, configured via `dataset_type` in the YAML config:
- `txt` - Each folder contains individual image files. A txt config lists folders with sampling weights.- `webdataset` - Each folder contains `.tar` shards. Same txt config format, loaded via WebDataset.
Create a dataset config file (e.g., `configs/train_txt/train_dataset_txt.txt`):
```text/path/to/dataset_A, 2/path/to/dataset_B, 1/path/to/dataset_C, 1```
Each line: `<folder_path>, <sampling_weight>`. Higher weight = more frequent sampling.
For `txt` mode, each folder should contain HQ images (`.png` / `.jpg`). For `webdataset` mode, each folder should contain `.tar` shards with images inside.
### 🧪 New Real-World Paired Benchmark
Download the [ScreenSR benchmark from ModelScope](https://modelscope.cn/datasets/LULALULALU/ScreenSR) or [Hugging Face](https://huggingface.co/datasets/CSWRY/ScreenSR), place it wherever you like, and then point `-i` to that folder when running inference.
[ScreenSR](https://modelscope.cn/datasets/LULALULALU/ScreenSR) is a real-world paired benchmark for generative SR, built with a screen re-photography pipeline. It provides cleaner references, more diverse content, and broader variation in scenes and scales than existing real-world paired SR benchmarks.
<p align="center"> <img src="https://raw.githubusercontent.com/cswry/VOSR/516f292b99cf23c76fdc33351e86dc4f97711fe8/assets/montage_13x10_256px.jpg" alt="ScreenSR benchmark montage" width="100%"></p><p align="center"><em>Thumbnail montage of the ScreenSR benchmark, covering diverse scenes, subjects, and multilingual text.</em></p>
---
<a id="training"></a>## 🏋️ Training
The provided training configs disable experiment tracking by default(`report_to: none`). To enable Weights & Biases logging, run `wandb login`with your own account and set `report_to: wandb` in the YAML config.
### Multi-step Training
```bash# VOSR-0.5Btorchrun --nproc_per_node=8 train_vosr.py --config configs/train_yml/multi_step/VOSR_0.5B.yml
# VOSR-1.4Btorchrun --nproc_per_node=8 train_vosr.py --config configs/train_yml/multi_step/VOSR_1.4B.yml```
### One-step Distillation
Requires a trained multi-step teacher checkpoint. Set `teacher_ckpt` and `pretrained_ckpt` in the YAML config.
```bash# VOSR-0.5B one-steptorchrun --nproc_per_node=8 train_vosr_distill.py --config configs/train_yml/one_step/VOSR_0.5B.yml
# VOSR-1.4B one-steptorchrun --nproc_per_node=8 train_vosr_distill.py --config configs/train_yml/one_step/VOSR_1.4B.yml```
---
<a id="inference"></a>## 🔍 Inference
Single-GPU inference.
### VOSR 2.0 one-step (default)
VOSR 2.0 is the default one-step model (1.4B DiT, vision-only, with improved fine-structure restoration).
```bash# VOSR2-1.4B one-steppython inference_vosr_onestep.py \ -c preset/ckpts/VOSR2 \ -i preset/datasets/inp_data \ -o preset/results \ -u 4```
### Multi-step models
Multi-step sampling defaults to **25 steps** (`--infer_steps`, default 25). Override if you need fewer or more function evaluations.
Two knobs mainly affect the trade-off between faithfulness to the LR input and generative detail (both can be set via CLI to override `args.json`):
- `--cfg_scale` - Higher values tend to emphasize fidelity to the condition; lower values give more generative freedom. The sweet spot depends on input degradation strength. In our experiments, roughly `-0.5` to `2` is a usable range; `0.5` is a practical default.- `--weak_cond_strength_aelq` - During training this is sampled uniformly in `[0.05, 0.25]` so the checkpoint supports a wide range at inference via the same flag (smaller -> more generative, larger -> more faithful). Default `0.1`.
Benchmark presets (multi-step): for apples-to-apples evaluation we use `--cfg_scale -0.5` on RealSR and `--cfg_scale 0.5` on [ScreenSR](https://modelscope.cn/datasets/LULALULALU/ScreenSR).
```bash# Inputs under preset/datasets/inp_data follow RealSR-style evaluation; use --cfg_scale -0.5 (see benchmark presets above).
# VOSR-0.5B multi-step (25 steps)python inference_vosr.py \ -c preset/ckpts/VOSR_0.5B_ms \ -i preset/datasets/inp_data \ -o preset/results \ -u 4
# VOSR-1.4B multi-step (25 steps)python inference_vosr.py \ -c preset/ckpts/VOSR_1.4B_ms \ -i preset/datasets/inp_data \ -o preset/results \ -u 4```
### One-step models
One-step models use `--infer_steps` with default `1` (typical for distilled checkpoints).
```bash# VOSR-0.5B one-steppython inference_vosr_onestep.py \ -c preset/ckpts/VOSR_0.5B_os \ -i preset/datasets/inp_data \ -o preset/results \ -u 4
# VOSR-1.4B one-steppython inference_vosr_onestep.py \ -c preset/ckpts/VOSR_1.4B_os \ -i preset/datasets/inp_data \ -o preset/results \ -u 4```
### Common arguments
`-c` checkpoint path, `-i` input image or folder, `-o` output directory, `-u` upscale factor. Outputs are saved as **PNG directly into the `-o` folder**; color alignment defaults to `wavelet` (`--align_method wavelet|adain|nofix`).
- Multi-step (`inference_vosr.py`): `--infer_steps` (default `25`), `--cfg_scale`, `--weak_cond_strength_aelq` (see above).- One-step (`inference_vosr_onestep.py`): `--infer_steps` (default `1`).- Both: `--posterior_mode` / `--no-posterior_mode` — deterministic VAE latent (`latent_dist.mode()`) is the default, for reproducible results and seam-free tiled inference.
### Tiled inference for large images
Large images are tiled in latent space to bound GPU memory:
- `--tile_size 512` — DiT tile size in pixels (default `0` = disabled). Use for large images; overlapping tiles are Gaussian-blended.- `--vae_tile_size 1024` — VAE encoder/decoder tile size in pixels (default `0` = full-image VAE). The Qwen VAE attention is O(N)-memory, so full-image encode/decode already fits up to ~8K inputs; VAE tiling is only needed for extreme sizes.- `--vae_tile_overlap` — VAE tile overlap (default: follows `--tile_overlap`).
```bash# VOSR-1.4B one-step on a large image with DiT + VAE tilingpython inference_vosr_onestep.py \ -c preset/ckpts/VOSR_1.4B_os \ -i large_input.png \ -o preset/results \ -u 4 --tile_size 512 --vae_tile_size 1024```
---
<a id="contact"></a>## 📮 Contact
If you have any questions, please feel free to contact: `rong-yuan.wu@connect.polyu.hk`
<a id="citation"></a>## 📚 Citation
If VOSR is useful for your research, please consider citing:
```bibtex@inproceedings{wu2026vosr, title = {VOSR: A Vision-Only Generative Model for Image Super-Resolution}, author = {Wu, Rongyuan and Sun, Lingchen and Zhang, Zhengqiang and Kong, Xiangtao and Zhao, Jixin and Wang, Shihao and Zhang, Lei}, booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition}, year = {2026}}```
## Acknowledgements
This project benefits from [stable-diffusion-2-1-base](https://huggingface.co/Manojb/stable-diffusion-2-1-base), [LightningDiT](https://github.com/hustvl/LightningDiT), [Qwen-Image](https://huggingface.co/Qwen/Qwen-Image), [DINOv2](https://github.com/facebookresearch/dinov2), [BasicSR](https://github.com/XPixelGroup/BasicSR), [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN), [RCGM](https://github.com/LINs-lab/RCGM), and [Shortcut-models](https://github.com/kvfrans/shortcut-models). We thank the authors for their open-source contributions.
## ⚖️ License
This project is released under the Apache License 2.0 unless otherwise noted. See [LICENSE](https://raw.githubusercontent.com/cswry/VOSR/516f292b99cf23c76fdc33351e86dc4f97711fe8/LICENSE) for details. Downloadable model weights, benchmark data, and external assets may have separate terms on their hosting pages.LICENSEAdded+176
README.mdAdded+407