Image-to-Image
Diffusers
lora
image-restoration
face-restoration
super-resolution
reference-based
qwen-image-2.1
Instructions to use hc0/RefRes with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use hc0/RefRes 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("Qwen/Qwen-Image-2.1-Turbo", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("hc0/RefRes") 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
- Local Apps Settings
- Draw Things
Single prompt with notes for man and reference count
Browse files
README.md
CHANGED
|
@@ -48,38 +48,15 @@ five to nine work best.
|
|
| 48 |
| CFG | 1, no negative prompt |
|
| 49 |
| VAE | [Texture-Fix VAE](https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1) recommended |
|
| 50 |
|
| 51 |
-
Prompts for the two setups RefRes was trained on. For another count, change only the last image number (*Images 2 to N*) — with one reference that is *Images 2 to 2*, exactly as in our 1-reference tests.
|
| 52 |
-
|
| 53 |
<details>
|
| 54 |
-
<summary>Prompt
|
| 55 |
|
| 56 |
```text
|
| 57 |
Restore image 1, a photo of a woman, into a sharp, clear, high-resolution photograph with crisp fine detail. Images 2 to 6 are other photos of the same woman; use them only as identity reference to recover her true facial features and fine details. Keep image 1's pose, expression, framing, clothing, background and colors unchanged. Remove every trace of low resolution and degradation: pixelation, soft or blurry upscaling, blur, all kinds of noise and film grain, JPEG and WebP compression artifacts, color banding, as well as any overlaid text, stickers, emoji or watermarks. The result must look natively high resolution: sharp, clean and detailed, with no grain, no noise and no low-resolution softness.
|
| 58 |
```
|
| 59 |
-
</details>
|
| 60 |
-
|
| 61 |
-
<details>
|
| 62 |
-
<summary>Prompt · woman · 9 references (images 2–10)</summary>
|
| 63 |
-
|
| 64 |
-
```text
|
| 65 |
-
Restore image 1, a photo of a woman, into a sharp, clear, high-resolution photograph with crisp fine detail. Images 2 to 10 are other photos of the same woman; use them only as identity reference to recover her true facial features and fine details. Keep image 1's pose, expression, framing, clothing, background and colors unchanged. Remove every trace of low resolution and degradation: pixelation, soft or blurry upscaling, blur, all kinds of noise and film grain, JPEG and WebP compression artifacts, color banding, as well as any overlaid text, stickers, emoji or watermarks. The result must look natively high resolution: sharp, clean and detailed, with no grain, no noise and no low-resolution softness.
|
| 66 |
-
```
|
| 67 |
-
</details>
|
| 68 |
-
|
| 69 |
-
<details>
|
| 70 |
-
<summary>Prompt · man · 5 references (images 2–6)</summary>
|
| 71 |
-
|
| 72 |
-
```text
|
| 73 |
-
Restore image 1, a photo of a man, into a sharp, clear, high-resolution photograph with crisp fine detail. Images 2 to 6 are other photos of the same man; use them only as identity reference to recover his true facial features and fine details. Keep image 1's pose, expression, framing, clothing, background and colors unchanged. Remove every trace of low resolution and degradation: pixelation, soft or blurry upscaling, blur, all kinds of noise and film grain, JPEG and WebP compression artifacts, color banding, as well as any overlaid text, stickers, emoji or watermarks. The result must look natively high resolution: sharp, clean and detailed, with no grain, no noise and no low-resolution softness.
|
| 74 |
-
```
|
| 75 |
-
</details>
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
```text
|
| 81 |
-
Restore image 1, a photo of a man, into a sharp, clear, high-resolution photograph with crisp fine detail. Images 2 to 10 are other photos of the same man; use them only as identity reference to recover his true facial features and fine details. Keep image 1's pose, expression, framing, clothing, background and colors unchanged. Remove every trace of low resolution and degradation: pixelation, soft or blurry upscaling, blur, all kinds of noise and film grain, JPEG and WebP compression artifacts, color banding, as well as any overlaid text, stickers, emoji or watermarks. The result must look natively high resolution: sharp, clean and detailed, with no grain, no noise and no low-resolution softness.
|
| 82 |
-
```
|
| 83 |
</details>
|
| 84 |
|
| 85 |
## Choosing the references
|
|
|
|
| 48 |
| CFG | 1, no negative prompt |
|
| 49 |
| VAE | [Texture-Fix VAE](https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1) recommended |
|
| 50 |
|
|
|
|
|
|
|
| 51 |
<details>
|
| 52 |
+
<summary>Prompt (woman, 5 references)</summary>
|
| 53 |
|
| 54 |
```text
|
| 55 |
Restore image 1, a photo of a woman, into a sharp, clear, high-resolution photograph with crisp fine detail. Images 2 to 6 are other photos of the same woman; use them only as identity reference to recover her true facial features and fine details. Keep image 1's pose, expression, framing, clothing, background and colors unchanged. Remove every trace of low resolution and degradation: pixelation, soft or blurry upscaling, blur, all kinds of noise and film grain, JPEG and WebP compression artifacts, color banding, as well as any overlaid text, stickers, emoji or watermarks. The result must look natively high resolution: sharp, clean and detailed, with no grain, no noise and no low-resolution softness.
|
| 56 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
- **For a man:** replace *woman* with *man* and *her* with *his*.
|
| 59 |
+
- **For another number of references:** change only the last image number — *Images 2 to 10* for nine, *Images 2 to 2* for one.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
</details>
|
| 61 |
|
| 62 |
## Choosing the references
|