The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Add model detection error hint for lora. (#8880)
comfyanonymousb40143984c1b
diff --git a/comfy/sd.py b/comfy/sd.pyindex 5b95cf75a..8081b167c 100644--- a/comfy/sd.py+++ b/comfy/sd.py@@ -18,6 +18,7 @@ import comfy.ldm.hunyuan3d.vaeimport comfy.ldm.ace.vae.music_dcae_pipelineimport yamlimport math+import osimport comfy.utils@@ -977,6 +978,12 @@ def load_gligen(ckpt_path):model = model.half()return comfy.model_patcher.ModelPatcher(model, load_device=model_management.get_torch_device(), offload_device=model_management.unet_offload_device())+def model_detection_error_hint(path, state_dict):+ filename = os.path.basename(path)+ if 'lora' in filename.lower():+ 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.."+ return ""+def load_checkpoint(config_path=None, ckpt_path=None, output_vae=True, output_clip=True, embedding_directory=None, state_dict=None, config=None):logging.warning("Warning: The load checkpoint with config function is deprecated and will eventually be removed, please use the other one.")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, osd, metadata = comfy.utils.load_torch_file(ckpt_path, return_metadata=True)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)if out is None:- raise RuntimeError("ERROR: Could not detect model type of: {}".format(ckpt_path))+ raise RuntimeError("ERROR: Could not detect model type of: {}\n{}".format(ckpt_path, model_detection_error_hint(ckpt_path, sd)))return outdef 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={}):model = load_diffusion_model_state_dict(sd, model_options=model_options)if model is None:logging.error("ERROR UNSUPPORTED DIFFUSION MODEL {}".format(unet_path))- raise RuntimeError("ERROR: Could not detect model type of: {}".format(unet_path))+ raise RuntimeError("ERROR: Could not detect model type of: {}\n{}".format(unet_path, model_detection_error_hint(unet_path, sd)))return modeldef load_unet(unet_path, dtype=None):