Skip to content

Commit

Permalink
fix: bug #124 (#133)
Browse files Browse the repository at this point in the history
add temp unet in log validation
add face emb validation in extract meta info function
  • Loading branch information
xumingw authored Jul 4, 2024
1 parent c1ce01f commit 83dd4eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/extract_meta_info_stage1.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import os
from pathlib import Path

import torch


def collect_video_folder_paths(root_path: Path) -> list:
"""
Expand Down Expand Up @@ -52,6 +54,10 @@ def construct_meta_info(frames_dir_path: Path) -> dict:
print(f"Mask path not found: {mask_path}")
return None

if torch.load(face_emb_path) is None:
print(f"Face emb is None: {face_emb_path}")
return None

return {
"image_path": str(frames_dir_path),
"mask_path": mask_path,
Expand Down
3 changes: 3 additions & 0 deletions scripts/train_stage1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"""

import argparse
import copy
import logging
import math
import os
Expand Down Expand Up @@ -211,6 +212,7 @@ def log_validation(
logger.info("Running validation... ")

ori_net = accelerator.unwrap_model(net)
ori_net = copy.deepcopy(ori_net)
reference_unet = ori_net.reference_unet
denoising_unet = ori_net.denoising_unet
face_locator = ori_net.face_locator
Expand Down Expand Up @@ -278,6 +280,7 @@ def log_validation(
canvas.save(out_file)

del pipe
del ori_net
torch.cuda.empty_cache()

return pil_images
Expand Down

0 comments on commit 83dd4eb

Please sign in to comment.