primerz commited on
Commit
62e516c
·
verified ·
1 Parent(s): a73720d

Update generator.py

Browse files
Files changed (1) hide show
  1. generator.py +4 -3
generator.py CHANGED
@@ -66,6 +66,7 @@ class Generator:
66
 
67
  # 5. Logic for Face vs No-Face (NOW INCLUDES KPS)
68
  # ControlNet order: [InstantID_KPS, Zoe_Depth, LineArt]
 
69
  if face_info is not None:
70
  print("Face detected: Applying InstantID with keypoints.")
71
 
@@ -82,17 +83,17 @@ class Generator:
82
  # Create keypoint image
83
  face_kps = draw_kps(processed_image, face_info['kps'])
84
  face_guidance = (depth_strength + lineart_strength) / 2
85
- face_kps_guidance_end = face_guidance / 1.5
86
 
87
  # Set strengths (using 0.8 from file's example)
88
  controlnet_conditioning_scale = [face_guidance, depth_strength, lineart_strength]
89
- self.mh.pipeline.set_ip_adapter_scale(0.0)
90
  else:
91
  print("No face detected: Disabling InstantID.")
92
  # Create dummy embedding
93
  face_emb = torch.zeros((1, 512), dtype=Config.DTYPE, device=Config.DEVICE)
94
  # Create dummy keypoint image (black)
95
  face_kps = Image.new('RGB', (target_width, target_height), (0, 0, 0))
 
96
  face_kps_guidance_end = 0.001
97
 
98
  # Set strengths
@@ -100,7 +101,7 @@ class Generator:
100
  self.mh.pipeline.set_ip_adapter_scale(0.0)
101
 
102
  # We keep the guidance_end for pose low
103
- control_guidance_end = [face_kps_guidance_end, depth_strength/1.5, lineart_strength/1.5]
104
 
105
  # --- Seed/Generator Logic ---
106
  if seed == -1 or seed is None:
 
66
 
67
  # 5. Logic for Face vs No-Face (NOW INCLUDES KPS)
68
  # ControlNet order: [InstantID_KPS, Zoe_Depth, LineArt]
69
+
70
  if face_info is not None:
71
  print("Face detected: Applying InstantID with keypoints.")
72
 
 
83
  # Create keypoint image
84
  face_kps = draw_kps(processed_image, face_info['kps'])
85
  face_guidance = (depth_strength + lineart_strength) / 2
 
86
 
87
  # Set strengths (using 0.8 from file's example)
88
  controlnet_conditioning_scale = [face_guidance, depth_strength, lineart_strength]
89
+ self.mh.pipeline.set_ip_adapter_scale(face_guidance / 1.75)
90
  else:
91
  print("No face detected: Disabling InstantID.")
92
  # Create dummy embedding
93
  face_emb = torch.zeros((1, 512), dtype=Config.DTYPE, device=Config.DEVICE)
94
  # Create dummy keypoint image (black)
95
  face_kps = Image.new('RGB', (target_width, target_height), (0, 0, 0))
96
+ face_guidance = 0.001
97
  face_kps_guidance_end = 0.001
98
 
99
  # Set strengths
 
101
  self.mh.pipeline.set_ip_adapter_scale(0.0)
102
 
103
  # We keep the guidance_end for pose low
104
+ control_guidance_end = [face_guidance / 1.25, depth_strength/1.5, lineart_strength/1.5]
105
 
106
  # --- Seed/Generator Logic ---
107
  if seed == -1 or seed is None: