ini preset
This commit is contained in:
parent
739a8a592a
commit
7d4b635460
|
|
@ -4,6 +4,7 @@ import fcbh.cli_args as fcbh_cli
|
||||||
|
|
||||||
|
|
||||||
fcbh_cli.parser.add_argument("--share", action='store_true', help="Set whether to share on Gradio.")
|
fcbh_cli.parser.add_argument("--share", action='store_true', help="Set whether to share on Gradio.")
|
||||||
|
fcbh_cli.parser.add_argument("--preset", type=str, default=None, help="Apply specified UI preset.")
|
||||||
|
|
||||||
fcbh_cli.args = fcbh_cli.parser.parse_args()
|
fcbh_cli.args = fcbh_cli.parser.parse_args()
|
||||||
fcbh_cli.args.disable_cuda_malloc = True
|
fcbh_cli.args.disable_cuda_malloc = True
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
version = '2.1.56'
|
version = '2.1.57'
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import args_manager
|
||||||
import modules.flags
|
import modules.flags
|
||||||
import modules.sdxl_styles
|
import modules.sdxl_styles
|
||||||
|
|
||||||
|
|
@ -16,6 +17,23 @@ except Exception as e:
|
||||||
print('Load path config failed')
|
print('Load path config failed')
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
preset = args_manager.args.preset
|
||||||
|
|
||||||
|
if preset is not None:
|
||||||
|
preset = os.path.abspath(f'./presets/{preset}.json')
|
||||||
|
try:
|
||||||
|
if os.path.exists(preset):
|
||||||
|
with open(preset, "r", encoding="utf-8") as json_file:
|
||||||
|
preset = json.load(json_file)
|
||||||
|
except Exception as e:
|
||||||
|
print('Load preset config failed')
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
preset = preset if isinstance(preset, dict) else None
|
||||||
|
|
||||||
|
if preset is not None:
|
||||||
|
config_dict.update(preset)
|
||||||
|
|
||||||
|
|
||||||
def get_dir_or_set_default(key, default_value):
|
def get_dir_or_set_default(key, default_value):
|
||||||
global config_dict
|
global config_dict
|
||||||
|
|
@ -125,8 +143,10 @@ default_aspect_ratio = get_config_item_or_set_default(
|
||||||
validator=lambda x: x.replace('*', '×') in modules.sdxl_styles.aspect_ratios
|
validator=lambda x: x.replace('*', '×') in modules.sdxl_styles.aspect_ratios
|
||||||
).replace('*', '×')
|
).replace('*', '×')
|
||||||
|
|
||||||
with open(config_path, "w", encoding="utf-8") as json_file:
|
if preset is None:
|
||||||
json.dump(config_dict, json_file, indent=4)
|
# Do not overwrite user config if preset is applied.
|
||||||
|
with open(config_path, "w", encoding="utf-8") as json_file:
|
||||||
|
json.dump(config_dict, json_file, indent=4)
|
||||||
|
|
||||||
os.makedirs(temp_outputs_path, exist_ok=True)
|
os.makedirs(temp_outputs_path, exist_ok=True)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"default_model": "sd_xl_base_1.0_0.9vae.safetensors",
|
||||||
|
"default_refiner": "sd_xl_refiner_1.0_0.9vae.safetensors",
|
||||||
|
"default_lora": "sd_xl_offset_example-lora_1.0.safetensors",
|
||||||
|
"default_lora_weight": 0.5,
|
||||||
|
"default_cfg_scale": 7.0,
|
||||||
|
"default_sampler": "dpmpp_2m_sde_gpu",
|
||||||
|
"default_scheduler": "karras",
|
||||||
|
"default_styles": [
|
||||||
|
"Fooocus V2",
|
||||||
|
"Default (Slightly Cinematic)"
|
||||||
|
],
|
||||||
|
"default_negative_prompt": "low quality, bad hands, bad eyes, cropped, missing fingers, extra digit",
|
||||||
|
"default_positive_prompt": "",
|
||||||
|
"checkpoint_downloads": {
|
||||||
|
"sd_xl_base_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors",
|
||||||
|
"sd_xl_refiner_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors"
|
||||||
|
},
|
||||||
|
"default_aspect_ratio": "1152*896"
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue