shared.options_templates.update(shared.options_section(('settings_in_ui',"Settings in UI","ui"),{
"extra_options_txt2img":shared.OptionInfo([],"Options in main UI - txt2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in txt2img interfaces").needs_reload_ui(),
"settings_in_ui":shared.OptionHTML("""
"extra_options_img2img":shared.OptionInfo([],"Options in main UI - img2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in img2img interfaces").needs_reload_ui(),
This page allows you to add some settings to the main interface of txt2img and img2img tabs.
"extra_options_cols":shared.OptionInfo(1,"Options in main UI - number of columns",gr.Number,{"precision":0}).needs_reload_ui(),
"""),
"extra_options_accordion":shared.OptionInfo(False,"Options in main UI - place into an accordion").needs_reload_ui()
"extra_options_txt2img":shared.OptionInfo([],"Settings for txt2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in txt2img interfaces").needs_reload_ui(),
"extra_options_img2img":shared.OptionInfo([],"Settings for img2img",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that also appear in img2img interfaces").needs_reload_ui(),
"extra_options_cols":shared.OptionInfo(1,"Number of columns for added settings",gr.Number,{"precision":0}).needs_reload_ui(),
"extra_options_accordion":shared.OptionInfo(False,"Place added settings into an accordion").needs_reload_ui()
Returns a function that applies the given value to the given value_name in opts.data.
"""
defvalidate(value_name:str,value:str):
value=int(value)
# validate value
ifnotmin_range==-1:
assertvalue>=min_range,f"Value {value} for {value_name} must be greater than or equal to {min_range}"
ifnotmax_range==-1:
assertvalue<=max_range,f"Value {value} for {value_name} must be less than or equal to {max_range}"
defapply_int(p,x,xs):
validate(value_name,x)
opts.data[value_name]=int(x)
returnapply_int
defbool_applier(value_name:str):
"""
Returns a function that applies the given value to the given value_name in opts.data.
"""
defvalidate(value_name:str,value:str):
assertvalue.lower()in["true","false"],f"Value {value} for {value_name} must be either true or false"
defapply_bool(p,x,xs):
validate(value_name,x)
value_boolean=x.lower()=="true"
opts.data[value_name]=value_boolean
returnapply_bool
defadd_axis_options():
extra_axis_options=[
xyz_grid.AxisOption("[Hypertile] Unet First pass Enabled",str,bool_applier("hypertile_enable_unet"),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Second pass Enabled",str,bool_applier("hypertile_enable_unet_secondpass"),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Max Depth",int,int_applier("hypertile_max_depth_unet",0,3),choices=lambda:[str(x)forxinrange(4)]),
xyz_grid.AxisOption("[Hypertile] Unet Max Tile Size",int,int_applier("hypertile_max_tile_unet",0,512)),
"ESRGAN_tile":OptionInfo(192,"Tile size for ESRGAN upscalers.",gr.Slider,{"minimum":0,"maximum":512,"step":16}).info("0 = no tiling"),
"ESRGAN_tile":OptionInfo(192,"Tile size for ESRGAN upscalers.",gr.Slider,{"minimum":0,"maximum":512,"step":16}).info("0 = no tiling"),
"ESRGAN_tile_overlap":OptionInfo(8,"Tile overlap for ESRGAN upscalers.",gr.Slider,{"minimum":0,"maximum":48,"step":1}).info("Low values = visible seam"),
"ESRGAN_tile_overlap":OptionInfo(8,"Tile overlap for ESRGAN upscalers.",gr.Slider,{"minimum":0,"maximum":48,"step":1}).info("Low values = visible seam"),
"realesrgan_enabled_models":OptionInfo(["R-ESRGAN 4x+","R-ESRGAN 4x+ Anime6B"],"Select which Real-ESRGAN models to show in the web UI.",gr.CheckboxGroup,lambda:{"choices":shared_items.realesrgan_models_names()}),
"realesrgan_enabled_models":OptionInfo(["R-ESRGAN 4x+","R-ESRGAN 4x+ Anime6B"],"Select which Real-ESRGAN models to show in the web UI.",gr.CheckboxGroup,lambda:{"choices":shared_items.realesrgan_models_names()}),
"upscaler_for_img2img":OptionInfo(None,"Upscaler for img2img",gr.Dropdown,lambda:{"choices":[x.nameforxinshared.sd_upscalers]}),
"upscaler_for_img2img":OptionInfo(None,"Upscaler for img2img",gr.Dropdown,lambda:{"choices":[x.nameforxinshared.sd_upscalers]}),
"face_restoration":OptionInfo(False,"Restore faces",infotext='Face restoration').info("will use a third-party model on generation result to reconstruct faces"),
"face_restoration":OptionInfo(False,"Restore faces",infotext='Face restoration').info("will use a third-party model on generation result to reconstruct faces"),
"unload_models_when_training":OptionInfo(False,"Move VAE and CLIP to RAM when training if possible. Saves VRAM."),
"unload_models_when_training":OptionInfo(False,"Move VAE and CLIP to RAM when training if possible. Saves VRAM."),
"pin_memory":OptionInfo(False,"Turn on pin_memory for DataLoader. Makes training slightly faster but can increase memory usage."),
"pin_memory":OptionInfo(False,"Turn on pin_memory for DataLoader. Makes training slightly faster but can increase memory usage."),
"save_optimizer_state":OptionInfo(False,"Saves Optimizer state as separate *.optim file. Training of embedding or HN can be resumed with the matching optim file."),
"save_optimizer_state":OptionInfo(False,"Saves Optimizer state as separate *.optim file. Training of embedding or HN can be resumed with the matching optim file."),
"sd_checkpoints_limit":OptionInfo(1,"Maximum number of checkpoints loaded at the same time",gr.Slider,{"minimum":1,"maximum":10,"step":1}),
"sd_checkpoints_limit":OptionInfo(1,"Maximum number of checkpoints loaded at the same time",gr.Slider,{"minimum":1,"maximum":10,"step":1}),
"sd_checkpoints_keep_in_cpu":OptionInfo(True,"Only keep one model on device").info("will keep models other than the currently used one in RAM rather than VRAM"),
"sd_checkpoints_keep_in_cpu":OptionInfo(True,"Only keep one model on device").info("will keep models other than the currently used one in RAM rather than VRAM"),
<abbr title='Variational autoencoder'>VAE</abbr> is a neural network that transforms a standard <abbr title='red/green/blue'>RGB</abbr>
<abbr title='Variational autoencoder'>VAE</abbr> is a neural network that transforms a standard <abbr title='red/green/blue'>RGB</abbr>
image into latent space representation and back. Latent space representation is what stable diffusion is working on during sampling
image into latent space representation and back. Latent space representation is what stable diffusion is working on during sampling
...
@@ -176,7 +181,7 @@ For img2img, VAE is used to process user's input image before the sampling, and
...
@@ -176,7 +181,7 @@ For img2img, VAE is used to process user's input image before the sampling, and
"sd_vae_decode_method":OptionInfo("Full","VAE type for decode",gr.Radio,{"choices":["Full","TAESD"]},infotext='VAE Decoder').info("method to decode latent to image"),
"sd_vae_decode_method":OptionInfo("Full","VAE type for decode",gr.Radio,{"choices":["Full","TAESD"]},infotext='VAE Decoder').info("method to decode latent to image"),
"initial_noise_multiplier":OptionInfo(1.0,"Noise multiplier for img2img",gr.Slider,{"minimum":0.0,"maximum":1.5,"step":0.001},infotext='Noise multiplier'),
"initial_noise_multiplier":OptionInfo(1.0,"Noise multiplier for img2img",gr.Slider,{"minimum":0.0,"maximum":1.5,"step":0.001},infotext='Noise multiplier'),
"img2img_extra_noise":OptionInfo(0.0,"Extra noise multiplier for img2img and hires fix",gr.Slider,{"minimum":0.0,"maximum":1.0,"step":0.01},infotext='Extra noise').info("0 = disabled (default); should be lower than denoising strength"),
"img2img_extra_noise":OptionInfo(0.0,"Extra noise multiplier for img2img and hires fix",gr.Slider,{"minimum":0.0,"maximum":1.0,"step":0.01},infotext='Extra noise').info("0 = disabled (default); should be lower than denoising strength"),
"img2img_batch_show_results_limit":OptionInfo(32,"Show the first N batch img2img results in UI",gr.Slider,{"minimum":-1,"maximum":1000,"step":1}).info('0: disable, -1: show all images. Too many images can cause lag'),
"img2img_batch_show_results_limit":OptionInfo(32,"Show the first N batch img2img results in UI",gr.Slider,{"minimum":-1,"maximum":1000,"step":1}).info('0: disable, -1: show all images. Too many images can cause lag'),
"s_min_uncond":OptionInfo(0.0,"Negative Guidance minimum sigma",gr.Slider,{"minimum":0.0,"maximum":15.0,"step":0.01}).link("PR","https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9177").info("skip negative prompt for some steps when the image is almost ready; 0=disable, higher=faster"),
"s_min_uncond":OptionInfo(0.0,"Negative Guidance minimum sigma",gr.Slider,{"minimum":0.0,"maximum":15.0,"step":0.01}).link("PR","https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9177").info("skip negative prompt for some steps when the image is almost ready; 0=disable, higher=faster"),
"cache_fp16_weight":OptionInfo(False,"Cache FP16 weight for LoRA").info("Cache fp16 weight when enabling FP8, will increase the quality of LoRA. Use more system ram."),
"cache_fp16_weight":OptionInfo(False,"Cache FP16 weight for LoRA").info("Cache fp16 weight when enabling FP8, will increase the quality of LoRA. Use more system ram."),
"extra_networks_show_hidden_directories":OptionInfo(True,"Show hidden directories").info("directory is hidden if its name starts with \".\"."),
"extra_networks_show_hidden_directories":OptionInfo(True,"Show hidden directories").info("directory is hidden if its name starts with \".\"."),
"extra_networks_dir_button_function":OptionInfo(False,"Add a '/' to the beginning of directory buttons").info("Buttons will display the contents of the selected directory without acting as a search filter."),
"extra_networks_hidden_models":OptionInfo("When searched","Show cards for models in hidden directories",gr.Radio,{"choices":["Always","When searched","Never"]}).info('"When searched" option will only show the item when the search string has 4 characters or more'),
"extra_networks_hidden_models":OptionInfo("When searched","Show cards for models in hidden directories",gr.Radio,{"choices":["Always","When searched","Never"]}).info('"When searched" option will only show the item when the search string has 4 characters or more'),
"extra_networks_default_multiplier":OptionInfo(1.0,"Default multiplier for extra networks",gr.Slider,{"minimum":0.0,"maximum":2.0,"step":0.01}),
"extra_networks_default_multiplier":OptionInfo(1.0,"Default multiplier for extra networks",gr.Slider,{"minimum":0.0,"maximum":2.0,"step":0.01}),
"extra_networks_card_width":OptionInfo(0,"Card width for Extra Networks").info("in pixels"),
"extra_networks_card_width":OptionInfo(0,"Card width for Extra Networks").info("in pixels"),
"sd_hypernetwork":OptionInfo("None","Add hypernetwork to prompt",gr.Dropdown,lambda:{"choices":["None",*shared.hypernetworks]},refresh=shared_items.reload_hypernetworks),
"sd_hypernetwork":OptionInfo("None","Add hypernetwork to prompt",gr.Dropdown,lambda:{"choices":["None",*shared.hypernetworks]},refresh=shared_items.reload_hypernetworks),
"keyedit_precision_attention":OptionInfo(0.1,"Precision for (attention:1.1) when editing the prompt with Ctrl+up/down",gr.Slider,{"minimum":0.01,"maximum":0.2,"step":0.001}),
"gradio_theme":OptionInfo("Default","Gradio theme",ui_components.DropdownEditable,lambda:{"choices":["Default"]+shared_gradio_themes.gradio_hf_hub_themes}).info("you can also manually enter any of themes from the <a href='https://huggingface.co/spaces/gradio/theme-gallery'>gallery</a>.").needs_reload_ui(),
"keyedit_precision_extra":OptionInfo(0.05,"Precision for <extra networks:0.9> when editing the prompt with Ctrl+up/down",gr.Slider,{"minimum":0.01,"maximum":0.2,"step":0.001}),
"gradio_themes_cache":OptionInfo(True,"Cache gradio themes locally").info("disable to update the selected Gradio theme"),
"keyedit_delimiters":OptionInfo(r".,\/!?%^*;:{}=`~() ","Word delimiters when editing the prompt with Ctrl+up/down"),
"gallery_height":OptionInfo("","Gallery height",gr.Textbox).info("an be any valid CSS value").needs_reload_ui(),
"compact_prompt_box":OptionInfo(False,"Compact prompt layout").info("puts prompt and negative prompt inside the Generate tab, leaving more vertical space for the image on the right").needs_reload_ui(),
"samplers_in_dropdown":OptionInfo(True,"Use dropdown for sampler selection instead of radio group").needs_reload_ui(),
"samplers_in_dropdown":OptionInfo(True,"Use dropdown for sampler selection instead of radio group").needs_reload_ui(),
"dimensions_and_batch_together":OptionInfo(True,"Show Width/Height and Batch sliders in same row").needs_reload_ui(),
"dimensions_and_batch_together":OptionInfo(True,"Show Width/Height and Batch sliders in same row").needs_reload_ui(),
"keyedit_precision_attention":OptionInfo(0.1,"Ctrl+up/down precision when editing (attention:1.1)",gr.Slider,{"minimum":0.01,"maximum":0.2,"step":0.001}),
"keyedit_precision_extra":OptionInfo(0.05,"Ctrl+up/down precision when editing <extra networks:0.9>",gr.Slider,{"minimum":0.01,"maximum":0.2,"step":0.001}),
"keyedit_delimiters":OptionInfo(r".,\/!?%^*;:{}=`~() ","Ctrl+up/down word delimiters"),
"quicksettings_list":OptionInfo(["sd_model_checkpoint"],"Quicksettings list",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that appear at the top of page rather than in settings tab").needs_reload_ui(),
"sd_checkpoint_dropdown_use_short":OptionInfo(False,"Checkpoint dropdown: use filenames without paths").info("models in subdirectories like photo/sd15.ckpt will be listed as just sd15.ckpt"),
"sd_checkpoint_dropdown_use_short":OptionInfo(False,"Checkpoint dropdown: use filenames without paths").info("models in subdirectories like photo/sd15.ckpt will be listed as just sd15.ckpt"),
"hires_fix_show_sampler":OptionInfo(False,"Hires fix: show hires checkpoint and sampler selection").needs_reload_ui(),
"hires_fix_show_sampler":OptionInfo(False,"Hires fix: show hires checkpoint and sampler selection").needs_reload_ui(),
"hires_fix_show_prompts":OptionInfo(False,"Hires fix: show hires prompt and negative prompt").needs_reload_ui(),
"hires_fix_show_prompts":OptionInfo(False,"Hires fix: show hires prompt and negative prompt").needs_reload_ui(),
"txt2img_settings_accordion":OptionInfo(False,"Settings in txt2img hidden under Accordion").needs_reload_ui(),
"txt2img_settings_accordion":OptionInfo(False,"Settings in txt2img hidden under Accordion").needs_reload_ui(),
"img2img_settings_accordion":OptionInfo(False,"Settings in img2img hidden under Accordion").needs_reload_ui(),
"img2img_settings_accordion":OptionInfo(False,"Settings in img2img hidden under Accordion").needs_reload_ui(),
"compact_prompt_box":OptionInfo(False,"Compact prompt layout").info("puts prompt and negative prompt inside the Generate tab, leaving more vertical space for the image on the right").needs_reload_ui(),
"quicksettings_list":OptionInfo(["sd_model_checkpoint"],"Quicksettings list",ui_components.DropdownMulti,lambda:{"choices":list(shared.opts.data_labels.keys())}).js("info","settingsHintsShowQuicksettings").info("setting entries that appear at the top of page rather than in settings tab").needs_reload_ui(),
"ui_reorder_list":OptionInfo([],"UI item order for txt2img/img2img tabs",ui_components.DropdownMulti,lambda:{"choices":list(shared_items.ui_reorder_categories())}).info("selected items appear first").needs_reload_ui(),
"gradio_theme":OptionInfo("Default","Gradio theme",ui_components.DropdownEditable,lambda:{"choices":["Default"]+shared_gradio_themes.gradio_hf_hub_themes}).info("you can also manually enter any of themes from the <a href='https://huggingface.co/spaces/gradio/theme-gallery'>gallery</a>.").needs_reload_ui(),
"gradio_themes_cache":OptionInfo(True,"Cache gradio themes locally").info("disable to update the selected Gradio theme"),
"show_progress_in_title":OptionInfo(True,"Show generation progress in window title."),
"send_seed":OptionInfo(True,"Send seed when sending prompt or image to other interface"),
"send_size":OptionInfo(True,"Send size when sending prompt or image to another interface"),
"add_model_hash_to_info":OptionInfo(True,"Add model hash to generation information"),
"infotext_explanation":OptionHTML("""
"add_model_name_to_info":OptionInfo(True,"Add model name to generation information"),
Infotext is what this software calls the text that contains generation parameters and can be used to generate the same picture again.
"add_user_name_to_info":OptionInfo(False,"Add user name to generation information when authenticated"),
It is displayed in UI below the image. To use infotext, paste it into the prompt and click the ↙️ paste button.
"add_version_to_infotext":OptionInfo(True,"Add program version to generation information"),
"""),
"enable_pnginfo":OptionInfo(True,"Write infotext to metadata of the generated image"),
"save_txt":OptionInfo(False,"Create a text file with infotext next to every generated image"),
"add_model_name_to_info":OptionInfo(True,"Add model name to infotext"),
"add_model_hash_to_info":OptionInfo(True,"Add model hash to infotext"),
"add_vae_name_to_info":OptionInfo(True,"Add VAE name to infotext"),
"add_vae_hash_to_info":OptionInfo(True,"Add VAE hash to infotext"),
"add_user_name_to_info":OptionInfo(False,"Add user name to infotext when authenticated"),
"add_version_to_infotext":OptionInfo(True,"Add program version to infotext"),
"disable_weights_auto_swap":OptionInfo(True,"Disregard checkpoint information from pasted infotext").info("when reading generation parameters from text into UI"),
"disable_weights_auto_swap":OptionInfo(True,"Disregard checkpoint information from pasted infotext").info("when reading generation parameters from text into UI"),
"infotext_skip_pasting":OptionInfo([],"Disregard fields from pasted infotext",ui_components.DropdownMulti,lambda:{"choices":shared_items.get_infotext_names()}),
"infotext_styles":OptionInfo("Apply if any","Infer styles from prompts of pasted infotext",gr.Radio,{"choices":["Ignore","Apply","Discard","Apply if any"]}).info("when reading generation parameters from text into UI)").html("""<ul style='margin-left: 1.5em'>
"infotext_styles":OptionInfo("Apply if any","Infer styles from prompts of pasted infotext",gr.Radio,{"choices":["Ignore","Apply","Discard","Apply if any"]}).info("when reading generation parameters from text into UI)").html("""<ul style='margin-left: 1.5em'>
<li>Ignore: keep prompt and styles dropdown as it is.</li>
<li>Ignore: keep prompt and styles dropdown as it is.</li>
<li>Apply: remove style text from prompt, always replace styles dropdown value with found styles (even if none are found).</li>
<li>Apply: remove style text from prompt, always replace styles dropdown value with found styles (even if none are found).</li>
"hide_samplers":OptionInfo([],"Hide samplers in user interface",gr.CheckboxGroup,lambda:{"choices":[x.nameforxinshared_items.list_samplers()]}).needs_reload_ui(),
"hide_samplers":OptionInfo([],"Hide samplers in user interface",gr.CheckboxGroup,lambda:{"choices":[x.nameforxinshared_items.list_samplers()]}).needs_reload_ui(),
"eta_ddim":OptionInfo(0.0,"Eta for DDIM",gr.Slider,{"minimum":0.0,"maximum":1.0,"step":0.01},infotext='Eta DDIM').info("noise multiplier; higher = more unpredictable results"),
"eta_ddim":OptionInfo(0.0,"Eta for DDIM",gr.Slider,{"minimum":0.0,"maximum":1.0,"step":0.01},infotext='Eta DDIM').info("noise multiplier; higher = more unpredictable results"),
"eta_ancestral":OptionInfo(1.0,"Eta for k-diffusion samplers",gr.Slider,{"minimum":0.0,"maximum":1.0,"step":0.01},infotext='Eta').info("noise multiplier; currently only applies to ancestral samplers (i.e. Euler a) and SDE samplers"),
"eta_ancestral":OptionInfo(1.0,"Eta for k-diffusion samplers",gr.Slider,{"minimum":0.0,"maximum":1.0,"step":0.01},infotext='Eta').info("noise multiplier; currently only applies to ancestral samplers (i.e. Euler a) and SDE samplers"),
'postprocessing_enable_in_main_ui':OptionInfo([],"Enable postprocessing operations in txt2img and img2img tabs",ui_components.DropdownMulti,lambda:{"choices":[x.nameforxinshared_items.postprocessing_scripts()]}),
'postprocessing_enable_in_main_ui':OptionInfo([],"Enable postprocessing operations in txt2img and img2img tabs",ui_components.DropdownMulti,lambda:{"choices":[x.nameforxinshared_items.postprocessing_scripts()]}),