Instructions to use moonbox-dev/VOSR-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use moonbox-dev/VOSR-MLX with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download moonbox-dev/VOSR-MLX --local-dir VOSR-MLX
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Model card and the original license
Browse files
LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
README.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: CSWRY/VOSR
|
| 3 |
+
base_model_relation: quantized
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
pipeline_tag: image-to-image
|
| 6 |
+
library_name: mlx
|
| 7 |
+
tags:
|
| 8 |
+
- mlx
|
| 9 |
+
- moonbox
|
| 10 |
+
- vosr
|
| 11 |
+
- super-resolution
|
| 12 |
+
- image-upscaling
|
| 13 |
+
- image-restoration
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# VOSR 2.0 MLX
|
| 17 |
+
|
| 18 |
+
MLX builds of [VOSR 2.0](https://github.com/cswry/VOSR), made by Moonbox for Apple Silicon Macs. Each precision is a folder; keep a folder's
|
| 19 |
+
files together. Only the parts listed below are converted: the rest of the pipeline comes from the original
|
| 20 |
+
repository unless the section below says otherwise.
|
| 21 |
+
|
| 22 |
+
## Files
|
| 23 |
+
|
| 24 |
+
The last column is how far each build is from the original PyTorch model on the same inputs (see the section below
|
| 25 |
+
for what was measured).
|
| 26 |
+
|
| 27 |
+
| Precision | File | Size | sha256 | Checked against the original |
|
| 28 |
+
|---|---|---|---|---|
|
| 29 |
+
| fp16 | [`fp16/config.json`](https://huggingface.co/moonbox-ai/VOSR-MLX/blob/main/fp16/config.json) | 0.8 kB | `7831ae8dacd5` | PSNR 42.3 dB mean / 31.4 worst, LPIPS <= 0.011 |
|
| 30 |
+
| fp16 | [`fp16/mlx_model.py`](https://huggingface.co/moonbox-ai/VOSR-MLX/blob/main/fp16/mlx_model.py) | 23.6 kB | `227a42122e08` | PSNR 42.3 dB mean / 31.4 worst, LPIPS <= 0.011 |
|
| 31 |
+
| fp16 | [`fp16/model.safetensors`](https://huggingface.co/moonbox-ai/VOSR-MLX/blob/main/fp16/model.safetensors) | 3.33 GB | `de064c413024` | PSNR 42.3 dB mean / 31.4 worst, LPIPS <= 0.011 |
|
| 32 |
+
|
| 33 |
+
## How to run
|
| 34 |
+
|
| 35 |
+
VOSR 2.0 (the one-step 1.4B model) ported to MLX: the whole pipeline of `inference_vosr_onestep.py` (bicubic
|
| 36 |
+
upscale, the 2D Qwen-Image VAE, DINOv2-L features, one LightningDiT step, the wavelet color fix). Each folder holds
|
| 37 |
+
`model.safetensors`, `config.json` and `mlx_model.py`, the port (`mlx`, `numpy` and `Pillow`):
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
import numpy as np, mlx_model
|
| 41 |
+
from PIL import Image
|
| 42 |
+
model = mlx_model.load("fp16")
|
| 43 |
+
out = mlx_model.upscale(model, np.array(Image.open("in.png").convert("RGB")), scale=4, seed=42)
|
| 44 |
+
Image.fromarray(out).save("out.png")
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
It runs the full picture at once (the original's default, no tiling). Output sides are rounded up to a multiple of
|
| 48 |
+
16 internally and cropped back.
|
| 49 |
+
|
| 50 |
+
**Which one:** `fp16/` follows the original closely (42 dB mean against PyTorch fp32, LPIPS <= 0.011). VOSR makes up
|
| 51 |
+
detail from noise in one step, so small numeric differences show up as different fine texture: `bf16/`, `8bit/`
|
| 52 |
+
and `6bit/` look the same as each other but drift from the original on some pictures (LPIPS up to 0.048, below the
|
| 53 |
+
lab's upscaling threshold of 0.02, so marked experimental); `4bit/` drifts further.
|
| 54 |
+
|
| 55 |
+
| Precision | Size | PSNR vs PyTorch fp32 (mean / worst) | LPIPS (worst) | Time, 128 -> 512 on an M5 |
|
| 56 |
+
|---|---|---|---|---|
|
| 57 |
+
| `fp16/` | 3.33 GB | 42.3 / 31.4 dB | 0.011 | 1.0 s |
|
| 58 |
+
| `bf16/` (experimental) | 3.33 GB | 33.8 / 23.2 dB | 0.045 | 1.0 s |
|
| 59 |
+
| `8bit/` (experimental) | 1.82 GB | 33.7 / 23.1 dB | 0.047 | 1.1 s |
|
| 60 |
+
| `6bit/` (experimental) | 1.41 GB | 33.1 / 22.8 dB | 0.048 | 1.1 s |
|
| 61 |
+
| `4bit/` (experimental) | 1.01 GB | 29.1 / 20.5 dB | 0.094 | 1.0 s |
|
| 62 |
+
|
| 63 |
+
Quantized builds quantize the DiT's and DINOv2's linear layers (group 64); the VAE is all convolutions and stays
|
| 64 |
+
16-bit.
|
| 65 |
+
|
| 66 |
+
## How these were made
|
| 67 |
+
|
| 68 |
+
From [VOSR 2.0](https://github.com/cswry/VOSR) at revision `516f292b99`: the original weights loaded in MLX and stored as bf16 or fp16, or
|
| 69 |
+
quantized with MLX's affine quantization (`8bit`, `6bit`, `4bit`, group size 64; layers MLX can't quantize, such as
|
| 70 |
+
convolutions and norms, stay bf16). Every build was checked against the original before upload; the `sha256` column
|
| 71 |
+
above is what the files must hash to.
|
| 72 |
+
|
| 73 |
+
## License
|
| 74 |
+
|
| 75 |
+
Apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this
|
| 76 |
+
repository, and it governs your use of these files. The original model card follows unchanged.
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
# Original model card
|
| 81 |
+
|
| 82 |
+
<div align="center">
|
| 83 |
+
|
| 84 |
+
<p align="center">
|
| 85 |
+
<img src="assets/logo.png" alt="VOSR logo" width="72%">
|
| 86 |
+
</p>
|
| 87 |
+
|
| 88 |
+
# VOSR: A Vision-Only Generative Model for Image Super-Resolution
|
| 89 |
+
|
| 90 |
+
<p align="center"><i>A framework for native generative image restoration.</i></p>
|
| 91 |
+
|
| 92 |
+
#### 🚩 Accepted by CVPR 2026
|
| 93 |
+
|
| 94 |
+
[](https://arxiv.org/pdf/2604.03225)
|
| 95 |
+
[](https://modelscope.cn/models/LULALULALU/VOSR_CKPT)
|
| 96 |
+
[](https://huggingface.co/CSWRY/VOSR)
|
| 97 |
+
[](https://modelscope.cn/datasets/LULALULALU/ScreenSR)
|
| 98 |
+
[](https://huggingface.co/datasets/CSWRY/ScreenSR)
|
| 99 |
+
|
| 100 |
+
[Rongyuan Wu](https://scholar.google.com/citations?user=A-U8zE8AAAAJ&hl=zh-CN)<sup>1,2,*</sup> |
|
| 101 |
+
[Lingchen Sun](https://scholar.google.com/citations?user=ZCDjTn8AAAAJ&hl=zh-CN)<sup>1,2,*</sup> |
|
| 102 |
+
[Zhengqiang Zhang](https://scholar.google.com/citations?user=UX26wSMAAAAJ&hl=en)<sup>1,2</sup> |
|
| 103 |
+
[Xiangtao Kong](https://scholar.google.com/citations?user=lueNzSgAAAAJ&hl=zh-CN)<sup>1,2</sup> <br>
|
| 104 |
+
[Jixin Zhao](https://scholar.google.com/citations?user=0Z89rfUAAAAJ)<sup>1,2</sup> |
|
| 105 |
+
[Shihao Wang](https://scholar.google.com/citations?user=7TWugs4AAAAJ&hl=zh-CN)<sup>1</sup> |
|
| 106 |
+
[Lei Zhang](https://www4.comp.polyu.edu.hk/~cslzhang/)<sup>1,2,†</sup>
|
| 107 |
+
|
| 108 |
+
<sup>1</sup> The Hong Kong Polytechnic University
|
| 109 |
+
<sup>2</sup> OPPO Research Institute
|
| 110 |
+
|
| 111 |
+
<sup>*</sup> Equal contribution. <sup>†</sup> Corresponding author.
|
| 112 |
+
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<!-- Optional teaser image -->
|
| 116 |
+
<!--  -->
|
| 117 |
+
|
| 118 |
+
<p align="center">
|
| 119 |
+
<img src="assets/overview.jpg" alt="VOSR overview" width="100%">
|
| 120 |
+
</p>
|
| 121 |
+
<p align="center"><em>Overview of the VOSR framework, including the overall pipeline and our condition / guidance design.</em></p>
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
## 📌 Quick Links
|
| 125 |
+
|
| 126 |
+
- [📰 News](#news)
|
| 127 |
+
- [🧰 Preparation](#preparation)
|
| 128 |
+
- [🏋️ Training](#training)
|
| 129 |
+
- [🔍 Inference](#inference)
|
| 130 |
+
- [📮 Contact](#contact)
|
| 131 |
+
- [📚 Citation](#citation)
|
| 132 |
+
|
| 133 |
+
<a id="news"></a>
|
| 134 |
+
## 📰 News
|
| 135 |
+
|
| 136 |
+
- 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).
|
| 137 |
+
|
| 138 |
+
- 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).
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
<p align="center">
|
| 143 |
+
<img src="assets/vosr_comparison_figure.png" alt="VOSR performance, efficiency, and training cost comparison" width="100%">
|
| 144 |
+
</p>
|
| 145 |
+
<p align="center"><em>Comparison with prior methods in performance, inference efficiency, and training cost.</em></p>
|
| 146 |
+
|
| 147 |
+
<p align="center">
|
| 148 |
+
<img src="assets/vis_comp.jpg" alt="Qualitative comparison on natural and text-rich images" width="100%">
|
| 149 |
+
</p>
|
| 150 |
+
<p align="center"><em>VOSR better preserves fine structures and text readability.</em></p>
|
| 151 |
+
|
| 152 |
+
<a id="preparation"></a>
|
| 153 |
+
## 🧰 Preparation
|
| 154 |
+
|
| 155 |
+
### Dependencies and Installation
|
| 156 |
+
|
| 157 |
+
```bash
|
| 158 |
+
## clone this repository
|
| 159 |
+
git clone https://github.com/cswry/VOSR.git
|
| 160 |
+
cd VOSR
|
| 161 |
+
|
| 162 |
+
# create an environment with python >= 3.8
|
| 163 |
+
conda create -n vosr python=3.8
|
| 164 |
+
conda activate vosr
|
| 165 |
+
pip install -r requirements.txt
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
### 📦 Model Weights
|
| 169 |
+
|
| 170 |
+
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:
|
| 171 |
+
|
| 172 |
+
```text
|
| 173 |
+
preset/ckpts/
|
| 174 |
+
|-- Qwen-Image-vae-2d/ # Qwen-Image VAE (2D, for 1.4B models)
|
| 175 |
+
|-- stable-diffusion-2-1-base/ # SD2.1 VAE (for 0.5B models)
|
| 176 |
+
|-- sd21_lwdecoder.pth # Lightweight decoder for SD2.1 VAE
|
| 177 |
+
|-- torch_cache/ # DINOv2 pretrained weights
|
| 178 |
+
|-- VOSR2/ # VOSR 2.0 one-step (1.4B) model
|
| 179 |
+
|-- VOSR_0.5B_ms/ # 0.5B multi-step model
|
| 180 |
+
|-- VOSR_0.5B_os/ # 0.5B one-step (distilled) model
|
| 181 |
+
|-- VOSR_1.4B_ms/ # 1.4B multi-step model
|
| 182 |
+
`-- VOSR_1.4B_os/ # 1.4B one-step (distilled) model
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
#### VAE and decoder
|
| 186 |
+
|
| 187 |
+
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.
|
| 188 |
+
|
| 189 |
+
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.
|
| 190 |
+
|
| 191 |
+
### 🗂️ Training Data
|
| 192 |
+
|
| 193 |
+
We support two data loading modes, configured via `dataset_type` in the YAML config:
|
| 194 |
+
|
| 195 |
+
- `txt` - Each folder contains individual image files. A txt config lists folders with sampling weights.
|
| 196 |
+
- `webdataset` - Each folder contains `.tar` shards. Same txt config format, loaded via WebDataset.
|
| 197 |
+
|
| 198 |
+
Create a dataset config file (e.g., `configs/train_txt/train_dataset_txt.txt`):
|
| 199 |
+
|
| 200 |
+
```text
|
| 201 |
+
/path/to/dataset_A, 2
|
| 202 |
+
/path/to/dataset_B, 1
|
| 203 |
+
/path/to/dataset_C, 1
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
Each line: `<folder_path>, <sampling_weight>`. Higher weight = more frequent sampling.
|
| 207 |
+
|
| 208 |
+
For `txt` mode, each folder should contain HQ images (`.png` / `.jpg`). For `webdataset` mode, each folder should contain `.tar` shards with images inside.
|
| 209 |
+
|
| 210 |
+
### 🧪 New Real-World Paired Benchmark
|
| 211 |
+
|
| 212 |
+
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.
|
| 213 |
+
|
| 214 |
+
[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.
|
| 215 |
+
|
| 216 |
+
<p align="center">
|
| 217 |
+
<img src="assets/montage_13x10_256px.jpg" alt="ScreenSR benchmark montage" width="100%">
|
| 218 |
+
</p>
|
| 219 |
+
<p align="center"><em>Thumbnail montage of the ScreenSR benchmark, covering diverse scenes, subjects, and multilingual text.</em></p>
|
| 220 |
+
|
| 221 |
+
---
|
| 222 |
+
|
| 223 |
+
<a id="training"></a>
|
| 224 |
+
## 🏋️ Training
|
| 225 |
+
|
| 226 |
+
The provided training configs disable experiment tracking by default
|
| 227 |
+
(`report_to: none`). To enable Weights & Biases logging, run `wandb login`
|
| 228 |
+
with your own account and set `report_to: wandb` in the YAML config.
|
| 229 |
+
|
| 230 |
+
### Multi-step Training
|
| 231 |
+
|
| 232 |
+
```bash
|
| 233 |
+
# VOSR-0.5B
|
| 234 |
+
torchrun --nproc_per_node=8 train_vosr.py --config configs/train_yml/multi_step/VOSR_0.5B.yml
|
| 235 |
+
|
| 236 |
+
# VOSR-1.4B
|
| 237 |
+
torchrun --nproc_per_node=8 train_vosr.py --config configs/train_yml/multi_step/VOSR_1.4B.yml
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
### One-step Distillation
|
| 241 |
+
|
| 242 |
+
Requires a trained multi-step teacher checkpoint. Set `teacher_ckpt` and `pretrained_ckpt` in the YAML config.
|
| 243 |
+
|
| 244 |
+
```bash
|
| 245 |
+
# VOSR-0.5B one-step
|
| 246 |
+
torchrun --nproc_per_node=8 train_vosr_distill.py --config configs/train_yml/one_step/VOSR_0.5B.yml
|
| 247 |
+
|
| 248 |
+
# VOSR-1.4B one-step
|
| 249 |
+
torchrun --nproc_per_node=8 train_vosr_distill.py --config configs/train_yml/one_step/VOSR_1.4B.yml
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
---
|
| 253 |
+
|
| 254 |
+
<a id="inference"></a>
|
| 255 |
+
## 🔍 Inference
|
| 256 |
+
|
| 257 |
+
Single-GPU inference.
|
| 258 |
+
|
| 259 |
+
### VOSR 2.0 one-step (default)
|
| 260 |
+
|
| 261 |
+
VOSR 2.0 is the default one-step model (1.4B DiT, vision-only, with improved fine-structure restoration).
|
| 262 |
+
|
| 263 |
+
```bash
|
| 264 |
+
# VOSR2-1.4B one-step
|
| 265 |
+
python inference_vosr_onestep.py \
|
| 266 |
+
-c preset/ckpts/VOSR2 \
|
| 267 |
+
-i preset/datasets/inp_data \
|
| 268 |
+
-o preset/results \
|
| 269 |
+
-u 4
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
### Multi-step models
|
| 273 |
+
|
| 274 |
+
Multi-step sampling defaults to **25 steps** (`--infer_steps`, default 25). Override if you need fewer or more function evaluations.
|
| 275 |
+
|
| 276 |
+
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`):
|
| 277 |
+
|
| 278 |
+
- `--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.
|
| 279 |
+
- `--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`.
|
| 280 |
+
|
| 281 |
+
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).
|
| 282 |
+
|
| 283 |
+
```bash
|
| 284 |
+
# Inputs under preset/datasets/inp_data follow RealSR-style evaluation; use --cfg_scale -0.5 (see benchmark presets above).
|
| 285 |
+
|
| 286 |
+
# VOSR-0.5B multi-step (25 steps)
|
| 287 |
+
python inference_vosr.py \
|
| 288 |
+
-c preset/ckpts/VOSR_0.5B_ms \
|
| 289 |
+
-i preset/datasets/inp_data \
|
| 290 |
+
-o preset/results \
|
| 291 |
+
-u 4
|
| 292 |
+
|
| 293 |
+
# VOSR-1.4B multi-step (25 steps)
|
| 294 |
+
python inference_vosr.py \
|
| 295 |
+
-c preset/ckpts/VOSR_1.4B_ms \
|
| 296 |
+
-i preset/datasets/inp_data \
|
| 297 |
+
-o preset/results \
|
| 298 |
+
-u 4
|
| 299 |
+
```
|
| 300 |
+
|
| 301 |
+
### One-step models
|
| 302 |
+
|
| 303 |
+
One-step models use `--infer_steps` with default `1` (typical for distilled checkpoints).
|
| 304 |
+
|
| 305 |
+
```bash
|
| 306 |
+
# VOSR-0.5B one-step
|
| 307 |
+
python inference_vosr_onestep.py \
|
| 308 |
+
-c preset/ckpts/VOSR_0.5B_os \
|
| 309 |
+
-i preset/datasets/inp_data \
|
| 310 |
+
-o preset/results \
|
| 311 |
+
-u 4
|
| 312 |
+
|
| 313 |
+
# VOSR-1.4B one-step
|
| 314 |
+
python inference_vosr_onestep.py \
|
| 315 |
+
-c preset/ckpts/VOSR_1.4B_os \
|
| 316 |
+
-i preset/datasets/inp_data \
|
| 317 |
+
-o preset/results \
|
| 318 |
+
-u 4
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
### Common arguments
|
| 322 |
+
|
| 323 |
+
`-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`).
|
| 324 |
+
|
| 325 |
+
- Multi-step (`inference_vosr.py`): `--infer_steps` (default `25`), `--cfg_scale`, `--weak_cond_strength_aelq` (see above).
|
| 326 |
+
- One-step (`inference_vosr_onestep.py`): `--infer_steps` (default `1`).
|
| 327 |
+
- Both: `--posterior_mode` / `--no-posterior_mode` — deterministic VAE latent (`latent_dist.mode()`) is the default, for reproducible results and seam-free tiled inference.
|
| 328 |
+
|
| 329 |
+
### Tiled inference for large images
|
| 330 |
+
|
| 331 |
+
Large images are tiled in latent space to bound GPU memory:
|
| 332 |
+
|
| 333 |
+
- `--tile_size 512` — DiT tile size in pixels (default `0` = disabled). Use for large images; overlapping tiles are Gaussian-blended.
|
| 334 |
+
- `--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.
|
| 335 |
+
- `--vae_tile_overlap` — VAE tile overlap (default: follows `--tile_overlap`).
|
| 336 |
+
|
| 337 |
+
```bash
|
| 338 |
+
# VOSR-1.4B one-step on a large image with DiT + VAE tiling
|
| 339 |
+
python inference_vosr_onestep.py \
|
| 340 |
+
-c preset/ckpts/VOSR_1.4B_os \
|
| 341 |
+
-i large_input.png \
|
| 342 |
+
-o preset/results \
|
| 343 |
+
-u 4 --tile_size 512 --vae_tile_size 1024
|
| 344 |
+
```
|
| 345 |
+
|
| 346 |
+
---
|
| 347 |
+
|
| 348 |
+
<a id="contact"></a>
|
| 349 |
+
## 📮 Contact
|
| 350 |
+
|
| 351 |
+
If you have any questions, please feel free to contact: `rong-yuan.wu@connect.polyu.hk`
|
| 352 |
+
|
| 353 |
+
<a id="citation"></a>
|
| 354 |
+
## 📚 Citation
|
| 355 |
+
|
| 356 |
+
If VOSR is useful for your research, please consider citing:
|
| 357 |
+
|
| 358 |
+
```bibtex
|
| 359 |
+
@inproceedings{wu2026vosr,
|
| 360 |
+
title = {VOSR: A Vision-Only Generative Model for Image Super-Resolution},
|
| 361 |
+
author = {Wu, Rongyuan and Sun, Lingchen and Zhang, Zhengqiang and Kong, Xiangtao and Zhao, Jixin and Wang, Shihao and Zhang, Lei},
|
| 362 |
+
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
| 363 |
+
year = {2026}
|
| 364 |
+
}
|
| 365 |
+
```
|
| 366 |
+
|
| 367 |
+
## Acknowledgements
|
| 368 |
+
|
| 369 |
+
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.
|
| 370 |
+
|
| 371 |
+
## ⚖️ License
|
| 372 |
+
|
| 373 |
+
This project is released under the Apache License 2.0 unless otherwise noted. See [LICENSE](LICENSE) for details. Downloadable model weights, benchmark data, and external assets may have separate terms on their hosting pages.
|