Refactor: add skip-all checks, fix PIL image loading and cfg_scale parameter, and enable xformers attention
This commit is contained in:
+12
-1
@@ -24,6 +24,7 @@ os.environ["HSA_OVERRIDE_GFX_VERSION"] = "11.0.0"
|
||||
os.environ["PYTHONNOUSERSITE"] = "1"
|
||||
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "garbage_collection_threshold:0.8"
|
||||
os.environ["DIFFSYNTH_SKIP_DOWNLOAD"] = "True"
|
||||
os.environ["DIFFSYNTH_ATTENTION_IMPLEMENTATION"] = "xformers"
|
||||
|
||||
import torch
|
||||
# 強制啟用 PyTorch ROCm 的記憶體高效與 Flash 注意力後端
|
||||
@@ -196,6 +197,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 +335,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 峰值 ---
|
||||
|
||||
Reference in New Issue
Block a user