Instructions to use frozen2001/RFMSR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use frozen2001/RFMSR with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("frozen2001/RFMSR", torch_dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
File size: 2,378 Bytes
f406eed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ---
pipeline_tag: image-to-image
---
# RFMSR: Residual Flow Matching for Image Super-Resolution
This repository contains the weights for **RFMSR** (Residual Flow Matching for Image Super-Resolution), a vision-only super-resolution framework that utilizes a residual flow design centering the source distribution at the low-quality (LQ) latent to preserve structural priors.
[📚 Paper](https://huggingface.co/papers/2607.12753) | [💻 GitHub Repository](https://github.com/Faze-Hsw/RFMSR)
## Method Overview
RFMSR centers the source distribution at the LR latent, reducing the transport distance and preserving structural priors throughout the flow trajectory. It uses a two-phase training strategy to achieve high-quality single-step generation without sacrificing multi-step refinement.
<p align="center">
<img src="https://raw.githubusercontent.com/Faze-Hsw/RFMSR/main/assets/overview.png" alt="RFMSR overview" width="100%">
</p>
## Pretrained Weights
This repository hosts the following model checkpoints:
- `rfmsr.safetensors` — Phase I: Multi-step Flow Matching model (15-step recommended)
- `rfmsr_os.safetensors` — Phase II: One-step model
- `rfmsr_consistency.safetensors` — Consistency distillation: One-step model
## Quick Start (Inference)
To run inference, please clone the official GitHub repository and install the dependencies:
```bash
git clone https://github.com/Faze-Hsw/RFMSR.git
cd RFMSR
conda create -n rfmsr python=3.12 -y
conda activate rfmsr
pip install -r requirements.txt
```
Download the checkpoints via `huggingface-cli`:
```bash
pip install huggingface_hub
huggingface-cli download frozen2001/RFMSR ckpts/ --local-dir . --local-dir-use-symlinks False
```
Run super-resolution inference on your images:
```bash
# One-step inference (fast, recommended)
python infer_rfmsr.py --input input.png --steps 1
# Multi-step inference (higher quality)
python infer_rfmsr.py --input input.png --steps 15
```
## Citation
If you find this work useful, please cite:
```bibtex
@misc{huang2026rfmsrresidualflowmatching,
title={RFMSR: Residual Flow Matching for Image Super-Resolution},
author={Shuwei Huang and Tianyao Luo and Jicheng Liu and Daizong Liu and Pan Zhou},
year={2026},
eprint={2607.12753},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2607.12753},
}
``` |