Instructions to use PrunaAI/P-Q-Image-2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use PrunaAI/P-Q-Image-2.1 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image-2.1", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("PrunaAI/P-Q-Image-2.1") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
align with previous version
Browse files
README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
## license: other
|
| 4 |
license_name: qwen-research
|
| 5 |
base_model: Qwen/Qwen-Image-2.1
|
| 6 |
library_name: diffusers
|
|
@@ -13,25 +12,55 @@ tags:
|
|
| 13 |
- lora
|
| 14 |
- distilled
|
| 15 |
- few-step
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
and edit images in only 6 steps (v0.2), or 5 or 8 steps (v0.1). The adapters load on top of the base
|
| 36 |
model, so the pipeline, text encoder, and VAE stay unchanged. Training is based
|
| 37 |
on DMD.**
|
|
@@ -44,23 +73,17 @@ on DMD.**
|
|
| 44 |
> visual quality of the base model. We are still improving the distillation and
|
| 45 |
> will update this repository as new versions become available.
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
## Variants
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
### v0.2
|
| 54 |
|
| 55 |
Pick **basic** for faithful base-model behavior, or **prompt-upsampled** for
|
| 56 |
improved visual quality from a short prompt.
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
|
| 60 |
-
|
|
| 61 |
-
| `p_q_image_2.
|
| 62 |
-
| `p_q_image_2.1_upsampled_6_steps_v0.2.safetensors` | 6 | **Improved visual quality.** A first attempt at distilling prompt upsampling into the adapter. |
|
| 63 |
-
|
| 64 |
|
| 65 |
**Basic** is a pure 6-step distillation of the base model, without any additional
|
| 66 |
post-training. It is intended as a drop-in replacement for the base model in
|
|
@@ -77,12 +100,10 @@ what the actual prompt upsampler would do, and we will continue improving it.
|
|
| 77 |
|
| 78 |
Both adapters are v0.1. Pick one based on whether you need **quality** or **speed**.
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
|
| 82 |
-
|
|
| 83 |
-
| `p_q_image_2.
|
| 84 |
-
| `p_q_image_2.1_5step_v0.1.safetensors` | 5 | **Higher speed**, with noticeably lower visual quality. |
|
| 85 |
-
|
| 86 |
|
| 87 |
Each adapter is trained for its own sigma schedule. Load only one at a time.
|
| 88 |
For the v0.2 adapters, do not reuse the v0.1 schedules.
|
|
@@ -108,16 +129,20 @@ inference speed, not a guarantee of quality at that resolution.
|
|
| 108 |
|
| 109 |
## Benchmarking
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
### v0.2: 6-step LoRA and prompt upsampling
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
One NVIDIA H100 80GB per worker, BF16, batch size 1. Median of 3 requests after
|
| 123 |
one warmup per configuration, with seed 42. Wall-clock time is measured around
|
|
@@ -128,8 +153,8 @@ adapter loading, warmup, fixture preparation, file saving, and network transport
|
|
| 128 |
No CFG, compilation, CPU offload, or diffusion KV caching.
|
| 129 |
|
| 130 |
Prompt upsampling is measured separately using
|
| 131 |
-
|
| 132 |
-
and
|
| 133 |
with their task-specific sampling settings and thinking enabled. Timing includes
|
| 134 |
request preparation from in-memory images, image and text processing, text
|
| 135 |
generation, and response parsing. It does not include image generation. The
|
|
@@ -164,11 +189,24 @@ No requests are silently retried.
|
|
| 164 |
### v0.1
|
| 165 |
|
| 166 |
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
Text-to-image with the official Qwen model-card example prompt, BF16, batch size 1,
|
| 174 |
on one NVIDIA H100 80GB. Median of 3 requests after one warmup per configuration.
|
|
@@ -187,8 +225,6 @@ pip install 'torch>=2.4.0' 'transformers>=5.17' accelerate peft pillow
|
|
| 187 |
pip install git+https://github.com/huggingface/diffusers@6256aa7666cedd47443adc8f82da9a10e110b09c
|
| 188 |
```
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
| 192 |
### v0.2
|
| 193 |
|
| 194 |
Use this setup for either v0.2 adapter.
|
|
@@ -224,7 +260,8 @@ pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
|
|
| 224 |
)
|
| 225 |
```
|
| 226 |
|
| 227 |
-
|
|
|
|
| 228 |
Choose one LoRA with `VARIANT`; the prompt-upsampled variant runs directly on your
|
| 229 |
original prompt without a separate prompt-enhancer model. For a local export,
|
| 230 |
replace `"PrunaAI/Pruna-Q-Image-2.1"` with the folder containing the chosen
|
|
@@ -269,8 +306,6 @@ pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
|
|
| 269 |
)
|
| 270 |
```
|
| 271 |
|
| 272 |
-
|
| 273 |
-
|
| 274 |
## For Text-to-Image
|
| 275 |
|
| 276 |
Longer, more descriptive prompts give better results.
|
|
@@ -292,8 +327,6 @@ image = pipe(
|
|
| 292 |
).images[0]
|
| 293 |
```
|
| 294 |
|
| 295 |
-
|
| 296 |
-
|
| 297 |
### For Image Editing
|
| 298 |
|
| 299 |
```python
|
|
@@ -308,8 +341,6 @@ image = pipe(
|
|
| 308 |
).images[0]
|
| 309 |
```
|
| 310 |
|
| 311 |
-
|
| 312 |
-
|
| 313 |
### Recommended settings
|
| 314 |
|
| 315 |
For **v0.2**, use the unshifted six-step sigmas
|
|
@@ -320,43 +351,35 @@ terminal zero. Keep `true_cfg_scale=1.0` and LoRA strength 1.0.
|
|
| 320 |
The **v0.1** settings are:
|
| 321 |
|
| 322 |
- **Use the sigma schedule that matches your adapter**, and keep the scheduler
|
| 323 |
-
at `shift=1.0` with dynamic shifting off so the sigmas are not shifted twice.
|
| 324 |
- 8-step: `1 β 14/15 β 6/7 β 10/13 β 2/3 β 6/11 β 0.4 β 2/9 β 0`
|
| 325 |
-
|
| 326 |
- 5-step: `1 β 0.94 β 6/7 β 2/3 β 0.4 β 0`
|
| 327 |
- **No CFG.** Keep `true_cfg_scale=1.0` and do not pass a negative prompt.
|
| 328 |
- **Keep the LoRA strength at 1.0.**
|
| 329 |
- **Write detailed prompts for text-to-image.** Longer prompts that describe
|
| 330 |
-
the subject, setting, lighting, and style work noticeably better than short
|
| 331 |
-
ones.
|
| 332 |
-
|
| 333 |
-
|
| 334 |
|
| 335 |
## Limitations
|
| 336 |
|
| 337 |
-
|
| 338 |
-
|
| 339 |
### v0.2
|
| 340 |
|
| 341 |
- The prompt-upsampled adapter is a first attempt. It can improve visual quality,
|
| 342 |
-
but may not exactly reproduce the output of the actual prompt upsampler.
|
| 343 |
- Basic is intended to preserve the base model's behavior in fewer steps;
|
| 344 |
-
distillation does not guarantee identical outputs.
|
| 345 |
- Use the step count and sigma schedule that match your v0.2 adapter. Other step
|
| 346 |
-
counts, schedules, or CFG values are not supported.
|
| 347 |
-
|
| 348 |
-
|
| 349 |
|
| 350 |
### v0.1
|
| 351 |
|
| 352 |
- This is a first version. Quality is below that of the base model.
|
| 353 |
- The 5-step adapter is faster than the 8-step one, but its images are
|
| 354 |
-
visibly worse.
|
| 355 |
- Short or vague text-to-image prompts give weaker results.
|
| 356 |
- The adapters are only intended for the settings above. Other step counts,
|
| 357 |
-
schedules, or CFG values are not supported.
|
| 358 |
-
|
| 359 |
-
|
| 360 |
|
| 361 |
## What this is not
|
| 362 |
|
|
@@ -364,8 +387,6 @@ schedules, or CFG values are not supported.
|
|
| 364 |
- Not a replacement for the base model when you need its full quality.
|
| 365 |
- Not a finished release. Expect the weights to change in future versions.
|
| 366 |
|
| 367 |
-
|
| 368 |
-
|
| 369 |
## License
|
| 370 |
|
| 371 |
The end distilled model is based on Qwen-Image-2.1.
|
|
@@ -383,6 +404,32 @@ Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved.
|
|
| 383 |
- Compress your own models with [Pruna](https://github.com/PrunaAI/pruna) and give us a βοΈ for more efficiency!
|
| 384 |
- Want to use our optimized image models right away? Check [P-Image-Ideogram](https://www.pruna.ai/p-image-ideogram) and [P-Image-Edit](https://www.pruna.ai/p-image-edit).
|
| 385 |
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: other
|
|
|
|
| 3 |
license_name: qwen-research
|
| 4 |
base_model: Qwen/Qwen-Image-2.1
|
| 5 |
library_name: diffusers
|
|
|
|
| 12 |
- lora
|
| 13 |
- distilled
|
| 14 |
- few-step
|
| 15 |
+
---
|
| 16 |
+
<!-- header start -->
|
| 17 |
+
<!-- 200823 -->
|
| 18 |
+
<p align="center">
|
| 19 |
+
<img src="assets/Pruna-Q-Image-2.1.png" width="800">
|
| 20 |
+
</p>
|
| 21 |
+
<!-- header end -->
|
| 22 |
+
|
| 23 |
+
<p align="center">
|
| 24 |
+
<a href="https://github.com/PrunaAI/pruna">
|
| 25 |
+
<img src="https://img.shields.io/badge/GitHub-PrunaAI-9334E9?style=plastic&logo=github&logoColor=white" alt="GitHub">
|
| 26 |
+
</a>
|
| 27 |
+
|
| 28 |
+
<a href="https://twitter.com/PrunaAI">
|
| 29 |
+
<img src="https://img.shields.io/badge/Twitter%2FX-@PrunaAI-9334E9?style=plastic&logo=x&logoColor=white" alt="Twitter/X">
|
| 30 |
+
</a>
|
| 31 |
+
|
| 32 |
+
<a href="https://www.linkedin.com/company/pruna-ai">
|
| 33 |
+
<img src="https://img.shields.io/badge/LinkedIn-PrunaAI-9334E9?style=plastic&logo=linkedin&logoColor=white" alt="LinkedIn">
|
| 34 |
+
</a>
|
| 35 |
+
|
| 36 |
+
<a href="https://discord.com/invite/JFQmtFKCjd">
|
| 37 |
+
<img src="https://img.shields.io/badge/Discord-Join%20us-9334E9?style=plastic&logo=discord&logoColor=white" alt="Discord">
|
| 38 |
+
</a>
|
| 39 |
+
|
| 40 |
+
<a href="https://dashboard.pruna.ai/login?utm_source=huggingface&utm_medium=org_card&utm_campaign=hf_traffic">
|
| 41 |
+
<img src="https://img.shields.io/badge/Performance%20Models-Try%20them%20now-9334E9?style=plastic&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MTEiIGhlaWdodD0iNDc3IiBmaWxsPSJub25lIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMjMuNzAzIDMwMC41MzJjLTEuODQyLS42NzQtNC4xNDItMS4wNTctNS43MDMtMi4wMjktMTIuNTU4LTc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k2MyAyOC4zNzYgMzEuMTg4cy0xMi43MDQgMzEuMTg5LTI4LjM3NiAzMS4xODktMjguMzc3LTEzLjk2NC0yOC4zNzctMzEuMTg5YzAtMi42MjUuMjk3LTUuMTc0Ljg1My03LjYxIDEuNjA2IDMuNzI3IDUuMzEyIDYuMzM4IDkuNjI4IDYuMzM4IDUuNzg5IDAgMTAuNDgyLTQuNjkzIDEwLjQ4Mi0xMC40ODJzLTQuNjkzLTEwLjQ4MS0xMC40ODItMTAuNDgxYy0uNzYxIDAtMS41MDQuMDgzLTIuMjE5LjIzNyA1LjEzOS01LjY3NiAxMi4yNTQtOS4xOSAyMC4xMTUtOS4xOSIvPjxwYXRoIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSI5LjIwMyIgZD0iTTE3Ny4xMzUgMzQ1LjMyOGMuODk5LS4yNCAyLjgwMS0uMTk3IDYuMzA0LjQ2NCA2LjMxMSAxLjE5IDE2LjU4NSA0LjIyMSAyNi4xMjIgNC4yMjEgOS40NTIgMCAxNy4xMTgtMS45MjYgMjEuMzgzLTIuNjAzLjc3LS4xMjMgMS4zODUtLjE5OSAxLjg3OC0uMjM3LS4zNCAxMy44NDMtMTIuODkzIDI3LjcxLTI3Ljg2OCAyNy43MS0xNS4xNzIgMC0yNy44NzYtMTMuODM1LTI3Ljg3Ni0yOC44MTEgMC0uMzU3LjAyOS0uNTk2LjA1Ny0uNzQ0WiIvPjwvc3ZnPg==" alt="Performance Models">
|
| 42 |
+
</a>
|
| 43 |
+
</p>
|
| 44 |
+
<div align="center">
|
| 45 |
+
|
| 46 |
+
<h1 style="color: #9334E9;">β‘ Pruna-Q-Image-2.1</h1>
|
| 47 |
+
|
| 48 |
+
<h2>Few-step LoRA adapters for Qwen-Image-2.1</h2>
|
| 49 |
+
|
| 50 |
+
<h3>
|
| 51 |
+
<span style="color: #9334E9;">6 steps (v0.2), 5 or 8 steps (v0.1)</span>
|
| 52 |
+
Β·
|
| 53 |
+
<span style="color: #9334E9;">Up to 6.3x faster</span>
|
| 54 |
+
Β·
|
| 55 |
+
<span style="color: #9334E9;">No CFG</span>
|
| 56 |
+
Β·
|
| 57 |
+
Text-to-image and image editing
|
| 58 |
+
</h3>
|
| 59 |
+
|
| 60 |
+
</div>
|
| 61 |
+
|
| 62 |
+
**Pruna-Q-Image-2.1 is a set of LoRA adapters that let
|
| 63 |
+
[`Qwen/Qwen-Image-2.1`](https://huggingface.co/Qwen/Qwen-Image-2.1) generate
|
| 64 |
and edit images in only 6 steps (v0.2), or 5 or 8 steps (v0.1). The adapters load on top of the base
|
| 65 |
model, so the pipeline, text encoder, and VAE stay unchanged. Training is based
|
| 66 |
on DMD.**
|
|
|
|
| 73 |
> visual quality of the base model. We are still improving the distillation and
|
| 74 |
> will update this repository as new versions become available.
|
| 75 |
|
|
|
|
|
|
|
| 76 |
## Variants
|
| 77 |
|
|
|
|
|
|
|
| 78 |
### v0.2
|
| 79 |
|
| 80 |
Pick **basic** for faithful base-model behavior, or **prompt-upsampled** for
|
| 81 |
improved visual quality from a short prompt.
|
| 82 |
|
| 83 |
+
| File | Steps | Trade-off |
|
| 84 |
+
|---|:---:|---|
|
| 85 |
+
| `p_q_image_2.1_basic_6_steps_v0.2.safetensors` | 6 | **Pure few-step distillation.** Recommended for preserving inputs when editing. |
|
| 86 |
+
| `p_q_image_2.1_upsampled_6_steps_v0.2.safetensors` | 6 | **Improved visual quality.** A first attempt at distilling prompt upsampling into the adapter. |
|
|
|
|
|
|
|
| 87 |
|
| 88 |
**Basic** is a pure 6-step distillation of the base model, without any additional
|
| 89 |
post-training. It is intended as a drop-in replacement for the base model in
|
|
|
|
| 100 |
|
| 101 |
Both adapters are v0.1. Pick one based on whether you need **quality** or **speed**.
|
| 102 |
|
| 103 |
+
| File | Steps | Trade-off |
|
| 104 |
+
|---|:---:|---|
|
| 105 |
+
| `p_q_image_2.1_8step_v0.1.safetensors` | 8 | **Higher quality.** Recommended as the default. |
|
| 106 |
+
| `p_q_image_2.1_5step_v0.1.safetensors` | 5 | **Higher speed**, with noticeably lower visual quality. |
|
|
|
|
|
|
|
| 107 |
|
| 108 |
Each adapter is trained for its own sigma schedule. Load only one at a time.
|
| 109 |
For the v0.2 adapters, do not reuse the v0.1 schedules.
|
|
|
|
| 129 |
|
| 130 |
## Benchmarking
|
| 131 |
|
|
|
|
|
|
|
| 132 |
### v0.2: 6-step LoRA and prompt upsampling
|
| 133 |
|
| 134 |
+
<table>
|
| 135 |
+
<tr>
|
| 136 |
+
<td>
|
| 137 |
+
<img src="assets/Pruna-Q-Image-2.1-v02-generation.png" alt="Six-step generation latency at 1024 and 2048 pixels" width="100%">
|
| 138 |
+
</td>
|
| 139 |
+
</tr>
|
| 140 |
+
<tr>
|
| 141 |
+
<td>
|
| 142 |
+
<img src="assets/Pruna-Q-Image-2.1-prompt-upsampling.png" alt="Prompt-upsampling latency for text and one to three reference images" width="100%">
|
| 143 |
+
</td>
|
| 144 |
+
</tr>
|
| 145 |
+
</table>
|
| 146 |
|
| 147 |
One NVIDIA H100 80GB per worker, BF16, batch size 1. Median of 3 requests after
|
| 148 |
one warmup per configuration, with seed 42. Wall-clock time is measured around
|
|
|
|
| 153 |
No CFG, compilation, CPU offload, or diffusion KV caching.
|
| 154 |
|
| 155 |
Prompt upsampling is measured separately using
|
| 156 |
+
[`Qwen-Image-2.1-PE-T2I`](https://huggingface.co/Qwen/Qwen-Image-2.1-PE-T2I)
|
| 157 |
+
and [`Qwen-Image-2.1-PE-I2I`](https://huggingface.co/Qwen/Qwen-Image-2.1-PE-I2I),
|
| 158 |
with their task-specific sampling settings and thinking enabled. Timing includes
|
| 159 |
request preparation from in-memory images, image and text processing, text
|
| 160 |
generation, and response parsing. It does not include image generation. The
|
|
|
|
| 189 |
### v0.1
|
| 190 |
|
| 191 |
|
| 192 |
+
<table>
|
| 193 |
+
<tr>
|
| 194 |
+
<td width="50%">
|
| 195 |
+
<img src="assets/Pruna-Q-Image-2.1-t2i-1024.png" width="100%">
|
| 196 |
+
</td>
|
| 197 |
+
<td width="50%">
|
| 198 |
+
<img src="assets/Pruna-Q-Image-2.1-t2i-2048.png" width="100%">
|
| 199 |
+
</td>
|
| 200 |
+
</tr>
|
| 201 |
+
<tr>
|
| 202 |
+
<td width="50%">
|
| 203 |
+
<img src="assets/Pruna-Q-Image-2.1-i2i-1024.png" width="100%">
|
| 204 |
+
</td>
|
| 205 |
+
<td width="50%">
|
| 206 |
+
<img src="assets/Pruna-Q-Image-2.1-i2i-2048.png" width="100%">
|
| 207 |
+
</td>
|
| 208 |
+
</tr>
|
| 209 |
+
</table>
|
| 210 |
|
| 211 |
Text-to-image with the official Qwen model-card example prompt, BF16, batch size 1,
|
| 212 |
on one NVIDIA H100 80GB. Median of 3 requests after one warmup per configuration.
|
|
|
|
| 225 |
pip install git+https://github.com/huggingface/diffusers@6256aa7666cedd47443adc8f82da9a10e110b09c
|
| 226 |
```
|
| 227 |
|
|
|
|
|
|
|
| 228 |
### v0.2
|
| 229 |
|
| 230 |
Use this setup for either v0.2 adapter.
|
|
|
|
| 260 |
)
|
| 261 |
```
|
| 262 |
|
| 263 |
+
|
| 264 |
+
Both variants load on **`Qwen/Qwen-Image-2.1`** using **`QwenImage21Pipeline`**.
|
| 265 |
Choose one LoRA with `VARIANT`; the prompt-upsampled variant runs directly on your
|
| 266 |
original prompt without a separate prompt-enhancer model. For a local export,
|
| 267 |
replace `"PrunaAI/Pruna-Q-Image-2.1"` with the folder containing the chosen
|
|
|
|
| 306 |
)
|
| 307 |
```
|
| 308 |
|
|
|
|
|
|
|
| 309 |
## For Text-to-Image
|
| 310 |
|
| 311 |
Longer, more descriptive prompts give better results.
|
|
|
|
| 327 |
).images[0]
|
| 328 |
```
|
| 329 |
|
|
|
|
|
|
|
| 330 |
### For Image Editing
|
| 331 |
|
| 332 |
```python
|
|
|
|
| 341 |
).images[0]
|
| 342 |
```
|
| 343 |
|
|
|
|
|
|
|
| 344 |
### Recommended settings
|
| 345 |
|
| 346 |
For **v0.2**, use the unshifted six-step sigmas
|
|
|
|
| 351 |
The **v0.1** settings are:
|
| 352 |
|
| 353 |
- **Use the sigma schedule that matches your adapter**, and keep the scheduler
|
| 354 |
+
at `shift=1.0` with dynamic shifting off so the sigmas are not shifted twice.
|
| 355 |
- 8-step: `1 β 14/15 β 6/7 β 10/13 β 2/3 β 6/11 β 0.4 β 2/9 β 0`
|
| 356 |
+
(shift 2, computed as `Ο = 2t / (1 + t)` on evenly spaced `t`)
|
| 357 |
- 5-step: `1 β 0.94 β 6/7 β 2/3 β 0.4 β 0`
|
| 358 |
- **No CFG.** Keep `true_cfg_scale=1.0` and do not pass a negative prompt.
|
| 359 |
- **Keep the LoRA strength at 1.0.**
|
| 360 |
- **Write detailed prompts for text-to-image.** Longer prompts that describe
|
| 361 |
+
the subject, setting, lighting, and style work noticeably better than short
|
| 362 |
+
ones.
|
|
|
|
|
|
|
| 363 |
|
| 364 |
## Limitations
|
| 365 |
|
|
|
|
|
|
|
| 366 |
### v0.2
|
| 367 |
|
| 368 |
- The prompt-upsampled adapter is a first attempt. It can improve visual quality,
|
| 369 |
+
but may not exactly reproduce the output of the actual prompt upsampler.
|
| 370 |
- Basic is intended to preserve the base model's behavior in fewer steps;
|
| 371 |
+
distillation does not guarantee identical outputs.
|
| 372 |
- Use the step count and sigma schedule that match your v0.2 adapter. Other step
|
| 373 |
+
counts, schedules, or CFG values are not supported.
|
|
|
|
|
|
|
| 374 |
|
| 375 |
### v0.1
|
| 376 |
|
| 377 |
- This is a first version. Quality is below that of the base model.
|
| 378 |
- The 5-step adapter is faster than the 8-step one, but its images are
|
| 379 |
+
visibly worse.
|
| 380 |
- Short or vague text-to-image prompts give weaker results.
|
| 381 |
- The adapters are only intended for the settings above. Other step counts,
|
| 382 |
+
schedules, or CFG values are not supported.
|
|
|
|
|
|
|
| 383 |
|
| 384 |
## What this is not
|
| 385 |
|
|
|
|
| 387 |
- Not a replacement for the base model when you need its full quality.
|
| 388 |
- Not a finished release. Expect the weights to change in future versions.
|
| 389 |
|
|
|
|
|
|
|
| 390 |
## License
|
| 391 |
|
| 392 |
The end distilled model is based on Qwen-Image-2.1.
|
|
|
|
| 404 |
- Compress your own models with [Pruna](https://github.com/PrunaAI/pruna) and give us a βοΈ for more efficiency!
|
| 405 |
- Want to use our optimized image models right away? Check [P-Image-Ideogram](https://www.pruna.ai/p-image-ideogram) and [P-Image-Edit](https://www.pruna.ai/p-image-edit).
|
| 406 |
|
| 407 |
+
<style>
|
| 408 |
+
.model-button {
|
| 409 |
+
display: inline-flex;
|
| 410 |
+
flex-direction: row;
|
| 411 |
+
justify-content: center;
|
| 412 |
+
align-items: center;
|
| 413 |
+
gap: 8px;
|
| 414 |
+
|
| 415 |
+
padding: 8px 20px;
|
| 416 |
+
border: none;
|
| 417 |
+
border-radius: 8px;
|
| 418 |
+
|
| 419 |
+
background: #9334e9;
|
| 420 |
+
color: #ffffff;
|
| 421 |
+
|
| 422 |
+
font-size: 14px;
|
| 423 |
+
font-weight: 400;
|
| 424 |
+
line-height: 1;
|
| 425 |
+
text-decoration: none;
|
| 426 |
+
white-space: nowrap;
|
| 427 |
+
cursor: pointer;
|
| 428 |
+
|
| 429 |
+
box-sizing: border-box;
|
| 430 |
+
overflow: visible;
|
| 431 |
+
opacity: 1;
|
| 432 |
+
}
|
| 433 |
+
</style>
|
| 434 |
+
|
| 435 |
+
<a href="https://dashboard.pruna.ai/login?utm_source=huggingface&utm_medium=model_card&utm_campaign=hf_traffic" class="model-button">Try our models</a>
|