From e70a1293eacd96747cc814e19a9c812e6c04e08e Mon Sep 17 00:00:00 2001 From: C0untFloyd <131583554+C0untFloyd@users.noreply.github.com> Date: Fri, 3 Jan 2025 21:40:25 +0100 Subject: [PATCH] Bugfix: Extras Tab Bugfix: Preview Mask Bugfix: DMDNet working on Cuda only Updated Colab Script to also install CUDNN --- README.md | 8 ++++++++ roop/ProcessOptions.py | 7 +++++-- roop/metadata.py | 2 +- roop/processors/Enhance_DMDNet.py | 4 ++-- ui/tabs/extras_tab.py | 2 +- ui/tabs/faceswap_tab.py | 6 +++--- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0773a4bbc..4f8e4dcbc 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,14 @@ Additional commandline arguments are currently unsupported and settings should b ### Changelog +**03.01.2025** v4.4.1 + +Bugfix: Extras Tab +Bugfix: Preview Mask +Bugfix: DMDNet working on Cuda only +Updated Colab Script to also install CUDNN + + **31.12.2024** v4.4.0 Hotfix Bugfix: Updated Colab to use present Cuda Drivers diff --git a/roop/ProcessOptions.py b/roop/ProcessOptions.py index 4d272efc8..e9ac1be98 100644 --- a/roop/ProcessOptions.py +++ b/roop/ProcessOptions.py @@ -1,8 +1,11 @@ class ProcessOptions: def __init__(self, swap_model, processordefines:dict, face_distance, blend_ratio, swap_mode, selected_index, masking_text, imagemask, num_steps, subsample_size, show_face_area, restore_original_mouth, show_mask=False): - self.swap_modelname = swap_model - self.swap_output_size = int(swap_model.split()[-1]) + if swap_model is not None: + self.swap_modelname = swap_model + self.swap_output_size = int(swap_model.split()[-1]) + else: + self.swap_output_size = 128 self.processors = processordefines self.face_distance_threshold = face_distance self.blend_ratio = blend_ratio diff --git a/roop/metadata.py b/roop/metadata.py index 461cf3940..bb1cf08f7 100644 --- a/roop/metadata.py +++ b/roop/metadata.py @@ -1,2 +1,2 @@ name = 'roop unleashed' -version = '4.4.0' +version = '4.4.1' diff --git a/roop/processors/Enhance_DMDNet.py b/roop/processors/Enhance_DMDNet.py index 3b6a6bb2d..28a1fe909 100644 --- a/roop/processors/Enhance_DMDNet.py +++ b/roop/processors/Enhance_DMDNet.py @@ -199,8 +199,8 @@ def enhance_face(self, ref_faceset: FaceSet, temp_frame, face: Face): def create(self, devicename): self.torchdevice = torch.device(devicename) model_dmdnet = DMDNet().to(self.torchdevice) - weights = torch.load('./models/DMDNet.pth') - model_dmdnet.load_state_dict(weights, strict=True) + weights = torch.load('./models/DMDNet.pth', map_location=self.torchdevice) + model_dmdnet.load_state_dict(weights, strict=False) model_dmdnet.eval() num_params = 0 diff --git a/ui/tabs/extras_tab.py b/ui/tabs/extras_tab.py index 7a1eb25c4..d40f6a900 100644 --- a/ui/tabs/extras_tab.py +++ b/ui/tabs/extras_tab.py @@ -236,7 +236,7 @@ def on_frame_process(files, filterselection, upscaleselection): filter = next((x for x in frame_upscalers_map.keys() if x == upscaleselection), None) if filter is not None: processoroptions.update(frame_upscalers_map[filter]) - options = ProcessOptions(processoroptions, 0, 0, "all", 0, None, None, 0, 128, False, False) + options = ProcessOptions(None, processoroptions, 0, 0, "all", 0, None, None, 0, 128, False, False) batch_process_with_options(list_files_process, options, None) outdir = pathlib.Path(roop.globals.output_path) outfiles = [str(item) for item in outdir.rglob("*") if item.is_file()] diff --git a/ui/tabs/faceswap_tab.py b/ui/tabs/faceswap_tab.py index a5fdeeaa2..d2d5e7c01 100644 --- a/ui/tabs/faceswap_tab.py +++ b/ui/tabs/faceswap_tab.py @@ -250,7 +250,7 @@ def faceswap_tab(): bt_clear_input_faces.click(fn=on_clear_input_faces, outputs=[input_faces]) bt_add_local.click(fn=on_add_local_folder, inputs=[local_folder], outputs=[bt_destfiles]) - bt_preview_mask.click(fn=on_preview_mask, inputs=[preview_frame_num, bt_destfiles, clip_text, selected_mask_engine], outputs=[previewimage]) + bt_preview_mask.click(fn=on_preview_mask, inputs=[ui.globals.ui_selected_swap_model, preview_frame_num, bt_destfiles, clip_text, selected_mask_engine], outputs=[previewimage]) start_event = bt_start.click(fn=start_swap, inputs=[ui.globals.ui_selected_swap_model, output_method, ui.globals.ui_selected_enhancer, selected_face_detection, roop.globals.keep_frames, roop.globals.wait_after_extraction, @@ -624,7 +624,7 @@ def on_set_frame(sender:str, frame_num): return gen_processing_text(list_files_process[idx].startframe,list_files_process[idx].endframe) -def on_preview_mask(frame_num, files, clip_text, mask_engine): +def on_preview_mask(swap_model, frame_num, files, clip_text, mask_engine): from roop.core import live_swap, get_processing_plugins global is_processing @@ -645,7 +645,7 @@ def on_preview_mask(frame_num, files, clip_text, mask_engine): mask_engine = None elif mask_engine == "DFL XSeg": mask_engine = "mask_xseg" - options = ProcessOptions(get_processing_plugins(mask_engine), roop.globals.distance_threshold, roop.globals.blend_ratio, + options = ProcessOptions(swap_model, get_processing_plugins(mask_engine), roop.globals.distance_threshold, roop.globals.blend_ratio, "all", 0, clip_text, None, 0, 128, False, False, True) current_frame = live_swap(current_frame, options)