rahul7star commited on
Commit
7f83fac
·
verified ·
1 Parent(s): ae07155

Update app_quant_latent1.py

Browse files
Files changed (1) hide show
  1. app_quant_latent1.py +48 -0
app_quant_latent1.py CHANGED
@@ -253,7 +253,55 @@ import torch
253
 
254
 
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
 
 
257
 
258
 
259
 
 
253
 
254
 
255
 
256
+ def safe_generate_with_latents(
257
+ transformer,
258
+ vae,
259
+ text_encoder,
260
+ tokenizer,
261
+ scheduler,
262
+ pipe,
263
+ prompt,
264
+ height,
265
+ width,
266
+ steps,
267
+ guidance_scale,
268
+ negative_prompt,
269
+ num_images_per_prompt,
270
+ generator,
271
+ cfg_normalization,
272
+ cfg_truncation,
273
+ max_sequence_length,
274
+ ):
275
+ """
276
+ Runs your original latent generator.
277
+ ANY error → returns None and logs it.
278
+ """
279
+ try:
280
+ # --- Your ORIGINAL generate() code pasted here EXACTLY ---
281
+ latents_or_images = generate(
282
+ transformer=transformer,
283
+ vae=vae,
284
+ text_encoder=text_encoder,
285
+ tokenizer=tokenizer,
286
+ scheduler=scheduler,
287
+ prompt=prompt,
288
+ height=height,
289
+ width=width,
290
+ num_inference_steps=steps,
291
+ guidance_scale=guidance_scale,
292
+ negative_prompt=negative_prompt,
293
+ num_images_per_prompt=num_images_per_prompt,
294
+ generator=generator,
295
+ cfg_normalization=cfg_normalization,
296
+ cfg_truncation=cfg_truncation,
297
+ max_sequence_length=max_sequence_length,
298
+ output_type="latent", # IMPORTANT
299
+ )
300
+
301
+ return latents_or_images, None
302
 
303
+ except Exception as e:
304
+ return None, e
305
 
306
 
307