Update load_models_utils.py

fix runway bug
This commit is contained in:
smthemex
2024-09-06 14:39:00 +08:00
committed by GitHub
parent 3b87edebad
commit fb447a8f61
+9 -6
View File
@@ -19,6 +19,8 @@ def get_instance_path(path):
original_config_file=get_instance_path(os.path.join(path_dir,'config','sd_xl_base.yaml'))
loras_path = get_instance_path(os.path.join(path_dir,"config","lora.yaml"))
add_config="stabilityai/stable-diffusion-xl-base-1.0"
#print(add_config)
def get_lora_dict():
# 打开并读取YAML文件
with open(loras_path, 'r', encoding="UTF-8") as stream:
@@ -41,13 +43,14 @@ def load_models(path,model_type,single_files,use_safetensors,photomake_mode,phot
path=get_instance_path(path)
if model_type == "txt2img":
if single_files:
try:
pipe = StableDiffusionXLPipeline.from_single_file(
path, original_config=original_config_file, torch_dtype=torch.float16)
path,config=add_config, original_config=original_config_file, torch_dtype=torch.float16)
except:
try:
pipe = StableDiffusionXLPipeline.from_single_file(
path, original_config_file=original_config_file,
path,config=add_config, original_config_file=original_config_file,
torch_dtype=torch.float16
)
except:
@@ -72,12 +75,12 @@ def load_models(path,model_type,single_files,use_safetensors,photomake_mode,phot
# print("loading from a single_files")
try:
pipe = PhotoMakerStableDiffusionXLPipeline.from_single_file(
path, original_config=original_config_file,
path,config=add_config, original_config=original_config_file,
torch_dtype=torch.float16, use_safetensors=use_safetensors)
except:
try:
pipe = PhotoMakerStableDiffusionXLPipeline.from_single_file(
path, original_config_file=original_config_file,
path, config=add_config,original_config_file=original_config_file,
torch_dtype=torch.float16, use_safetensors=use_safetensors
)
except:
@@ -99,12 +102,12 @@ def load_models(path,model_type,single_files,use_safetensors,photomake_mode,phot
# print("loading from a single_files")
try:
pipe = PhotoMakerStableDiffusionXLPipelineV2.from_single_file(
path, original_config=original_config_file,
path,config=add_config, original_config=original_config_file,
torch_dtype=torch.float16, use_safetensors=use_safetensors)
except:
try:
pipe = PhotoMakerStableDiffusionXLPipelineV2.from_single_file(
path, original_config_file=original_config_file,
path, config=add_config,original_config_file=original_config_file,
torch_dtype=torch.float16, use_safetensors=use_safetensors
)
except: