Ivaylo77 commited on
Commit
3645c0c
·
verified ·
1 Parent(s): dc54d5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -17
app.py CHANGED
@@ -221,28 +221,20 @@ label, .gr-box label {
221
  border-bottom-style: solid;
222
  }
223
  """
224
- base_model_id = "Tongyi-MAI/Z-Image-Turbo"
225
-
226
  # Load the pipeline once at startup
227
  print("Loading Z-Image-Turbo pipeline...")
228
- #import torch
229
- from diffusers.models import ZImageTransformer2DModel
230
- from huggingface_hub import hf_hub_download
231
-
232
- model = ZImageTransformer2DModel.from_single_file(
233
- hf_hub_download(
234
- "xiaopeng/Z-IMAGE-Update", "zImageTurbo_40BF16AIO.safetensors"
235
- ),
236
  torch_dtype=torch.bfloat16,
 
237
  )
 
238
 
239
- # Build the Turbo pipeline once with our custom transformer weights.
240
- pipe = ZImagePipeline.from_pretrained(
241
- base_model_id,
242
- torch_dtype=torch.bfloat16,
243
- transformer=model,
244
- )
245
- pipe = pipe.to("cuda")
246
 
247
  @spaces.GPU
248
  def generate_image(
 
221
  border-bottom-style: solid;
222
  }
223
  """
 
 
224
  # Load the pipeline once at startup
225
  print("Loading Z-Image-Turbo pipeline...")
226
+ pipe = DiffusionPipeline.from_pretrained(
227
+ "Tongyi-MAI/Z-Image-Turbo",
 
 
 
 
 
 
228
  torch_dtype=torch.bfloat16,
229
+ low_cpu_mem_usage=False,
230
  )
231
+ pipe.to("cuda")
232
 
233
+ # ======== AoTI compilation + FA3 ========
234
+ # pipe.transformer.layers._repeated_blocks = ["ZImageTransformerBlock"]
235
+ # spaces.aoti_blocks_load(pipe.transformer.layers, "zerogpu-aoti/Z-Image", variant="fa3")
236
+
237
+ print("Pipeline loaded!")
 
 
238
 
239
  @spaces.GPU
240
  def generate_image(