From 86e4eed2123c1d6e9ce42effe3b0201ca3888165 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Sun, 4 Jun 2023 20:05:17 +0200 Subject: [PATCH] It needs 1 threads or cores of course --- roop/core.py | 2 +- roop/swapper.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/roop/core.py b/roop/core.py index 307e761..55d0e29 100755 --- a/roop/core.py +++ b/roop/core.py @@ -198,7 +198,7 @@ def start(preview_callback = None): key=lambda x: int(x.split(sep)[-1].replace(".png", "")) )) status("swapping in progress...") - if roop.globals.gpu_vendor is None and roop.globals.cpu_cores > 0: + if roop.globals.gpu_vendor is None and roop.globals.cpu_cores > 1: global POOL POOL = mp.Pool(roop.globals.cpu_cores) process_video_multi_cores(args.source_img, args.frame_paths) diff --git a/roop/swapper.py b/roop/swapper.py index 769a39e..832c757 100644 --- a/roop/swapper.py +++ b/roop/swapper.py @@ -86,9 +86,10 @@ def process_img(source_img, target_path, output_file): def process_video(source_img, frame_paths): + do_multi = roop.globals.gpu_vendor is not None and roop.globals.gpu_threads > 1 progress_bar_format = '{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt}{postfix}]' with tqdm(total=len(frame_paths), desc="Processing", unit="frame", dynamic_ncols=True, bar_format=progress_bar_format) as progress: - if roop.globals.gpu_vendor is not None and roop.globals.gpu_threads > 0: + if do_multi: multi_process_frame(source_img, frame_paths, progress) else: process_frames(source_img, frame_paths, progress)