Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ import math
|
|
14 |
from optimization import optimize_pipeline_
|
15 |
from qwenimage.pipeline_qwen_image_edit import QwenImageEditPipeline
|
16 |
from qwenimage.transformer_qwenimage import QwenImageTransformer2DModel
|
|
|
17 |
|
18 |
# --- Prompt Enhancement using Hugging Face InferenceClient ---
|
19 |
def polish_prompt_hf(original_prompt, system_prompt):
|
@@ -164,6 +165,7 @@ scheduler = FlowMatchEulerDiscreteScheduler.from_config(scheduler_config)
|
|
164 |
|
165 |
pipe = QwenImageEditPipeline.from_pretrained("Qwen/Qwen-Image-Edit", scheduler=scheduler,torch_dtype=dtype).to(device)
|
166 |
pipe.transformer.__class__ = QwenImageTransformer2DModel
|
|
|
167 |
|
168 |
# --- Ahead-of-time compilation ---
|
169 |
optimize_pipeline_(pipe, image=Image.new("RGB", (1024, 1024)), prompt="prompt")
|
|
|
14 |
from optimization import optimize_pipeline_
|
15 |
from qwenimage.pipeline_qwen_image_edit import QwenImageEditPipeline
|
16 |
from qwenimage.transformer_qwenimage import QwenImageTransformer2DModel
|
17 |
+
from qwenimage.qwen_fa3_processor import QwenDoubleStreamAttnProcessorFA3
|
18 |
|
19 |
# --- Prompt Enhancement using Hugging Face InferenceClient ---
|
20 |
def polish_prompt_hf(original_prompt, system_prompt):
|
|
|
165 |
|
166 |
pipe = QwenImageEditPipeline.from_pretrained("Qwen/Qwen-Image-Edit", scheduler=scheduler,torch_dtype=dtype).to(device)
|
167 |
pipe.transformer.__class__ = QwenImageTransformer2DModel
|
168 |
+
pipe.transformer.set_attn_processor(QwenDoubleStreamAttnProcessorFA3())
|
169 |
|
170 |
# --- Ahead-of-time compilation ---
|
171 |
optimize_pipeline_(pipe, image=Image.new("RGB", (1024, 1024)), prompt="prompt")
|