primerz commited on
Commit
70d7108
·
verified ·
1 Parent(s): 1c48047

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +10 -2
models.py CHANGED
@@ -152,7 +152,7 @@ def load_controlnets():
152
  """Load ControlNet models."""
153
  print("Loading ControlNet Zoe Depth model...")
154
  controlnet_depth = ControlNetModel.from_pretrained(
155
- "diffusers/controlnet-zoe-depth-sdxl-1.0",
156
  torch_dtype=dtype
157
  ).to(device)
158
  print(" [OK] ControlNet Depth loaded")
@@ -161,7 +161,7 @@ def load_controlnets():
161
  print("Loading ControlNet OpenPose model...")
162
  try:
163
  controlnet_openpose = ControlNetModel.from_pretrained(
164
- "diffusers/controlnet-openpose-sdxl-1.0",
165
  torch_dtype=dtype
166
  ).to(device)
167
  print(" [OK] ControlNet OpenPose loaded")
@@ -399,6 +399,14 @@ def setup_scheduler(pipe):
399
  def optimize_pipeline(pipe):
400
  """Apply optimizations to pipeline."""
401
 
 
 
 
 
 
 
 
 
402
  # Enable CPU offloading for VRAM-constrained environments
403
  print(" [OK] Enabling model CPU offloading...")
404
  pipe.enable_model_cpu_offload()
 
152
  """Load ControlNet models."""
153
  print("Loading ControlNet Zoe Depth model...")
154
  controlnet_depth = ControlNetModel.from_pretrained(
155
+ "thibaud/controlnet-openpose-sdxl-1.0",
156
  torch_dtype=dtype
157
  ).to(device)
158
  print(" [OK] ControlNet Depth loaded")
 
161
  print("Loading ControlNet OpenPose model...")
162
  try:
163
  controlnet_openpose = ControlNetModel.from_pretrained(
164
+ "thibaud/controlnet-openpose-sdxl-1.0",
165
  torch_dtype=dtype
166
  ).to(device)
167
  print(" [OK] ControlNet OpenPose loaded")
 
399
  def optimize_pipeline(pipe):
400
  """Apply optimizations to pipeline."""
401
 
402
+ # Try to enable xformers
403
+ if device == "cuda":
404
+ try:
405
+ pipe.enable_xformers_memory_efficient_attention()
406
+ print(" [OK] xformers enabled")
407
+ except Exception as e:
408
+ print(f" [INFO] xformers not available: {e}")
409
+
410
  # Enable CPU offloading for VRAM-constrained environments
411
  print(" [OK] Enabling model CPU offloading...")
412
  pipe.enable_model_cpu_offload()