Industry leading face manipulation platform
Vibe coded benchmark command part2
henryruhs19400a92bd38
diff --git a/README.md b/README.mdindex 15e9de4e..d16935e2 100644--- a/README.md+++ b/README.md@@ -36,8 +36,8 @@ commands:run run the programheadless-run run the program in headless modebatch-run run the program in batch mode- benchmark run performance benchmarks and exitforce-download force automate downloads and exit+ benchmark run performance benchmarks and exitjob-list list jobs by statusjob-create create a drafted jobjob-submit submit a drafted job to become a queued jobdiff --git a/facefusion.ini b/facefusion.iniindex 172ecafd..42c6e94a 100644--- a/facefusion.ini+++ b/facefusion.ini@@ -110,6 +110,10 @@ execution_queue_count =download_providers =download_scope =+[benchmark]+benchmark_resolutions =+benchmark_cycles =+[memory]video_memory_strategy =system_memory_limit =diff --git a/facefusion/args.py b/facefusion/args.pyindex 4acae27c..560b6ac4 100644--- a/facefusion/args.py+++ b/facefusion/args.py@@ -126,7 +126,7 @@ def apply_args(args : Args, apply_state_item : ApplyStateItem) -> None:apply_state_item('download_providers', args.get('download_providers'))apply_state_item('download_scope', args.get('download_scope'))# benchmark- apply_state_item('benchmark_runs', args.get('benchmark_runs'))+ apply_state_item('benchmark_resolutions', args.get('benchmark_resolutions'))apply_state_item('benchmark_cycles', args.get('benchmark_cycles'))# memoryapply_state_item('video_memory_strategy', args.get('video_memory_strategy'))diff --git a/facefusion/benchmarker.py b/facefusion/benchmarker.pyindex 3bfc2d76..99f75fd9 100644--- a/facefusion/benchmarker.py+++ b/facefusion/benchmarker.py@@ -84,7 +84,7 @@ def benchmark_target(benchmark_cycles : int) -> List[Any]:def run() -> None:- benchmark_runs = state_manager.get_item('benchmark_runs')+ benchmark_resolutions = state_manager.get_item('benchmark_resolutions')benchmark_cycles = state_manager.get_item('benchmark_cycles')state_manager.set_item('source_paths', [ '.assets/examples/source.jpg', '.assets/examples/source.mp3' ])@@ -95,7 +95,7 @@ def run() -> None:state_manager.set_item('video_memory_strategy', 'tolerant')benchmark_results = []- target_paths = [ BENCHMARKS[benchmark_run] for benchmark_run in benchmark_runs if benchmark_run in BENCHMARKS ]+ target_paths = [ BENCHMARKS[benchmark_resolution] for benchmark_resolution in benchmark_resolutions if benchmark_resolution in BENCHMARKS ]if target_paths:pre_process()diff --git a/facefusion/program.py b/facefusion/program.pyindex 335cac71..6f0d487a 100755--- a/facefusion/program.py+++ b/facefusion/program.py@@ -218,9 +218,8 @@ def create_benchmark_program() -> ArgumentParser:from facefusion.benchmarker import BENCHMARKSprogram = ArgumentParser(add_help = False)group_benchmark = program.add_argument_group('benchmark')- group_benchmark.add_argument('--benchmark-runs', help = wording.get('help.benchmark_runs'), default = [ '240p' ], choices = list(BENCHMARKS.keys()), nargs = '+')- group_benchmark.add_argument('--benchmark-cycles', help = wording.get('help.benchmark_cycles'), type = int, default = 5, choices = range(1, 11))- job_store.register_job_keys([ 'benchmark_runs', 'benchmark_cycles' ])+ group_benchmark.add_argument('--benchmark-resolutions', help = wording.get('help.benchmark_resolutions'), default = config.get_str_list('benchmark', 'benchmark_resolutions', '240p'), choices = list(BENCHMARKS.keys()), nargs = '+')+ group_benchmark.add_argument('--benchmark-cycles', help = wording.get('help.benchmark_cycles'), type = int, default = config.get_int_value('benchmark', 'benchmark_cycles', '5'), choices = range(1, 11))return program@@ -293,8 +292,8 @@ def create_program() -> ArgumentParser:sub_program.add_parser('run', help = wording.get('help.run'), parents = [ create_config_path_program(), create_temp_path_program(), create_jobs_path_program(), create_source_paths_program(), create_target_path_program(), create_output_path_program(), collect_step_program(), create_uis_program(), collect_job_program() ], formatter_class = create_help_formatter_large)sub_program.add_parser('headless-run', help = wording.get('help.headless_run'), parents = [ create_config_path_program(), create_temp_path_program(), create_jobs_path_program(), create_source_paths_program(), create_target_path_program(), create_output_path_program(), collect_step_program(), collect_job_program() ], formatter_class = create_help_formatter_large)sub_program.add_parser('batch-run', help = wording.get('help.batch_run'), parents = [ create_config_path_program(), create_temp_path_program(), create_jobs_path_program(), create_source_pattern_program(), create_target_pattern_program(), create_output_pattern_program(), collect_step_program(), collect_job_program() ], formatter_class = create_help_formatter_large)- sub_program.add_parser('benchmark', help = wording.get('help.benchmark'), parents = [ create_config_path_program(), create_temp_path_program(), create_jobs_path_program(), create_benchmark_program(), collect_step_program(), collect_job_program() ], formatter_class = create_help_formatter_large)sub_program.add_parser('force-download', help = wording.get('help.force_download'), parents = [ create_download_providers_program(), create_download_scope_program(), create_log_level_program() ], formatter_class = create_help_formatter_large)+ sub_program.add_parser('benchmark', help = wording.get('help.benchmark'), parents = [ create_config_path_program(), create_temp_path_program(), create_jobs_path_program(), create_benchmark_program(), collect_step_program(), collect_job_program() ], formatter_class = create_help_formatter_large)# job managersub_program.add_parser('job-list', help = wording.get('help.job_list'), parents = [ create_job_status_program(), create_jobs_path_program(), create_log_level_program() ], formatter_class = create_help_formatter_large)sub_program.add_parser('job-create', help = wording.get('help.job_create'), parents = [ create_job_id_program(), create_jobs_path_program(), create_log_level_program() ], formatter_class = create_help_formatter_large)diff --git a/facefusion/types.py b/facefusion/types.pyindex 44a4b6b4..15978ce4 100755--- a/facefusion/types.py+++ b/facefusion/types.py@@ -283,7 +283,7 @@ StateKey = Literal\'execution_thread_count','execution_queue_count','download_providers',- 'benchmark_runs',+ 'benchmark_resolutions','benchmark_cycles','download_scope','video_memory_strategy',@@ -351,7 +351,7 @@ State = TypedDict('State','execution_thread_count' : int,'execution_queue_count' : int,'download_providers' : List[DownloadProvider],- 'benchmark_runs' : List[str],+ 'benchmark_resolutions' : List[str],'benchmark_cycles' : int,'download_scope' : DownloadScope,'video_memory_strategy' : VideoMemoryStrategy,diff --git a/facefusion/uis/components/benchmark.py b/facefusion/uis/components/benchmark.pyindex 123fa499..ed177102 100644--- a/facefusion/uis/components/benchmark.py+++ b/facefusion/uis/components/benchmark.py@@ -43,14 +43,14 @@ def render() -> None:def listen() -> None:- benchmark_runs_checkbox_group = get_ui_component('benchmark_runs_checkbox_group')+ benchmark_resolutions_checkbox_group = get_ui_component('benchmark_resolutions_checkbox_group')benchmark_cycles_slider = get_ui_component('benchmark_cycles_slider')- if benchmark_runs_checkbox_group and benchmark_cycles_slider:- BENCHMARK_START_BUTTON.click(start, inputs = [ benchmark_runs_checkbox_group, benchmark_cycles_slider ], outputs = BENCHMARK_BENCHMARKS_DATAFRAME)+ if benchmark_resolutions_checkbox_group and benchmark_cycles_slider:+ BENCHMARK_START_BUTTON.click(start, inputs = [ benchmark_resolutions_checkbox_group, benchmark_cycles_slider ], outputs = BENCHMARK_BENCHMARKS_DATAFRAME)-def start(benchmark_runs : List[str], benchmark_cycles : int) -> Generator[List[Any], None, None]:+def start(benchmark_resolutions : List[str], benchmark_cycles : int) -> Generator[List[Any], None, None]:state_manager.set_item('source_paths', [ '.assets/examples/source.jpg', '.assets/examples/source.mp3' ])state_manager.set_item('face_landmarker_score', 0)state_manager.set_item('temp_frame_format', 'bmp')@@ -62,7 +62,7 @@ def start(benchmark_runs : List[str], benchmark_cycles : int) -> Generator[List[state_manager.sync_item('execution_queue_count')state_manager.sync_item('system_memory_limit')benchmark_results = []- target_paths = [ BENCHMARKS[benchmark_run] for benchmark_run in benchmark_runs if benchmark_run in BENCHMARKS ]+ target_paths = [ BENCHMARKS[benchmark_resolution] for benchmark_resolution in benchmark_resolutions if benchmark_resolution in BENCHMARKS ]if target_paths:pre_process()diff --git a/facefusion/uis/components/benchmark_options.py b/facefusion/uis/components/benchmark_options.pyindex 4e981cf7..a7f07cf4 100644--- a/facefusion/uis/components/benchmark_options.py+++ b/facefusion/uis/components/benchmark_options.py@@ -6,16 +6,16 @@ from facefusion import wordingfrom facefusion.benchmarker import BENCHMARKSfrom facefusion.uis.core import register_ui_component-BENCHMARK_RUNS_CHECKBOX_GROUP : Optional[gradio.CheckboxGroup] = None+BENCHMARK_RESOLUTIONS_CHECKBOX_GROUP : Optional[gradio.CheckboxGroup] = NoneBENCHMARK_CYCLES_SLIDER : Optional[gradio.Button] = Nonedef render() -> None:- global BENCHMARK_RUNS_CHECKBOX_GROUP+ global BENCHMARK_RESOLUTIONS_CHECKBOX_GROUPglobal BENCHMARK_CYCLES_SLIDER- BENCHMARK_RUNS_CHECKBOX_GROUP = gradio.CheckboxGroup(- label = wording.get('uis.benchmark_runs_checkbox_group'),+ BENCHMARK_RESOLUTIONS_CHECKBOX_GROUP = gradio.CheckboxGroup(+ label = wording.get('uis.benchmark_resolutions_checkbox_group'),choices = list(BENCHMARKS.keys()),value = list(BENCHMARKS.keys()))@@ -26,5 +26,5 @@ def render() -> None:minimum = 1,maximum = 10)- register_ui_component('benchmark_runs_checkbox_group', BENCHMARK_RUNS_CHECKBOX_GROUP)+ register_ui_component('benchmark_resolutions_checkbox_group', BENCHMARK_RESOLUTIONS_CHECKBOX_GROUP)register_ui_component('benchmark_cycles_slider', BENCHMARK_CYCLES_SLIDER)diff --git a/facefusion/uis/types.py b/facefusion/uis/types.pyindex 52c5015d..32a60801 100644--- a/facefusion/uis/types.py+++ b/facefusion/uis/types.py@@ -6,7 +6,7 @@ ComponentName = Literal\'age_modifier_direction_slider','age_modifier_model_dropdown','benchmark_cycles_slider',- 'benchmark_runs_checkbox_group',+ 'benchmark_resolutions_checkbox_group','deep_swapper_model_dropdown','deep_swapper_morph_slider','expression_restorer_factor_slider',diff --git a/facefusion/wording.py b/facefusion/wording.pyindex c176a23e..fde5ae8b 100755--- a/facefusion/wording.py+++ b/facefusion/wording.py@@ -207,10 +207,10 @@ WORDING : Dict[str, Any] =\'run': 'run the program','headless_run': 'run the program in headless mode','batch_run': 'run the program in batch mode',- 'benchmark': 'run performance benchmarks and exit','force_download': 'force automate downloads and exit',+ 'benchmark': 'run performance benchmarks and exit',# benchmark- 'benchmark_runs': 'choose the resolution for the benchmark runs (choices: {choices}, ...)',+ 'benchmark_resolutions': 'choose the resolution for the benchmark runs (choices: {choices}, ...)','benchmark_cycles': 'specify the number of benchmark cycles',# jobs'job_id': 'specify the job id',@@ -245,7 +245,7 @@ WORDING : Dict[str, Any] =\'age_modifier_model_dropdown': 'AGE MODIFIER MODEL','apply_button': 'APPLY','benchmark_cycles_slider': 'BENCHMARK CYCLES',- 'benchmark_runs_checkbox_group': 'BENCHMARK RUNS',+ 'benchmark_resolutions_checkbox_group': 'BENCHMARK RESOLUTIONS','clear_button': 'CLEAR','common_options_checkbox_group': 'OPTIONS','download_providers_checkbox_group': 'DOWNLOAD PROVIDERS',