Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug #124, add temp net for validation, add face emb validation when extract meta #133

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading