import fixes

This commit is contained in:
kijai 2024-05-03 01:00:33 +03:00
parent 9fa6a26689
commit 85bd6dfccb
2 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import folder_paths
import os import os
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
from comfy.utils import ProgressBar from comfy.utils import ProgressBar, load_torch_file
import comfy.sample import comfy.sample
from nodes import CLIPTextEncode from nodes import CLIPTextEncode
@ -82,7 +82,7 @@ with this node pack.
#load lora #load lora
model_clone = model.clone() model_clone = model.clone()
lora_path = folder_paths.get_full_path("intristic_loras", lora_name) lora_path = folder_paths.get_full_path("intristic_loras", lora_name)
lora = comfy.utils.load_torch_file(lora_path, safe_load=True) lora = load_torch_file(lora_path, safe_load=True)
self.loaded_lora = (lora_path, lora) self.loaded_lora = (lora_path, lora)
model_clone_with_lora = comfy.sd.load_lora_for_models(model_clone, None, lora, 1.0, 0)[0] model_clone_with_lora = comfy.sd.load_lora_for_models(model_clone, None, lora, 1.0, 0)[0]

View File

@ -2195,9 +2195,10 @@ class StableZero123_BatchSchedule:
CATEGORY = "KJNodes/experimental" CATEGORY = "KJNodes/experimental"
def encode(self, clip_vision, init_image, vae, width, height, batch_size, azimuth_points_string, elevation_points_string, interpolation): def encode(self, clip_vision, init_image, vae, width, height, batch_size, azimuth_points_string, elevation_points_string, interpolation):
from comfy.utils import common_upscale
output = clip_vision.encode_image(init_image) output = clip_vision.encode_image(init_image)
pooled = output.image_embeds.unsqueeze(0) pooled = output.image_embeds.unsqueeze(0)
pixels = comfy.utils.common_upscale(init_image.movedim(-1,1), width, height, "bilinear", "center").movedim(1,-1) pixels = common_upscale(init_image.movedim(-1,1), width, height, "bilinear", "center").movedim(1,-1)
encode_pixels = pixels[:,:,:,:3] encode_pixels = pixels[:,:,:,:3]
t = vae.encode(encode_pixels) t = vae.encode(encode_pixels)
@ -2488,9 +2489,10 @@ class LoadResAdapterNormalization:
raise Exception("Invalid model path") raise Exception("Invalid model path")
else: else:
print("ResAdapter: Loading ResAdapter normalization weights") print("ResAdapter: Loading ResAdapter normalization weights")
from comfy.utils import load_torch_file
prefix_to_remove = 'diffusion_model.' prefix_to_remove = 'diffusion_model.'
model_clone = model.clone() model_clone = model.clone()
norm_state_dict = comfy.utils.load_torch_file(resadapter_full_path) norm_state_dict = load_torch_file(resadapter_full_path)
new_values = {key[len(prefix_to_remove):]: value for key, value in norm_state_dict.items() if key.startswith(prefix_to_remove)} new_values = {key[len(prefix_to_remove):]: value for key, value in norm_state_dict.items() if key.startswith(prefix_to_remove)}
print("ResAdapter: Attempting to add patches with ResAdapter weights") print("ResAdapter: Attempting to add patches with ResAdapter weights")
try: try: