Spaces:
Running on Zero
Running on Zero
Fix ZeroGPU 90-second timeout by avoiding root-level packing. Move pipe to GPU dynamically inside the worker for fast generation.
Browse files
app.py
CHANGED
|
@@ -116,8 +116,9 @@ gc.collect()
|
|
| 116 |
pipe = QwenImageEditPlusPipeline.from_pretrained(
|
| 117 |
"Qwen/Qwen-Image-Edit-2511",
|
| 118 |
transformer=transformer,
|
| 119 |
-
torch_dtype=dtype
|
| 120 |
-
|
|
|
|
| 121 |
|
| 122 |
# Load next-scene LoRA for cinematic progression
|
| 123 |
# Note: This LoRA was trained on 2509, may need testing with 2511/v18
|
|
@@ -237,18 +238,22 @@ def infer(
|
|
| 237 |
print(f"Negative Prompt: '{negative_prompt}'")
|
| 238 |
print(f"Seed: {seed}, Steps: {num_inference_steps}, Guidance: {true_guidance_scale}, Size: {width}x{height}")
|
| 239 |
|
| 240 |
-
# Generate the image
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
# Anonymous diagnostics — fire-and-forget, must not block or fail generation.
|
| 254 |
try:
|
|
|
|
| 116 |
pipe = QwenImageEditPlusPipeline.from_pretrained(
|
| 117 |
"Qwen/Qwen-Image-Edit-2511",
|
| 118 |
transformer=transformer,
|
| 119 |
+
torch_dtype=dtype,
|
| 120 |
+
ignore_patterns=["transformer/*"]
|
| 121 |
+
)
|
| 122 |
|
| 123 |
# Load next-scene LoRA for cinematic progression
|
| 124 |
# Note: This LoRA was trained on 2509, may need testing with 2511/v18
|
|
|
|
| 238 |
print(f"Negative Prompt: '{negative_prompt}'")
|
| 239 |
print(f"Seed: {seed}, Steps: {num_inference_steps}, Guidance: {true_guidance_scale}, Size: {width}x{height}")
|
| 240 |
|
| 241 |
+
# Generate the image (move to GPU dynamically to avoid packing timeout at startup)
|
| 242 |
+
try:
|
| 243 |
+
pipe.to(device)
|
| 244 |
+
images_pil = pipe(
|
| 245 |
+
image=pil_images if len(pil_images) > 0 else None,
|
| 246 |
+
prompt=prompt,
|
| 247 |
+
height=height,
|
| 248 |
+
width=width,
|
| 249 |
+
negative_prompt=negative_prompt,
|
| 250 |
+
num_inference_steps=num_inference_steps,
|
| 251 |
+
generator=generator,
|
| 252 |
+
true_cfg_scale=true_guidance_scale,
|
| 253 |
+
num_images_per_prompt=num_images_per_prompt,
|
| 254 |
+
).images
|
| 255 |
+
finally:
|
| 256 |
+
pipe.to("cpu")
|
| 257 |
|
| 258 |
# Anonymous diagnostics — fire-and-forget, must not block or fail generation.
|
| 259 |
try:
|