This commit is contained in:
arcticfaded 2022-11-05 01:30:43 -04:00
parent 27b5d7c6b2
commit 22c07148e6
4 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,7 @@ from modules.api.models import *
from modules.processing import StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img, process_images
from modules.sd_samplers import all_samplers
from modules.extras import run_extras, run_pnginfo
from modules.sd_models import checkpoints_list, get_closet_checkpoint_match, reload_model_weights
from modules.sd_models import checkpoints_list, get_closest_checkpoint_match, reload_model_weights
from modules.realesrgan_model import get_realesrgan_models
from typing import List
@ -251,7 +251,7 @@ class Api:
def set_sd_models(self, req: LoadModelRequest):
name = req.name
info = get_closet_checkpoint_match(name)
info = get_closest_checkpoint_match(name)
if info is None:
raise HTTPException(status_code=404, detail="Checkpoint not found")

View File

@ -84,7 +84,7 @@ def list_models():
checkpoints_list[title] = CheckpointInfo(filename, title, h, short_model_name, config)
def get_closet_checkpoint_match(searchString):
def get_closest_checkpoint_match(searchString):
applicable = sorted([info for info in checkpoints_list.values() if searchString in info.title], key = lambda x:len(x.title))
if len(applicable) > 0:
return applicable[0]

View File

@ -542,7 +542,7 @@ def apply_setting(key, value):
return gr.update()
if key == "sd_model_checkpoint":
ckpt_info = sd_models.get_closet_checkpoint_match(value)
ckpt_info = sd_models.get_closest_checkpoint_match(value)
if ckpt_info is not None:
value = ckpt_info.title

View File

@ -85,7 +85,7 @@ def confirm_samplers(p, xs):
def apply_checkpoint(p, x, xs):
info = modules.sd_models.get_closet_checkpoint_match(x)
info = modules.sd_models.get_closest_checkpoint_match(x)
if info is None:
raise RuntimeError(f"Unknown checkpoint: {x}")
modules.sd_models.reload_model_weights(shared.sd_model, info)
@ -94,7 +94,7 @@ def apply_checkpoint(p, x, xs):
def confirm_checkpoints(p, xs):
for x in xs:
if modules.sd_models.get_closet_checkpoint_match(x) is None:
if modules.sd_models.get_closest_checkpoint_match(x) is None:
raise RuntimeError(f"Unknown checkpoint: {x}")