mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-10 05:22:34 +08:00
Merge pull request #1 from Saquib764/Saquib764-patch-1
Added NoisyLatentImage node in nodes.py
This commit is contained in:
commit
546aa4abc4
21
nodes.py
21
nodes.py
@ -871,6 +871,27 @@ class EmptyLatentImage:
|
|||||||
latent = torch.zeros([batch_size, 4, height // 8, width // 8])
|
latent = torch.zeros([batch_size, 4, height // 8, width // 8])
|
||||||
return ({"samples":latent}, )
|
return ({"samples":latent}, )
|
||||||
|
|
||||||
|
class NoisyLatentImage:
|
||||||
|
def __init__(self, device="cpu"):
|
||||||
|
self.device = device
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required": {
|
||||||
|
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||||
|
"width": ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8}),
|
||||||
|
"height": ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8}),
|
||||||
|
"batch_size": ("INT", {"default": 1, "min": 1, "max": 64})}}
|
||||||
|
RETURN_TYPES = ("LATENT",)
|
||||||
|
FUNCTION = "generate"
|
||||||
|
|
||||||
|
CATEGORY = "latent"
|
||||||
|
|
||||||
|
def generate(self, seed, width, height, batch_size=1):
|
||||||
|
generator = torch.manual_seed(seed)
|
||||||
|
latent = torch.randn([batch_size, 4, height // 8, width // 8], generator=generator, device=self.device)
|
||||||
|
return ({"samples":latent}, )
|
||||||
|
|
||||||
|
|
||||||
class LatentFromBatch:
|
class LatentFromBatch:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user