"sd_lora":shared.OptionInfo("None","Add network to prompt",gr.Dropdown,lambda:{"choices":["None",*networks.available_networks]},refresh=networks.list_available_networks),
"sd_lora":shared.OptionInfo("None","Add network to prompt",gr.Dropdown,lambda:{"choices":["None",*networks.available_networks]},refresh=networks.list_available_networks),
"lora_preferred_name":shared.OptionInfo("Alias from file","When adding to prompt, refer to Lora by",gr.Radio,{"choices":["Alias from file","Filename"]}),
"lora_preferred_name":shared.OptionInfo("Alias from file","When adding to prompt, refer to Lora by",gr.Radio,{"choices":["Alias from file","Filename"]}),
"lora_add_hashes_to_infotext":shared.OptionInfo(True,"Add Lora hashes to infotext"),
"lora_add_hashes_to_infotext":shared.OptionInfo(True,"Add Lora hashes to infotext"),
"lora_bundled_ti_to_infotext":shared.OptionInfo(True,"Add Lora name as TI hashes for bundled Textual Inversion").info('"Add Textual Inversion hashes to infotext" needs to be enabled'),
"lora_show_all":shared.OptionInfo(False,"Always show all networks on the Lora page").info("otherwise, those detected as for incompatible version of Stable Diffusion will be hidden"),
"lora_show_all":shared.OptionInfo(False,"Always show all networks on the Lora page").info("otherwise, those detected as for incompatible version of Stable Diffusion will be hidden"),
"lora_hide_unknown_for_versions":shared.OptionInfo([],"Hide networks of unknown versions for model versions",gr.CheckboxGroup,{"choices":["SD1","SD2","SDXL"]}),
"lora_hide_unknown_for_versions":shared.OptionInfo([],"Hide networks of unknown versions for model versions",gr.CheckboxGroup,{"choices":["SD1","SD2","SDXL"]}),
"lora_in_memory_limit":shared.OptionInfo(0,"Number of Lora networks to keep cached in memory",gr.Number,{"precision":0}),
"lora_in_memory_limit":shared.OptionInfo(0,"Number of Lora networks to keep cached in memory",gr.Number,{"precision":0}),
"hypertile_max_depth_unet":shared.OptionInfo(3,"Hypertile U-Net max depth",gr.Slider,{"minimum":0,"maximum":3,"step":1},infotext="Hypertile U-Net max depth").info("larger = more neural network layers affected; minor effect on performance"),
"hypertile_max_depth_unet":shared.OptionInfo(3,"Hypertile U-Net max depth",gr.Slider,{"minimum":0,"maximum":3,"step":1},infotext="Hypertile U-Net max depth").info("larger = more neural network layers affected; minor effect on performance"),
"hypertile_max_tile_unet":shared.OptionInfo(256,"Hypertile U-Net max tile size",gr.Slider,{"minimum":0,"maximum":512,"step":16},infotext="Hypertile U-Net max tile size").info("larger = worse performance"),
"hypertile_max_tile_unet":shared.OptionInfo(256,"Hypertile U-Net max tile size",gr.Slider,{"minimum":0,"maximum":512,"step":16},infotext="Hypertile U-Net max tile size").info("larger = worse performance"),
"hypertile_enable_vae":shared.OptionInfo(False,"Enable Hypertile VAE",infotext="Hypertile VAE").info("minimal change in the generated picture"),
"hypertile_enable_vae":shared.OptionInfo(False,"Enable Hypertile VAE",infotext="Hypertile VAE").info("minimal change in the generated picture"),
"hypertile_max_depth_vae":shared.OptionInfo(3,"Hypertile VAE max depth",gr.Slider,{"minimum":0,"maximum":3,"step":1},infotext="Hypertile VAE max depth"),
"hypertile_max_depth_vae":shared.OptionInfo(3,"Hypertile VAE max depth",gr.Slider,{"minimum":0,"maximum":3,"step":1},infotext="Hypertile VAE max depth"),
"hypertile_max_tile_vae":shared.OptionInfo(128,"Hypertile VAE max tile size",gr.Slider,{"minimum":0,"maximum":512,"step":16},infotext="Hypertile VAE max tile size"),
"hypertile_max_tile_vae":shared.OptionInfo(128,"Hypertile VAE max tile size",gr.Slider,{"minimum":0,"maximum":512,"step":16},infotext="Hypertile VAE max tile size"),
xyz_grid.AxisOption("[Hypertile] Unet First pass Enabled",str,xyz_grid.apply_override('hypertile_enable_unet',boolean=True),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Second pass Enabled",str,xyz_grid.apply_override('hypertile_enable_unet_secondpass',boolean=True),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Max Depth",int,xyz_grid.apply_override("hypertile_max_depth_unet"),confirm=xyz_grid.confirm_range(0,3,'[Hypertile] Unet Max Depth'),choices=lambda:[str(x)forxinrange(4)]),
xyz_grid.AxisOption("[Hypertile] Unet Max Tile Size",int,xyz_grid.apply_override("hypertile_max_tile_unet"),confirm=xyz_grid.confirm_range(0,512,'[Hypertile] Unet Max Tile Size')),
xyz_grid.AxisOption("[Hypertile] VAE Max Depth",int,xyz_grid.apply_override("hypertile_max_depth_vae"),confirm=xyz_grid.confirm_range(0,3,'[Hypertile] VAE Max Depth'),choices=lambda:[str(x)forxinrange(4)]),
xyz_grid.AxisOption("[Hypertile] VAE Max Tile Size",int,xyz_grid.apply_override("hypertile_max_tile_vae"),confirm=xyz_grid.confirm_range(0,512,'[Hypertile] VAE Max Tile Size')),
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)),
parser.add_argument("--loglevel",type=str,help="log level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG",default=None)
parser.add_argument("--loglevel",type=str,help="log level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG",default=None)
parser.add_argument("--do-not-download-clip",action='store_true',help="do not download CLIP model even if it's not included in the checkpoint")
parser.add_argument("--do-not-download-clip",action='store_true',help="do not download CLIP model even if it's not included in the checkpoint")
parser.add_argument("--data-dir",type=normalized_filepath,default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))),help="base path where all user data is stored")
parser.add_argument("--data-dir",type=normalized_filepath,default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))),help="base path where all user data is stored")
parser.add_argument("--models-dir",type=normalized_filepath,default=None,help="base path where models are stored; overrides --data-dir")
parser.add_argument("--config",type=normalized_filepath,default=sd_default_config,help="path to config which constructs model",)
parser.add_argument("--config",type=normalized_filepath,default=sd_default_config,help="path to config which constructs model",)
parser.add_argument("--ckpt",type=normalized_filepath,default=sd_model_file,help="path to checkpoint of stable diffusion model; if specified, this checkpoint will be added to the list of checkpoints and loaded",)
parser.add_argument("--ckpt",type=normalized_filepath,default=sd_model_file,help="path to checkpoint of stable diffusion model; if specified, this checkpoint will be added to the list of checkpoints and loaded",)
parser.add_argument("--ckpt-dir",type=normalized_filepath,default=None,help="Path to directory with stable diffusion checkpoints")
parser.add_argument("--ckpt-dir",type=normalized_filepath,default=None,help="Path to directory with stable diffusion checkpoints")
parser.add_argument("--lowram",action='store_true',help="load stable diffusion checkpoint weights to VRAM instead of RAM")
parser.add_argument("--lowram",action='store_true',help="load stable diffusion checkpoint weights to VRAM instead of RAM")
parser.add_argument("--always-batch-cond-uncond",action='store_true',help="does not do anything")
parser.add_argument("--always-batch-cond-uncond",action='store_true',help="does not do anything")
parser.add_argument("--unload-gfpgan",action='store_true',help="does not do anything.")
parser.add_argument("--unload-gfpgan",action='store_true',help="does not do anything.")
parser.add_argument("--precision",type=str,help="evaluate at this precision",choices=["full","autocast"],default="autocast")
parser.add_argument("--precision",type=str,help="evaluate at this precision",choices=["full","half","autocast"],default="autocast")
parser.add_argument("--upcast-sampling",action='store_true',help="upcast sampling. No effect with --no-half. Usually produces similar results to --no-half with better performance while using less memory.")
parser.add_argument("--upcast-sampling",action='store_true',help="upcast sampling. No effect with --no-half. Usually produces similar results to --no-half with better performance while using less memory.")
parser.add_argument("--share",action='store_true',help="use share=True for gradio and make the UI accessible through their site")
parser.add_argument("--share",action='store_true',help="use share=True for gradio and make the UI accessible through their site")
parser.add_argument("--ngrok",type=str,help="ngrok authtoken, alternative to gradio --share",default=None)
parser.add_argument("--ngrok",type=str,help="ngrok authtoken, alternative to gradio --share",default=None)
message="A tensor with all NaNs was produced in Unet."
message="A tensor with NaNs was produced in Unet."
ifnotshared.cmd_opts.no_half:
ifnotshared.cmd_opts.no_half:
message+=" This could be either because there's not enough precision to represent the picture, or because your video card does not support half type. Try setting the \"Upcast cross attention layer to float32\" option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this."
message+=" This could be either because there's not enough precision to represent the picture, or because your video card does not support half type. Try setting the \"Upcast cross attention layer to float32\" option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this."
elifwhere=="vae":
elifwhere=="vae":
message="A tensor with all NaNs was produced in VAE."
"save_images_before_color_correction":OptionInfo(False,"Save a copy of image before applying color correction to img2img results"),
"save_images_before_color_correction":OptionInfo(False,"Save a copy of image before applying color correction to img2img results"),
"save_mask":OptionInfo(False,"For inpainting, save a copy of the greyscale mask"),
"save_mask":OptionInfo(False,"For inpainting, save a copy of the greyscale mask"),
"save_mask_composite":OptionInfo(False,"For inpainting, save a masked composite"),
"save_mask_composite":OptionInfo(False,"For inpainting, save a masked composite"),
"jpeg_quality":OptionInfo(80,"Quality for saved jpeg images",gr.Slider,{"minimum":1,"maximum":100,"step":1}),
"jpeg_quality":OptionInfo(80,"Quality for saved jpeg and avif images",gr.Slider,{"minimum":1,"maximum":100,"step":1}),
"webp_lossless":OptionInfo(False,"Use lossless compression for webp images"),
"webp_lossless":OptionInfo(False,"Use lossless compression for webp images"),
"export_for_4chan":OptionInfo(True,"Save copy of large images as JPG").info("if the file size is above the limit, or either width or height are above the limit"),
"export_for_4chan":OptionInfo(True,"Save copy of large images as JPG").info("if the file size is above the limit, or either width or height are above the limit"),
"img_downscale_threshold":OptionInfo(4.0,"File size limit for the above option, MB",gr.Number),
"img_downscale_threshold":OptionInfo(4.0,"File size limit for the above option, MB",gr.Number),
"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},infotext='NGMS').link("PR","https://github.com/AUTOMATIC1111/stablediffusion-webui/pull/9177").info("skip negative prompt for some steps when the image is almost ready; 0=disable, higher=faster"),
"s_min_uncond_all":OptionInfo(False,"Negative Guidance minimum sigma all steps",infotext='NGMS all steps').info("By default, NGMS above skips every other step; this makes it skip all steps"),
"token_merging_ratio_img2img":OptionInfo(0.0,"Token merging ratio for img2img",gr.Slider,{"minimum":0.0,"maximum":0.9,"step":0.1}).info("only applies if non-zero and overrides above"),
"token_merging_ratio_img2img":OptionInfo(0.0,"Token merging ratio for img2img",gr.Slider,{"minimum":0.0,"maximum":0.9,"step":0.1}).info("only applies if non-zero and overrides above"),
"token_merging_ratio_hr":OptionInfo(0.0,"Token merging ratio for high-res pass",gr.Slider,{"minimum":0.0,"maximum":0.9,"step":0.1},infotext='Token merging ratio hr').info("only applies if non-zero and overrides above"),
"token_merging_ratio_hr":OptionInfo(0.0,"Token merging ratio for high-res pass",gr.Slider,{"minimum":0.0,"maximum":0.9,"step":0.1},infotext='Token merging ratio hr').info("only applies if non-zero and overrides above"),
'uni_pc_order':OptionInfo(3,"UniPC order",gr.Slider,{"minimum":1,"maximum":50,"step":1},infotext='UniPC order').info("must be < sampling steps"),
'uni_pc_order':OptionInfo(3,"UniPC order",gr.Slider,{"minimum":1,"maximum":50,"step":1},infotext='UniPC order').info("must be < sampling steps"),
'uni_pc_lower_order_final':OptionInfo(True,"UniPC lower order final",infotext='UniPC lower order final'),
'uni_pc_lower_order_final':OptionInfo(True,"UniPC lower order final",infotext='UniPC lower order final'),
'sd_noise_schedule':OptionInfo("Default","Noise schedule for sampling",gr.Radio,{"choices":["Default","Zero Terminal SNR"]},infotext="Noise Schedule").info("for use with zero terminal SNR trained models")
'sd_noise_schedule':OptionInfo("Default","Noise schedule for sampling",gr.Radio,{"choices":["Default","Zero Terminal SNR"]},infotext="Noise Schedule").info("for use with zero terminal SNR trained models"),
'skip_early_cond':OptionInfo(0.0,"Ignore negative prompt during early sampling",gr.Slider,{"minimum":0.0,"maximum":1.0,"step":0.01},infotext="Skip Early CFG").info("disables CFG on a proportion of steps at the beginning of generation; 0=skip none; 1=skip all; can both improve sample diversity/quality and speed up sampling"),
img2img_batch_use_png_info=gr.Checkbox(label="Append png info to prompts",**shared.hide_dirs,elem_id="img2img_batch_use_png_info")
img2img_batch_use_png_info=gr.Checkbox(label="Append png info to prompts",elem_id="img2img_batch_use_png_info")
img2img_batch_png_info_dir=gr.Textbox(label="PNG info directory",**shared.hide_dirs,placeholder="Leave empty to use input directory",elem_id="img2img_batch_png_info_dir")
img2img_batch_png_info_dir=gr.Textbox(label="PNG info directory",**shared.hide_dirs,placeholder="Leave empty to use input directory",elem_id="img2img_batch_png_info_dir")
img2img_batch_png_info_props=gr.CheckboxGroup(["Prompt","Negative prompt","Seed","CFG scale","Sampler","Steps","Model hash"],label="Parameters to take from png info",info="Prompts from png info will be appended to prompts set in ui.")
img2img_batch_png_info_props=gr.CheckboxGroup(["Prompt","Negative prompt","Seed","CFG scale","Sampler","Steps","Model hash"],label="Parameters to take from png info",info="Prompts from png info will be appended to prompts set in ui.")
hide_tags=gr.CheckboxGroup(value=["ads","localization","installed"],label="Hide extensions with tags",choices=["script","ads","localization","installed"])