feat: conditionally apply guidance_scale=1.0 when Turbo LoRA is loaded in ref2va_step3.py

This commit is contained in:
2026-10-19 14:43:33 +08:00
parent 69f42fb5e2
commit c6bdb88bd2
+4 -1
View File
@@ -238,11 +238,13 @@ def main():
first_task = TASK_REGISTRY[first_idx] if first_idx is not None else None first_task = TASK_REGISTRY[first_idx] if first_idx is not None else None
effective_steps = first_task.num_inference_steps if first_task and first_task.num_inference_steps is not None else RUN_CONFIG.get("default_num_inference_steps", 8) effective_steps = first_task.num_inference_steps if first_task and first_task.num_inference_steps is not None else RUN_CONFIG.get("default_num_inference_steps", 8)
use_turbo_guidance = False
if effective_steps <= 23: if effective_steps <= 23:
lora_path = os.path.join(MODELS_DIR, "loras/minimax_h3_turbo_v4_step600_ema.safetensors") lora_path = os.path.join(MODELS_DIR, "loras/minimax_h3_turbo_v4_step600_ema.safetensors")
if os.path.exists(lora_path): if os.path.exists(lora_path):
print(f">> [LoRA] 檢測到步驟 {effective_steps} <= 23, 載入 Turbo LoRA: {os.path.basename(lora_path)}") print(f">> [LoRA] 檢測到步驟 {effective_steps} <= 23, 載入 Turbo LoRA: {os.path.basename(lora_path)}")
pipe.load_lora(pipe.dit, lora_config=lora_path, alpha=1.0, verbose=1) pipe.load_lora(pipe.dit, lora_config=lora_path, alpha=1.0, verbose=1)
use_turbo_guidance = True
else: else:
print(f">> [Warning] LoRA 檔案不存在: {lora_path}") print(f">> [Warning] LoRA 檔案不存在: {lora_path}")
else: else:
@@ -322,6 +324,7 @@ def main():
num_frames=task.num_frames, num_frames=task.num_frames,
num_inference_steps=steps, num_inference_steps=steps,
seed=seed, seed=seed,
**({'guidance_scale': 1.0} if use_turbo_guidance else {}),
) )
# --- 任務完成:抓取本次任務的 VRAM 峰值 --- # --- 任務完成:抓取本次任務的 VRAM 峰值 ---
@@ -365,4 +368,4 @@ def main():
print(f"\n========== [REF2VA STAGE 3] 全部任務完成 ==========") print(f"\n========== [REF2VA STAGE 3] 全部任務完成 ==========")
if __name__ == "__main__": if __name__ == "__main__":
main() main()