From 6b7d5c6871371fa92d46556be4c4ed47565f6a10 Mon Sep 17 00:00:00 2001 From: ClownsharkBatwing Date: Fri, 26 Jul 2024 15:52:41 -0400 Subject: [PATCH 1/3] Add files via upload --- ultrapixel.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ultrapixel.py b/ultrapixel.py index ab99c54..651771e 100644 --- a/ultrapixel.py +++ b/ultrapixel.py @@ -16,6 +16,7 @@ ) from .train import WurstCore_t2i as WurstCoreC +from safetensors.torch import load_file as load_safetensors class UltraPixel: def __init__( @@ -88,6 +89,9 @@ def set_config( self.prompt = prompt self.controlnet_image = controlnet_image + + + def process(self): device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") torch.manual_seed(self.seed) @@ -141,10 +145,15 @@ def process(self): captions = [self.prompt] height, width = self.height, self.width - sdd = torch.load(self.pretrained, map_location="cpu") + """sdd = torch.load(self.pretrained, map_location="cpu") # this is the old code for loading serialized pytorch binaries (unsafe). kept it here for reference. they had a misleading file extension: ".safetensors". collect_sd = {} for k, v in sdd.items(): - collect_sd[k[7:]] = v + collect_sd[k[7:]] = v""" + + sdd = load_safetensors(self.pretrained) # this is the equivalent code for loading the real safetensors versions of ultrapixel_t2i and lora_cat. + collect_sd = {k: v for k, v in sdd.items()} + collect_sd = {k[7:] if k.startswith('module.') else k: v for k, v in collect_sd.items()} + models.train_norm.load_state_dict(collect_sd) if self.controlnet_image == None: models.train_norm.load_state_dict(collect_sd) From 4a749a509c6ed420e33c04a9c90737b12acc3d6d Mon Sep 17 00:00:00 2001 From: ClownsharkBatwing Date: Sat, 27 Jul 2024 10:51:54 -0400 Subject: [PATCH 2/3] Add files via upload --- ultrapixel.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ultrapixel.py b/ultrapixel.py index 651771e..2fab483 100644 --- a/ultrapixel.py +++ b/ultrapixel.py @@ -144,11 +144,6 @@ def process(self): captions = [self.prompt] height, width = self.height, self.width - - """sdd = torch.load(self.pretrained, map_location="cpu") # this is the old code for loading serialized pytorch binaries (unsafe). kept it here for reference. they had a misleading file extension: ".safetensors". - collect_sd = {} - for k, v in sdd.items(): - collect_sd[k[7:]] = v""" sdd = load_safetensors(self.pretrained) # this is the equivalent code for loading the real safetensors versions of ultrapixel_t2i and lora_cat. collect_sd = {k: v for k, v in sdd.items()} @@ -163,8 +158,8 @@ def process(self): load_or_fail(self.controlnet), strict=True ) - models.generator.eval() - models.train_norm.eval() + models.generator.eval() # stage C + models.train_norm.eval() # stage UP batch_size = 1 edge_image = None From 04c053a423c1caca6f10ce37b553a027e378093c Mon Sep 17 00:00:00 2001 From: ClownsharkBatwing Date: Sat, 27 Jul 2024 10:52:08 -0400 Subject: [PATCH 3/3] Add files via upload --- nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes.py b/nodes.py index eba5bd5..8250daa 100644 --- a/nodes.py +++ b/nodes.py @@ -129,11 +129,11 @@ def INPUT_TYPES(s): "model": ("ULTRAPIXELMODEL",), "height": ( "INT", - {"default": 2048, "min": 512, "max": 5120, "step": 256}, + {"default": 2048, "min": 512, "max": 5120, "step": 8}, ), "width": ( "INT", - {"default": 2048, "min": 512, "max": 5120, "step": 256}, + {"default": 2048, "min": 512, "max": 5120, "step": 8}, ), "seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}), "dtype": (["bf16", "fp32"],),