Vibe coded benchmark command part2
This commit is contained in:
@@ -36,8 +36,8 @@ commands:
|
||||
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
|
||||
job-list list jobs by status
|
||||
job-create create a drafted job
|
||||
job-submit submit a drafted job to become a queued job
|
||||
|
||||
@@ -110,6 +110,10 @@ execution_queue_count =
|
||||
download_providers =
|
||||
download_scope =
|
||||
|
||||
[benchmark]
|
||||
benchmark_resolutions =
|
||||
benchmark_cycles =
|
||||
|
||||
[memory]
|
||||
video_memory_strategy =
|
||||
system_memory_limit =
|
||||
|
||||
@@ -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'))
|
||||
# memory
|
||||
apply_state_item('video_memory_strategy', args.get('video_memory_strategy'))
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -218,9 +218,8 @@ def create_benchmark_program() -> ArgumentParser:
|
||||
from facefusion.benchmarker import BENCHMARKS
|
||||
program = 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 manager
|
||||
sub_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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -6,16 +6,16 @@ from facefusion import wording
|
||||
from facefusion.benchmarker import BENCHMARKS
|
||||
from facefusion.uis.core import register_ui_component
|
||||
|
||||
BENCHMARK_RUNS_CHECKBOX_GROUP : Optional[gradio.CheckboxGroup] = None
|
||||
BENCHMARK_RESOLUTIONS_CHECKBOX_GROUP : Optional[gradio.CheckboxGroup] = None
|
||||
BENCHMARK_CYCLES_SLIDER : Optional[gradio.Button] = None
|
||||
|
||||
|
||||
def render() -> None:
|
||||
global BENCHMARK_RUNS_CHECKBOX_GROUP
|
||||
global BENCHMARK_RESOLUTIONS_CHECKBOX_GROUP
|
||||
global 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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user