Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -191,9 +191,10 @@ def generate_video(
|
|
| 191 |
print(f"激活 High Noise LoRA: {self.high_noise_adapters}")
|
| 192 |
pipe.set_adapters(self.high_noise_adapters, adapter_weights=[1.0] * len(self.high_noise_adapters))
|
| 193 |
# 如果用户没有选择 LoRA,则通过将权重设为0来禁用任何可能残留的 LoRA
|
| 194 |
-
elif pipe.
|
| 195 |
-
|
| 196 |
-
|
|
|
|
| 197 |
|
| 198 |
# 在切换点,切换到 Low Noise LoRA(仅当有 LoRA 被选择时)
|
| 199 |
if self.low_noise_adapters and step_index >= switch_step and not self.switched:
|
|
@@ -201,7 +202,6 @@ def generate_video(
|
|
| 201 |
pipe.set_adapters(self.low_noise_adapters, adapter_weights=[1.0] * len(self.low_noise_adapters))
|
| 202 |
self.switched = True
|
| 203 |
return callback_kwargs
|
| 204 |
-
# --- 修改结束 ---
|
| 205 |
|
| 206 |
lora_switcher_callback = LoraSwitcher(selected_loras)
|
| 207 |
|
|
|
|
| 191 |
print(f"激活 High Noise LoRA: {self.high_noise_adapters}")
|
| 192 |
pipe.set_adapters(self.high_noise_adapters, adapter_weights=[1.0] * len(self.high_noise_adapters))
|
| 193 |
# 如果用户没有选择 LoRA,则通过将权重设为0来禁用任何可能残留的 LoRA
|
| 194 |
+
elif pipe.get_active_adapters():
|
| 195 |
+
active_adapters = pipe.get_active_adapters()
|
| 196 |
+
print(f"未选择 LoRA,通过设置权重为0来禁用残留的 LoRA: {active_adapters}")
|
| 197 |
+
pipe.set_adapters(active_adapters, adapter_weights=[0.0] * len(active_adapters))
|
| 198 |
|
| 199 |
# 在切换点,切换到 Low Noise LoRA(仅当有 LoRA 被选择时)
|
| 200 |
if self.low_noise_adapters and step_index >= switch_step and not self.switched:
|
|
|
|
| 202 |
pipe.set_adapters(self.low_noise_adapters, adapter_weights=[1.0] * len(self.low_noise_adapters))
|
| 203 |
self.switched = True
|
| 204 |
return callback_kwargs
|
|
|
|
| 205 |
|
| 206 |
lora_switcher_callback = LoraSwitcher(selected_loras)
|
| 207 |
|