Spaces:
Running
on
Zero
Running
on
Zero
Update generator.py
Browse files- generator.py +9 -9
generator.py
CHANGED
|
@@ -56,13 +56,13 @@ class Generator:
|
|
| 56 |
# ControlNet order: [InstantID, Zoe, LineArt]
|
| 57 |
if face_emb is not None:
|
| 58 |
print("Face detected: Applying InstantID.")
|
| 59 |
-
controlnet_conditioning_scale = [0.
|
| 60 |
-
control_guidance_end = [0.
|
| 61 |
-
self.mh.pipeline.set_ip_adapter_scale(0.
|
| 62 |
else:
|
| 63 |
print("No face detected: Disabling InstantID.")
|
| 64 |
-
controlnet_conditioning_scale = [0.0, 0.
|
| 65 |
-
control_guidance_end = [0.
|
| 66 |
self.mh.pipeline.set_ip_adapter_scale(0.0)
|
| 67 |
|
| 68 |
# --- START FIX for NoneType Error ---
|
|
@@ -79,15 +79,15 @@ class Generator:
|
|
| 79 |
control_image=[processed_image, depth_map, lineart_map], # ControlNet inputs
|
| 80 |
image_embeds=face_emb, # Face embedding (or dummy)
|
| 81 |
|
| 82 |
-
strength=0.
|
| 83 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
| 84 |
control_guidance_end=control_guidance_end,
|
| 85 |
|
| 86 |
# LCM settings
|
| 87 |
-
num_inference_steps=
|
| 88 |
-
guidance_scale=
|
| 89 |
|
| 90 |
-
clip_skip=
|
| 91 |
|
| 92 |
# --- LoRA Strength ---
|
| 93 |
cross_attention_kwargs={"scale": 1.25}
|
|
|
|
| 56 |
# ControlNet order: [InstantID, Zoe, LineArt]
|
| 57 |
if face_emb is not None:
|
| 58 |
print("Face detected: Applying InstantID.")
|
| 59 |
+
controlnet_conditioning_scale = [0.6, 0.3, 0.3]
|
| 60 |
+
control_guidance_end = [0.3, 0.6, 0.6] # Stop InstantID early
|
| 61 |
+
self.mh.pipeline.set_ip_adapter_scale(0.6) # Set IP-Adapter (likeness) strength
|
| 62 |
else:
|
| 63 |
print("No face detected: Disabling InstantID.")
|
| 64 |
+
controlnet_conditioning_scale = [0.0, 0.3, 0.3] # Disable InstantID weight
|
| 65 |
+
control_guidance_end = [0.3, 0.6, 0.6]
|
| 66 |
self.mh.pipeline.set_ip_adapter_scale(0.0)
|
| 67 |
|
| 68 |
# --- START FIX for NoneType Error ---
|
|
|
|
| 79 |
control_image=[processed_image, depth_map, lineart_map], # ControlNet inputs
|
| 80 |
image_embeds=face_emb, # Face embedding (or dummy)
|
| 81 |
|
| 82 |
+
strength=0.3, # <-- Img2Img strength
|
| 83 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
| 84 |
control_guidance_end=control_guidance_end,
|
| 85 |
|
| 86 |
# LCM settings
|
| 87 |
+
num_inference_steps=6,
|
| 88 |
+
guidance_scale=1.5, # <-- CFG Scale
|
| 89 |
|
| 90 |
+
clip_skip=2,
|
| 91 |
|
| 92 |
# --- LoRA Strength ---
|
| 93 |
cross_attention_kwargs={"scale": 1.25}
|