From 074b655dff89bfb69bcbe9a08cc947f2a0e33568 Mon Sep 17 00:00:00 2001 From: eddyizm Date: Sun, 11 Feb 2024 04:03:10 -0800 Subject: [PATCH] fix: implement output path argument (#2074) * added function to check output path arg and override, other wise, use temp or fallback to config * added function to check output path arg and override, other wise, use temp or fallback to config #2065 * Revert to 1bcbd650 * moved path output arg handling inside config start up * Revert "added function to check output path arg and override, other wise, use temp or fallback to config" This reverts commit fecb97b59ccd3bde3a5fc2d2302245611eb85d2c. * Updated tag to uppercase * updated docstring to standard double quotes. Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> * removed extra check on image log flag per feedback * feat: update config_dict value when overriding path_outputs, change message --------- Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Co-authored-by: Manuel Schmid --- modules/config.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/config.py b/modules/config.py index 58107806..1f4e82eb 100644 --- a/modules/config.py +++ b/modules/config.py @@ -102,6 +102,18 @@ if isinstance(preset, str): print(e) +def get_path_output() -> str: + """ + Checking output path argument and overriding default path. + """ + global config_dict + path_output = get_dir_or_set_default('path_outputs', '../outputs/') + if args_manager.args.output_path: + print(f'[CONFIG] Overriding config value path_outputs with {args_manager.args.output_path}') + config_dict['path_outputs'] = path_output = args_manager.args.output_path + return path_output + + def get_dir_or_set_default(key, default_value): global config_dict, visited_keys, always_save_keys @@ -132,7 +144,7 @@ path_inpaint = get_dir_or_set_default('path_inpaint', '../models/inpaint/') path_controlnet = get_dir_or_set_default('path_controlnet', '../models/controlnet/') path_clip_vision = get_dir_or_set_default('path_clip_vision', '../models/clip_vision/') path_fooocus_expansion = get_dir_or_set_default('path_fooocus_expansion', '../models/prompt_expansion/fooocus_expansion') -path_outputs = get_dir_or_set_default('path_outputs', '../outputs/') +path_outputs = get_path_output() def get_config_item_or_set_default(key, default_value, validator, disable_empty_as_none=False):