Refactor: add skip-all checks, fix PIL image loading and cfg_scale parameter, and enable xformers attention

This commit is contained in:
2026-11-22 13:21:46 +08:00
parent c6bdb88bd2
commit 7dee33e334
5 changed files with 43 additions and 5 deletions
+12 -2
View File
@@ -196,6 +196,16 @@ def main():
print(f">> [Error] Task {idx} 缺少前置 pt 檔案。")
sys.exit(1)
# 檢查所有 result3_video/audio_*.pt 是否已存在,若全部存在則跳過整個 Step 3
all_latents_exist = all(
os.path.exists(f"result3_video_{idx:02d}.pt") and os.path.exists(f"result3_audio_{idx:02d}.pt")
for idx in enabled_ids
)
if all_latents_exist:
print(">> [SKIP] 所有 result3_video/audio_*.pt 已存在,跳過 Step 3。")
print(f"\n========== [REF2VA STAGE 3] 完成 {len(enabled_ids)}/{len(enabled_ids)} 個任務 (全部跳過) ==========")
return
torch.cuda.empty_cache()
gc.collect()
@@ -324,7 +334,7 @@ def main():
num_frames=task.num_frames,
num_inference_steps=steps,
seed=seed,
**({'guidance_scale': 1.0} if use_turbo_guidance else {}),
**({'cfg_scale': 1.0} if use_turbo_guidance else {}),
)
# --- 任務完成:抓取本次任務的 VRAM 峰值 ---
@@ -368,4 +378,4 @@ def main():
print(f"\n========== [REF2VA STAGE 3] 全部任務完成 ==========")
if __name__ == "__main__":
main()
main()