|
18 | 18 | import comfy.ldm.ace.vae.music_dcae_pipeline |
19 | 19 | import yaml |
20 | 20 | import math |
| 21 | +import os |
21 | 22 |
|
22 | 23 | import comfy.utils |
23 | 24 |
|
@@ -977,6 +978,12 @@ def load_gligen(ckpt_path): |
977 | 978 | model = model.half() |
978 | 979 | return comfy.model_patcher.ModelPatcher(model, load_device=model_management.get_torch_device(), offload_device=model_management.unet_offload_device()) |
979 | 980 |
|
| 981 | +def model_detection_error_hint(path, state_dict): |
| 982 | + filename = os.path.basename(path) |
| 983 | + if 'lora' in filename.lower(): |
| 984 | + return "\nHINT: This seems to be a Lora file and Lora files should be put in the lora folder and loaded with a lora loader node.." |
| 985 | + return "" |
| 986 | + |
980 | 987 | def load_checkpoint(config_path=None, ckpt_path=None, output_vae=True, output_clip=True, embedding_directory=None, state_dict=None, config=None): |
981 | 988 | logging.warning("Warning: The load checkpoint with config function is deprecated and will eventually be removed, please use the other one.") |
982 | 989 | model, clip, vae, _ = load_checkpoint_guess_config(ckpt_path, output_vae=output_vae, output_clip=output_clip, output_clipvision=False, embedding_directory=embedding_directory, output_model=True) |
@@ -1005,7 +1012,7 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o |
1005 | 1012 | sd, metadata = comfy.utils.load_torch_file(ckpt_path, return_metadata=True) |
1006 | 1013 | out = load_state_dict_guess_config(sd, output_vae, output_clip, output_clipvision, embedding_directory, output_model, model_options, te_model_options=te_model_options, metadata=metadata) |
1007 | 1014 | if out is None: |
1008 | | - raise RuntimeError("ERROR: Could not detect model type of: {}".format(ckpt_path)) |
| 1015 | + raise RuntimeError("ERROR: Could not detect model type of: {}\n{}".format(ckpt_path, model_detection_error_hint(ckpt_path, sd))) |
1009 | 1016 | return out |
1010 | 1017 |
|
1011 | 1018 | def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_clipvision=False, embedding_directory=None, output_model=True, model_options={}, te_model_options={}, metadata=None): |
@@ -1177,7 +1184,7 @@ def load_diffusion_model(unet_path, model_options={}): |
1177 | 1184 | model = load_diffusion_model_state_dict(sd, model_options=model_options) |
1178 | 1185 | if model is None: |
1179 | 1186 | logging.error("ERROR UNSUPPORTED DIFFUSION MODEL {}".format(unet_path)) |
1180 | | - raise RuntimeError("ERROR: Could not detect model type of: {}".format(unet_path)) |
| 1187 | + raise RuntimeError("ERROR: Could not detect model type of: {}\n{}".format(unet_path, model_detection_error_hint(unet_path, sd))) |
1181 | 1188 | return model |
1182 | 1189 |
|
1183 | 1190 | def load_unet(unet_path, dtype=None): |
|
0 commit comments