diff --git a/facefusion.ini b/facefusion.ini index 138a1cd7..d6cce164 100644 --- a/facefusion.ini +++ b/facefusion.ini @@ -1,7 +1,3 @@ -[workflow] -workflow_mode = -workflow_strategy = - [paths] temp_path = jobs_path = @@ -72,6 +68,10 @@ output_video_quality = output_video_scale = output_video_fps = +[workflow] +workflow_mode = +workflow_strategy = + [processors] processors = age_modifier_model = diff --git a/facefusion/args.py b/facefusion/args.py index 89b75c98..85df0b9d 100644 --- a/facefusion/args.py +++ b/facefusion/args.py @@ -9,8 +9,6 @@ from facefusion.vision import detect_video_fps def apply_args(args : Args, apply_state_item : ApplyStateItem) -> None: apply_state_item('command', args.get('command')) - apply_state_item('workflow_mode', args.get('workflow_mode')) - apply_state_item('workflow_strategy', args.get('workflow_strategy')) apply_state_item('temp_path', args.get('temp_path')) apply_state_item('jobs_path', args.get('jobs_path')) apply_state_item('source_paths', args.get('source_paths')) @@ -63,6 +61,8 @@ def apply_args(args : Args, apply_state_item : ApplyStateItem) -> None: output_video_fps = normalize_fps(args.get('output_video_fps')) or detect_video_fps(args.get('target_path')) apply_state_item('output_video_fps', output_video_fps) + apply_state_item('workflow_mode', args.get('workflow_mode')) + apply_state_item('workflow_strategy', args.get('workflow_strategy')) available_processors = [ get_file_name(file_path) for file_path in resolve_file_paths('facefusion/processors/modules') ] apply_state_item('processors', args.get('processors')) diff --git a/facefusion/locales.py b/facefusion/locales.py index 94e557f5..b2366914 100644 --- a/facefusion/locales.py +++ b/facefusion/locales.py @@ -98,8 +98,6 @@ LOCALES : Locales =\ { 'install_dependency': 'choose the variant of {dependency} to install', 'skip_conda': 'skip the conda environment check', - 'workflow_mode': 'choose the workflow mode', - 'workflow_strategy': 'choose the workflow strategy', 'config_path': 'choose the config file to override defaults', 'temp_path': 'specify the directory for the temporary resources', 'jobs_path': 'specify the directory to store jobs', @@ -149,6 +147,8 @@ LOCALES : Locales =\ 'output_video_quality': 'specify the video quality which translates to the video compression', 'output_video_scale': 'specify the video scale based on the target video', 'output_video_fps': 'specify the video fps based on the target video', + 'workflow_mode': 'choose the workflow mode', + 'workflow_strategy': 'choose the workflow strategy', 'processors': 'load a single or multiple processors (choices: {choices}, ...)', 'background-remover-model': 'choose the model responsible for removing the background', 'background-remover-color': 'apply red, green blue and alpha values of the background', diff --git a/facefusion/program.py b/facefusion/program.py index d362de26..d3027c4e 100755 --- a/facefusion/program.py +++ b/facefusion/program.py @@ -21,15 +21,6 @@ def create_help_formatter_large(prog : str) -> HelpFormatter: return HelpFormatter(prog, max_help_position = 300) -def create_workflow_program() -> ArgumentParser: - program = ArgumentParser(add_help = False) - group_workflow = program.add_argument_group('workflow') - group_workflow.add_argument('--workflow-mode', help = translator.get('help.workflow_mode'), default = config.get_str_value('workflow', 'workflow_mode', 'auto'), choices = facefusion.choices.workflow_modes) - group_workflow.add_argument('--workflow-strategy', help = translator.get('help.workflow_strategy'), default = config.get_str_value('workflow', 'workflow_strategy', 'memory'), choices = facefusion.choices.workflow_strategies) - job_store.register_step_keys([ 'workflow_mode', 'workflow_strategy' ]) - return program - - def create_config_path_program() -> ArgumentParser: program = ArgumentParser(add_help = False) group_paths = program.add_argument_group('paths') @@ -209,6 +200,15 @@ def create_output_creation_program() -> ArgumentParser: return program +def create_workflow_program() -> ArgumentParser: + program = ArgumentParser(add_help = False) + group_workflow = program.add_argument_group('workflow') + group_workflow.add_argument('--workflow-mode', help = translator.get('help.workflow_mode'), default = config.get_str_value('workflow', 'workflow_mode', 'auto'), choices = facefusion.choices.workflow_modes) + group_workflow.add_argument('--workflow-strategy', help = translator.get('help.workflow_strategy'), default = config.get_str_value('workflow', 'workflow_strategy', 'memory'), choices = facefusion.choices.workflow_strategies) + job_store.register_step_keys([ 'workflow_mode', 'workflow_strategy' ]) + return program + + def create_processors_program() -> ArgumentParser: program = ArgumentParser(add_help = False) available_processors = [ get_file_name(file_path) for file_path in resolve_file_paths('facefusion/processors/modules') ] @@ -309,7 +309,7 @@ def create_step_index_program() -> ArgumentParser: def collect_step_program() -> ArgumentParser: - return ArgumentParser(parents = [ create_workflow_program(), create_face_detector_program(), create_face_landmarker_program(), create_face_selector_program(), create_face_tracker_program(), create_face_masker_program(), create_voice_extractor_program(), create_frame_extraction_program(), create_frame_distribution_program(), create_output_creation_program(), create_processors_program() ], add_help = False) + return ArgumentParser(parents = [ create_face_detector_program(), create_face_landmarker_program(), create_face_selector_program(), create_face_tracker_program(), create_face_masker_program(), create_voice_extractor_program(), create_frame_extraction_program(), create_frame_distribution_program(), create_output_creation_program(), create_workflow_program(), create_processors_program() ], add_help = False) def collect_job_program() -> ArgumentParser: diff --git a/facefusion/types.py b/facefusion/types.py index e6dc4f45..b7abe057 100755 --- a/facefusion/types.py +++ b/facefusion/types.py @@ -322,8 +322,6 @@ JobSet : TypeAlias = Dict[str, Job] StateKey = Literal\ [ 'command', - 'workflow_mode', - 'workflow_strategy', 'config_path', 'temp_path', 'jobs_path', @@ -378,6 +376,8 @@ StateKey = Literal\ 'output_video_quality', 'output_video_scale', 'output_video_fps', + 'workflow_mode', + 'workflow_strategy', 'processors', 'open_browser', 'ui_layouts', @@ -395,8 +395,6 @@ StateKey = Literal\ State = TypedDict('State', { 'command' : str, - 'workflow_mode' : WorkflowMode, - 'workflow_strategy' : WorkflowStrategy, 'config_path' : str, 'temp_path' : str, 'jobs_path' : str, @@ -451,6 +449,8 @@ State = TypedDict('State', 'output_video_quality' : int, 'output_video_scale' : Scale, 'output_video_fps' : float, + 'workflow_mode' : WorkflowMode, + 'workflow_strategy' : WorkflowStrategy, 'processors' : List[str], 'open_browser' : bool, 'ui_layouts' : List[str],