Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed May 9, 2024
1 parent b1cbfe1 commit bd12944
Show file tree
Hide file tree
Showing 5 changed files with 2,709 additions and 6 deletions.
15 changes: 10 additions & 5 deletions convert_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@

from comfy.diffusers_convert import convert_unet_state_dict

ic_light_root = os.path.join(folder_paths.models_dir, "ic_light")
model_path = os.path.join(ic_light_root, "iclight_sd15_fbc.safetensors")

sd_dict = convert_unet_state_dict(safetensors.torch.load_file(model_path))
sd_dict = {key: sd_dict[key].half() for key in sd_dict.keys()}
safetensors.torch.save_file(sd_dict, "iclight_sd15_fbc_unet_ldm.safetensors")
def convert_weight():
src = "iclight_sd15_fbc.safetensors"
dest = "iclight_sd15_fbc_unet_ldm.safetensors"

ic_light_root = os.path.join(folder_paths.models_dir, "ic_light")
model_path = os.path.join(ic_light_root, src)

sd_dict = convert_unet_state_dict(safetensors.torch.load_file(model_path))
sd_dict = {key: sd_dict[key].half() for key in sd_dict.keys()}
safetensors.torch.save_file(sd_dict, dest)
Loading

0 comments on commit bd12944

Please sign in to comment.