sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True)# Reload embeddings after model load as they may or may not fit the model
print(f"Unloading model {len(model_data.loaded_sd_models)} over the limit of {shared.opts.sd_checkpoints_limit}: {loaded_model.sd_checkpoint_info.title}")
model_data.loaded_sd_models.pop()
send_model_to_trash(loaded_model)
timer.record("send model to trash")
ifshared.opts.sd_checkpoints_keep_in_cpu:
send_model_to_cpu(sd_model)
timer.record("send model to cpu")
ifalready_loadedisnotNone:
send_model_to_device(already_loaded)
timer.record("send model to device")
model_data.set_sd_model(already_loaded)
print(f"Using already loaded model {already_loaded.sd_checkpoint_info.title}: done in {timer.summary()}")
"print_hypernet_extra":OptionInfo(False,"Print extra hypernetwork information to console."),
"list_hidden_files":OptionInfo(True,"Load models/files in hidden directories").info("directory is hidden if its name starts with \".\""),
"disable_mmap_load_safetensors":OptionInfo(False,"Disable memmapping for loading .safetensors files.").info("fixes very slow loading speed in some cases"),
"hide_ldm_prints":OptionInfo(True,"Prevent Stability-AI's ldm/sgm modules from printing noise to console."),
"sd_checkpoint_cache":OptionInfo(0,"Checkpoints to cache in RAM",gr.Slider,{"minimum":0,"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_checkpoint_cache":OptionInfo(0,"Checkpoints to cache in RAM",gr.Slider,{"minimum":0,"maximum":10,"step":1}).info("obsolete; set to 0 and use the two settings above instead"),
"sd_vae_checkpoint_cache":OptionInfo(0,"VAE Checkpoints to cache in RAM",gr.Slider,{"minimum":0,"maximum":10,"step":1}),
"sd_vae":OptionInfo("Automatic","SD VAE",gr.Dropdown,lambda:{"choices":shared_items.sd_vae_items()},refresh=shared_items.refresh_vae_list).info("choose VAE model: Automatic = use one with same filename as checkpoint; None = use VAE from checkpoint"),
"sd_vae_as_default":OptionInfo(True,"Ignore selected VAE for stable diffusion checkpoints that have their own .vae.pt next to them"),
"sd_unet":OptionInfo("Automatic","SD Unet",gr.Dropdown,lambda:{"choices":shared_items.sd_unet_items()},refresh=shared_items.refresh_unet_list).info("choose Unet model: Automatic = use one with same filename as checkpoint; None = use Unet from checkpoint"),
"initial_noise_multiplier":OptionInfo(1.0,"Noise multiplier for img2img",gr.Slider,{"minimum":0.5,"maximum":1.5,"step":0.01}),
"img2img_color_correction":OptionInfo(False,"Apply color correction to img2img results to match original colors."),
"img2img_fix_steps":OptionInfo(False,"With img2img, do exactly the amount of steps the slider specifies.").info("normally you'd do less with less denoising"),
"img2img_background_color":OptionInfo("#ffffff","With img2img, fill image's transparent parts with this color.",ui_components.FormColorPicker,{}),
"enable_quantization":OptionInfo(False,"Enable quantization in K samplers for sharper and cleaner results. This may change existing seeds. Requires restart to apply."),
"enable_quantization":OptionInfo(False,"Enable quantization in K samplers for sharper and cleaner results. This may change existing seeds").needs_restart(),
"enable_emphasis":OptionInfo(True,"Enable emphasis").info("use (text) to make model pay more attention to text and [text] to make it pay less attention"),
"enable_batch_seeds":OptionInfo(True,"Make K-diffusion samplers produce same images in a batch as when making a single image"),
"comma_padding_backtrack":OptionInfo(20,"Prompt word wrap length limit",gr.Slider,{"minimum":0,"maximum":74,"step":1}).info("in tokens - for texts shorter than specified, if they don't fit into 75 token limit, move them to the next 75 token chunk"),
"initial_noise_multiplier":OptionInfo(1.0,"Noise multiplier for img2img",gr.Slider,{"minimum":0.5,"maximum":1.5,"step":0.01}),
"img2img_color_correction":OptionInfo(False,"Apply color correction to img2img results to match original colors."),
"img2img_fix_steps":OptionInfo(False,"With img2img, do exactly the amount of steps the slider specifies.").info("normally you'd do less with less denoising"),
"img2img_background_color":OptionInfo("#ffffff","With img2img, fill transparent parts of the input image with this color.",ui_components.FormColorPicker,{}),
"img2img_editor_height":OptionInfo(720,"Height of the image editor",gr.Slider,{"minimum":80,"maximum":1600,"step":1}).info("in pixels").needs_restart(),
"img2img_sketch_default_brush_color":OptionInfo("#ffffff","Sketch initial brush color",ui_components.FormColorPicker,{}).info("default brush color of img2img sketch").needs_restart(),
"img2img_inpaint_mask_brush_color":OptionInfo("#ffffff","Inpaint mask brush color",ui_components.FormColorPicker,{}).info("brush color of inpaint mask").needs_restart(),
"img2img_inpaint_sketch_default_brush_color":OptionInfo("#ffffff","Inpaint sketch initial brush color",ui_components.FormColorPicker,{}).info("default brush color of img2img inpaint sketch").needs_restart(),
"return_mask":OptionInfo(False,"For inpainting, include the greyscale mask in results for web"),
"return_mask_composite":OptionInfo(False,"For inpainting, include masked composite in results for web"),
"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"),
self.negative_prompt=gr.Textbox(label="Negative prompt",elem_id=f"{id_part}_neg_prompt",show_label=False,lines=3,placeholder="Negative prompt (press Ctrl+Enter or Alt+Enter to generate)",elem_classes=["prompt"])
hr_checkpoint_name=gr.Dropdown(label='Hires checkpoint',elem_id="hr_checkpoint",choices=["Use same checkpoint"]+modules.sd_models.checkpoint_tiles(use_short=True),value="Use same checkpoint")
create_refresh_button(hr_checkpoint_name,modules.sd_models.list_models,lambda:{"choices":["Use same checkpoint"]+modules.sd_models.checkpoint_tiles(use_short=True)},"hr_checkpoint_refresh")
hr_sampler_index=gr.Dropdown(label='Hires sampling method',elem_id="hr_sampler",choices=["Use same sampler"]+[x.nameforxinsamplers_for_img2img],value="Use same sampler",type="index")
(hr_sampler_container,lambdad:gr.update(visible=True)ifd.get("Hires sampler","Use same sampler")!="Use same sampler"elsegr.update()),
(hr_sampler_container,lambdad:gr.update(visible=True)ifd.get("Hires sampler","Use same sampler")!="Use same sampler"ord.get("Hires checkpoint","Use same checkpoint")!="Use same checkpoint"elsegr.update()),
sketch=gr.Image(label="Image for img2img",elem_id="img2img_sketch",show_label=False,source="upload",interactive=True,type="pil",tool="color-sketch",image_mode="RGBA",height=opts.img2img_editor_height)
sketch=gr.Image(label="Image for img2img",elem_id="img2img_sketch",show_label=False,source="upload",interactive=True,type="pil",tool="color-sketch",image_mode="RGBA",height=opts.img2img_editor_height,brush_color=opts.img2img_sketch_default_brush_color)
init_img_with_mask=gr.Image(label="Image for inpainting with mask",show_label=False,elem_id="img2maskimg",source="upload",interactive=True,type="pil",tool="sketch",image_mode="RGBA",height=opts.img2img_editor_height,brush_color='#ffffff')
init_img_with_mask=gr.Image(label="Image for inpainting with mask",show_label=False,elem_id="img2maskimg",source="upload",interactive=True,type="pil",tool="sketch",image_mode="RGBA",height=opts.img2img_editor_height,brush_color=opts.img2img_inpaint_mask_brush_color)