Skip to content

Commit

Permalink
alternative to load_checkpoint_guess_config that accepts a loaded s…
Browse files Browse the repository at this point in the history
…tate dict (#4249)

* make alternative fn

* add back ckpt path as 2nd argument?
  • Loading branch information
ljleb authored Aug 11, 2024
1 parent 75b9b55 commit 925fff2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions comfy/sd.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,14 @@ class ModelSamplingAdvanced(comfy.model_sampling.ModelSamplingDiscrete, comfy.mo

def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, output_clipvision=False, embedding_directory=None, output_model=True):
sd = comfy.utils.load_torch_file(ckpt_path)
sd_keys = sd.keys()
return load_state_dict_guess_config(sd, ckpt_path, output_vae, output_clip, output_clipvision, embedding_directory, output_model)

def load_state_dict_guess_config(sd, ckpt_path="<memory>", output_vae=True, output_clip=True, output_clipvision=False, embedding_directory=None, output_model=True):
clip = None
clipvision = None
vae = None
model = None
model_patcher = None
clip_target = None

diffusion_model_prefix = model_detection.unet_prefix_from_state_dict(sd)
parameters = comfy.utils.calculate_parameters(sd, diffusion_model_prefix)
Expand Down

0 comments on commit 925fff2

Please sign in to comment.