mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-22 15:59:45 +08:00
Update nodes_latent.py
This commit is contained in:
parent
39da6c3fda
commit
53798281a1
@ -2,7 +2,7 @@ import torch
|
|||||||
from nodes import MAX_RESOLUTION
|
from nodes import MAX_RESOLUTION
|
||||||
|
|
||||||
# diffusers library scale the random noise
|
# diffusers library scale the random noise
|
||||||
vae_scaling_factor = 0.18215
|
vae_scaling_factor = 0.18215 # doesn't work
|
||||||
|
|
||||||
class NoisyLatentImage:
|
class NoisyLatentImage:
|
||||||
def __init__(self, device="cpu"):
|
def __init__(self, device="cpu"):
|
||||||
@ -22,7 +22,7 @@ class NoisyLatentImage:
|
|||||||
|
|
||||||
def generate(self, seed, width, height, batch_size=1):
|
def generate(self, seed, width, height, batch_size=1):
|
||||||
generator = torch.manual_seed(seed)
|
generator = torch.manual_seed(seed)
|
||||||
latent = torch.randn([batch_size, 4, height // 8, width // 8], generator=generator, device=self.device) * vae_scaling_factor
|
latent = torch.randn([batch_size, 4, height // 8, width // 8], generator=generator, device=self.device)
|
||||||
return ({"samples":latent}, )
|
return ({"samples":latent}, )
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user