rahul7star commited on
Commit
5726602
·
verified ·
1 Parent(s): 5fbd371

Update app_lora1.py

Browse files
Files changed (1) hide show
  1. app_lora1.py +45 -1
app_lora1.py CHANGED
@@ -35,6 +35,49 @@ def log(msg):
35
  log_buffer.write(msg + "\n")
36
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  def pipeline_debug_info(pipe):
39
  return f"""
40
  Pipeline Info
@@ -155,7 +198,8 @@ def generate_image(
155
  # ✅ Correct, universal, ZeroGPU-safe
156
  if not hasattr(pipe, "hf_device_map"):
157
  pipe = pipe.to("cuda")
158
-
 
159
 
160
 
161
  log("=== NEW GENERATION REQUEST ===")
 
35
  log_buffer.write(msg + "\n")
36
 
37
 
38
+ def pipeline_technology_info(pipe):
39
+ tech = []
40
+
41
+ # Device map
42
+ if hasattr(pipe, "hf_device_map"):
43
+ tech.append("Device map: enabled")
44
+ else:
45
+ tech.append(f"Device: {pipe.device}")
46
+
47
+ # Transformer dtype
48
+ if hasattr(pipe, "transformer"):
49
+ try:
50
+ tech.append(f"Transformer dtype: {pipe.transformer.dtype}")
51
+ except Exception:
52
+ pass
53
+
54
+ # Layerwise casting (Z-Image specific)
55
+ if hasattr(pipe.transformer, "layerwise_casting"):
56
+ lw = pipe.transformer.layerwise_casting
57
+ tech.append(
58
+ f"Layerwise casting: storage={lw.storage_dtype}, "
59
+ f"compute={lw.compute_dtype}"
60
+ )
61
+
62
+ # VAE dtype
63
+ if hasattr(pipe, "vae"):
64
+ try:
65
+ tech.append(f"VAE dtype: {pipe.vae.dtype}")
66
+ except Exception:
67
+ pass
68
+
69
+ # GGUF / quantization
70
+ if hasattr(pipe, "quantization_config"):
71
+ tech.append(f"Quantization: {pipe.quantization_config}")
72
+
73
+ # Attention backend
74
+ if hasattr(pipe, "config"):
75
+ attn = pipe.config.get("attn_implementation", None)
76
+ if attn:
77
+ tech.append(f"Attention: {attn}")
78
+
79
+ return "\n".join(f"• {t}" for t in tech)
80
+
81
  def pipeline_debug_info(pipe):
82
  return f"""
83
  Pipeline Info
 
198
  # ✅ Correct, universal, ZeroGPU-safe
199
  if not hasattr(pipe, "hf_device_map"):
200
  pipe = pipe.to("cuda")
201
+ log("=== PIPELINE TECHNOLOGY ===")
202
+ log(pipeline_technology_info(pipe))
203
 
204
 
205
  log("=== NEW GENERATION REQUEST ===")