Improve model card: Add pipeline tag, library name, paper, code, and detailed content
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
|
@@ -1,3 +1,115 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: image-to-image
|
| 4 |
+
library_name: diffusers
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# ODTSR: One-Step Diffusion Transformer for Controllable Real-World Image Super-Resolution
|
| 8 |
+
|
| 9 |
+
This repository contains the official implementation of **ODTSR**, a model presented in the paper:
|
| 10 |
+
[**One-Step Diffusion Transformer for Controllable Real-World Image Super-Resolution**](https://huggingface.co/papers/2511.17138)
|
| 11 |
+
|
| 12 |
+
**Authors**: Yushun Fang, Yuxiang Chen, Shibo Yin, Qiang Hu, Jiangchao Yao, Ya Zhang, Xiaoyun Zhang, Yanfeng Wang
|
| 13 |
+
**Affiliations**: Shanghai Jiao Tong University, Xiaohongshu Inc
|
| 14 |
+
|
| 15 |
+
**Code**: [https://github.com/RedMediaTech/ODTSR](https://github.com/RedMediaTech/ODTSR)
|
| 16 |
+
|
| 17 |
+
<div align="center">
|
| 18 |
+
<img src="https://github.com/RedMediaTech/ODTSR/raw/main/static/1.png" alt="ODTSR Overview Framework" width="80%">
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
## Overview
|
| 22 |
+
Recent advances in diffusion-based real-world image super-resolution (Real-ISR) have demonstrated remarkable perceptual quality, yet the balance between fidelity and controllability remains a problem: multi-step diffusion-based methods suffer from generative diversity and randomness, resulting in low fidelity, while one-step methods lose control flexibility due to fidelity-specific finetuning.
|
| 23 |
+
|
| 24 |
+
**ODTSR** addresses this by presenting a one-step diffusion transformer based on Qwen-Image that performs Real-ISR considering fidelity and controllability simultaneously. It introduces a newly designed **Noise-hybrid Visual Stream (NVS)** that receives low-quality images with adjustable noise (Control Noise) and consistent noise (Prior Noise). Furthermore, **Fidelity-aware Adversarial Training (FAA)** is employed to enhance controllability and achieve one-step inference. ODTSR not only achieves state-of-the-art (SOTA) performance on generic Real-ISR, but also enables prompt controllability on challenging scenarios such as real-world scene text image super-resolution (STISR) of Chinese characters without training on specific datasets.
|
| 25 |
+
|
| 26 |
+
## Key Features
|
| 27 |
+
* **One-Step Super-Resolution**: Based on Qwen-Image, ODTSR trains a single-step SR model using LoRA, with model parameters reaching 20B.
|
| 28 |
+
* **Controllability**: With our proposed Noise-hybrid Visual Stream and Fidelity-aware Adversarial Training, the SR process can be jointly controlled by prompts as well as a Fidelity Weight $f$.
|
| 29 |
+
* **Multilingual Support**: English and Chinese prompts are supported.
|
| 30 |
+
* **Versatile Performance**: The model demonstrates strong performance in text images, fine-grained textures, and face images.
|
| 31 |
+
|
| 32 |
+
## Visual Results
|
| 33 |
+
|
| 34 |
+
### Results with fixed prompts & high fidelity
|
| 35 |
+
<div align="center">
|
| 36 |
+
<img src="https://github.com/RedMediaTech/ODTSR/raw/main/static/4.jpeg" alt="Results with fixed prompts & high fidelity" width="80%">
|
| 37 |
+
</div>
|
| 38 |
+
Under the high-fidelity setting with a fixed prompt, our model produces restorations that adhere more closely to the LQ input while remaining natural, significantly reducing the sense of AI processing.
|
| 39 |
+
|
| 40 |
+
### Text Real-ISR Results
|
| 41 |
+
<div align="center">
|
| 42 |
+
<img src="https://github.com/RedMediaTech/ODTSR/raw/main/static/2.jpeg" alt="Text Real-ISR Results" width="80%">
|
| 43 |
+
</div>
|
| 44 |
+
In text scenarios, when the prompt specifies the text to be restored, the model automatically matches the LQ text and performs the restoration.
|
| 45 |
+
|
| 46 |
+
### Controllable Real-ISR Results
|
| 47 |
+
<div align="center">
|
| 48 |
+
<img src="https://github.com/RedMediaTech/ODTSR/raw/main/static/3.jpeg" alt="Controllable Real-ISR Results" width="80%">
|
| 49 |
+
</div>
|
| 50 |
+
Qualitative results of controllable SR with prompt and adjustable Fidelity Weight (denoted as $f$) on Div2k-val dataset. As $f$ decreases from 1 to 0, detail generation and prompt adherence gradually strengthen.
|
| 51 |
+
|
| 52 |
+
## Dependencies and Installation
|
| 53 |
+
|
| 54 |
+
1. Prepare conda env:
|
| 55 |
+
```bash
|
| 56 |
+
conda create -n yourenv python=3.11
|
| 57 |
+
```
|
| 58 |
+
2. Install `pytorch` (we recommend `torch==2.6.0`):
|
| 59 |
+
```bash
|
| 60 |
+
pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 -f https://mirrors.aliyun.com/pytorch-wheels/cu124/
|
| 61 |
+
```
|
| 62 |
+
3. Install this repo (based on [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio/tree/main)). The required packages will be automatically installed:
|
| 63 |
+
```bash
|
| 64 |
+
cd xxxx/ODTSR # Replace xxxx with your path
|
| 65 |
+
pip3 install -e . -v -i https://mirrors.cloud.tencent.com/pypi/simple
|
| 66 |
+
```
|
| 67 |
+
4. (For training) Install `basicsr`:
|
| 68 |
+
```bash
|
| 69 |
+
pip install basicsr
|
| 70 |
+
```
|
| 71 |
+
Note:
|
| 72 |
+
You can apply the the following command to fix a bug in `basicsr`. Make sure to replace `/opt/conda` with the path to your own conda environment:
|
| 73 |
+
```bash
|
| 74 |
+
sed -i '8s/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms._functional_tensor import rgb_to_grayscale/' /opt/conda/lib/python3.11/site-packages/basicsr/data/degradations.py
|
| 75 |
+
```
|
| 76 |
+
5. Download base model to your disk: [Qwen-Image](https://huggingface.co/Qwen/Qwen-Image/tree/main)
|
| 77 |
+
6. (For training) Download base model to your disk: [Wan2.1-T2V-1.3B](https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B/tree/main)
|
| 78 |
+
7. (For inference) Download the trained ODTSR model weight: [huggingface](https://huggingface.co/double8fun/ODTSR/tree/main)
|
| 79 |
+
|
| 80 |
+
## Inference with Script
|
| 81 |
+
Note: you need at least 40GB GPU memory to infer. We will support CPU offload to reduce GPU memory usage soon.
|
| 82 |
+
We now supports tile-based processing (tile size: 512×512), enabling input of arbitrary resolutions and SR at any scale factor.
|
| 83 |
+
|
| 84 |
+
Please replace `experiments/qwen_one_step_gan/${EXP_DATE}/checkpoints/net_gen_iter_10001.pth` with the trained ODTSR model weight.
|
| 85 |
+
```bash
|
| 86 |
+
sh examples/qwen_image/test_gan.sh
|
| 87 |
+
```
|
| 88 |
+
<div align="center">
|
| 89 |
+
<img src="https://github.com/RedMediaTech/ODTSR/raw/main/static/infer.png" alt="Inference Workflow" width="70%">
|
| 90 |
+
</div>
|
| 91 |
+
|
| 92 |
+
## Inference with Gradio
|
| 93 |
+
```bash
|
| 94 |
+
sh examples/qwen_image/test_gradio.sh
|
| 95 |
+
```
|
| 96 |
+
<img src="https://github.com/RedMediaTech/ODTSR/raw/main/static/gradio.jpeg" alt="Gradio Demo" >
|
| 97 |
+
|
| 98 |
+
## License
|
| 99 |
+
This project is released under the [Apache 2.0 license](https://github.com/RedMediaTech/ODTSR/blob/main/LICENSE).
|
| 100 |
+
|
| 101 |
+
## Acknowledgement
|
| 102 |
+
This project is based on [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio/tree/main).
|
| 103 |
+
We also leveraged some of [PiSA-SR](https://github.com/csslc/PiSA-SR/tree/main)'s code in dataloader part.
|
| 104 |
+
Thanks for the awesome work!
|
| 105 |
+
|
| 106 |
+
## Citation
|
| 107 |
+
If ODTSR is helpful to you, please consider citing our paper:
|
| 108 |
+
```bibtex
|
| 109 |
+
@article{fang2025onestep,
|
| 110 |
+
title={One-Step Diffusion Transformer for Controllable Real-World Image Super-Resolution},
|
| 111 |
+
author={Fang, Yushun and Chen, Yuxiang and Yin, Shibo and Hu, Qiang and Yao, Jiangchao and Zhang, Ya and Zhang, Xiaoyun and Wang, Yanfeng},
|
| 112 |
+
journal={arXiv preprint arXiv:2511.17138},
|
| 113 |
+
year={2025}
|
| 114 |
+
}
|
| 115 |
+
```
|