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
fix: redo timings with kv caching enabled + add end-to-end plots
Browse files
README.md
CHANGED
|
@@ -70,6 +70,17 @@ model, so the pipeline, text encoder, and VAE stay unchanged.
|
|
| 70 |
> - The first distillation removing need for prompt upsampling into the LoRA, thus significantly reducing end-to-end generation.
|
| 71 |
> The v0.1 adapters remain available.
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
## 6-step variants
|
| 74 |
|
| 75 |
Pick **6-steps** for faithful base-model behavior, or **6-steps-upsampled** for
|
|
@@ -220,11 +231,6 @@ pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
|
|
| 220 |
|
| 221 |
|
| 222 |
<table>
|
| 223 |
-
<tr>
|
| 224 |
-
<td>
|
| 225 |
-
<img src="assets/P-Q-Image-2.1-t2i-1024-all.png" alt="Text-to-image generation latency at 1024 pixels across base, 8-step, 6-step, 6-step-upsampled, and 5-step adapters" width="100%">
|
| 226 |
-
</td>
|
| 227 |
-
</tr>
|
| 228 |
<tr>
|
| 229 |
<td>
|
| 230 |
<img src="assets/P-Q-Image-2.1-v02-generation.png" alt="Six-step generation latency at 1024 and 2048 pixels" width="100%">
|
|
@@ -237,10 +243,17 @@ pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
|
|
| 237 |
</tr>
|
| 238 |
</table>
|
| 239 |
|
| 240 |
-
One NVIDIA H100 80GB, BF16, batch size 1.
|
|
|
|
|
|
|
| 241 |
Generation includes prompt encoding, reference-image processing, denoising, and
|
| 242 |
VAE decode. It excludes loading, warmup, fixture prep, saving, and network.
|
| 243 |
-
No CFG, compilation, CPU offload
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
Prompt upsampling is timed separately with
|
| 246 |
[`Qwen-Image-2.1-PE-T2I`](https://huggingface.co/Qwen/Qwen-Image-2.1-PE-T2I)
|
|
@@ -249,7 +262,7 @@ It covers request prep through parsed text, not image generation. vLLM runs
|
|
| 249 |
eager, without prefix or image-processor caching, and with a fresh image ID so
|
| 250 |
vision encoding is always counted. Autoregressive KV cache stays on.
|
| 251 |
|
| 252 |
-
Text-to-image uses
|
| 253 |
prompt and 1–3 reference images, square-cropped and resized. These cases are
|
| 254 |
not matched to the v0.1 charts, and adding the two medians is not an
|
| 255 |
end-to-end time.
|
|
|
|
| 70 |
> - The first distillation removing need for prompt upsampling into the LoRA, thus significantly reducing end-to-end generation.
|
| 71 |
> The v0.1 adapters remain available.
|
| 72 |
|
| 73 |
+
<table>
|
| 74 |
+
<tr>
|
| 75 |
+
<td width="50%">
|
| 76 |
+
<img src="assets/P-Q-Image-2.1-t2i-1024-end-to-end.png" alt="Estimated end-to-end text-to-image latency at 1024 × 1024" width="100%">
|
| 77 |
+
</td>
|
| 78 |
+
<td width="50%">
|
| 79 |
+
<img src="assets/P-Q-Image-2.1-i2i-1024-end-to-end.png" alt="Estimated end-to-end editing latency at 1024 × 1024 with one input image" width="100%">
|
| 80 |
+
</td>
|
| 81 |
+
</tr>
|
| 82 |
+
</table>
|
| 83 |
+
|
| 84 |
## 6-step variants
|
| 85 |
|
| 86 |
Pick **6-steps** for faithful base-model behavior, or **6-steps-upsampled** for
|
|
|
|
| 231 |
|
| 232 |
|
| 233 |
<table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
<tr>
|
| 235 |
<td>
|
| 236 |
<img src="assets/P-Q-Image-2.1-v02-generation.png" alt="Six-step generation latency at 1024 and 2048 pixels" width="100%">
|
|
|
|
| 243 |
</tr>
|
| 244 |
</table>
|
| 245 |
|
| 246 |
+
One NVIDIA H100 80GB, BF16, batch size 1. v0.2 generation timings
|
| 247 |
+
report the median of six measured requests pooled across both adapters (three
|
| 248 |
+
per adapter), excluding one warmup per adapter and case.
|
| 249 |
Generation includes prompt encoding, reference-image processing, denoising, and
|
| 250 |
VAE decode. It excludes loading, warmup, fixture prep, saving, and network.
|
| 251 |
+
No CFG, compilation, or CPU offload. **Diffusion KV caching is enabled**, except
|
| 252 |
+
for the case marked with an asterisk below.
|
| 253 |
+
|
| 254 |
+
\* **2048 × 2048 editing with 3 input images:** KV caching was disabled due to
|
| 255 |
+
memory constraints on the H100 80GB. The 2048 multi-image cases use expandable
|
| 256 |
+
CUDA memory segments (`PYTORCH_ALLOC_CONF=expandable_segments:True`).
|
| 257 |
|
| 258 |
Prompt upsampling is timed separately with
|
| 259 |
[`Qwen-Image-2.1-PE-T2I`](https://huggingface.co/Qwen/Qwen-Image-2.1-PE-T2I)
|
|
|
|
| 262 |
eager, without prefix or image-processor caching, and with a fresh image ID so
|
| 263 |
vision encoding is always counted. Autoregressive KV cache stays on.
|
| 264 |
|
| 265 |
+
Text-to-image uses a fixed neon-sign prompt. Editing uses a fixed
|
| 266 |
prompt and 1–3 reference images, square-cropped and resized. These cases are
|
| 267 |
not matched to the v0.1 charts, and adding the two medians is not an
|
| 268 |
end-to-end time.
|
assets/P-Q-Image-2.1-i2i-1024-end-to-end.png
ADDED
|
Git LFS Details
|
assets/P-Q-Image-2.1-t2i-1024-all.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/P-Q-Image-2.1-t2i-1024-end-to-end.png
ADDED
|
Git LFS Details
|
assets/P-Q-Image-2.1-v02-generation.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|