mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 02:15:17 +00:00
Compare commits
4 Commits
957c6892ff
...
0817453286
Author | SHA1 | Date | |
---|---|---|---|
|
0817453286 | ||
|
d0f3752e33 | ||
|
c515bdf371 | ||
|
fa87f263ce |
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class AppSettings():
|
class AppSettings():
|
||||||
@ -11,8 +12,12 @@ class AppSettings():
|
|||||||
file = self.user_manager.get_request_user_filepath(
|
file = self.user_manager.get_request_user_filepath(
|
||||||
request, "comfy.settings.json")
|
request, "comfy.settings.json")
|
||||||
if os.path.isfile(file):
|
if os.path.isfile(file):
|
||||||
|
try:
|
||||||
with open(file) as f:
|
with open(file) as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
except:
|
||||||
|
logging.error(f"The user settings file is corrupted: {file}")
|
||||||
|
return {}
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -5,12 +5,15 @@ import comfy.utils
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
def prepare_noise(latent_image, seed, noise_inds=None):
|
def prepare_noise(latent_image, seed, noise_inds=None, disable_noise=False):
|
||||||
"""
|
"""
|
||||||
creates random noise given a latent image and a seed.
|
creates random noise given a latent image and a seed.
|
||||||
optional arg skip can be used to skip and discard x number of noise generations for a given seed
|
optional arg skip can be used to skip and discard x number of noise generations for a given seed
|
||||||
"""
|
"""
|
||||||
generator = torch.manual_seed(seed)
|
generator = torch.manual_seed(seed)
|
||||||
|
if disable_noise:
|
||||||
|
return torch.zeros(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
|
||||||
|
|
||||||
if noise_inds is None:
|
if noise_inds is None:
|
||||||
return torch.randn(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, generator=generator, device="cpu")
|
return torch.randn(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, generator=generator, device="cpu")
|
||||||
|
|
||||||
|
@ -227,8 +227,9 @@ class T5(torch.nn.Module):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_layers = config_dict["num_layers"]
|
self.num_layers = config_dict["num_layers"]
|
||||||
model_dim = config_dict["d_model"]
|
model_dim = config_dict["d_model"]
|
||||||
|
inner_dim = config_dict["d_kv"] * config_dict["num_heads"]
|
||||||
|
|
||||||
self.encoder = T5Stack(self.num_layers, model_dim, model_dim, config_dict["d_ff"], config_dict["dense_act_fn"], config_dict["is_gated_act"], config_dict["num_heads"], config_dict["model_type"] != "umt5", dtype, device, operations)
|
self.encoder = T5Stack(self.num_layers, model_dim, inner_dim, config_dict["d_ff"], config_dict["dense_act_fn"], config_dict["is_gated_act"], config_dict["num_heads"], config_dict["model_type"] != "umt5", dtype, device, operations)
|
||||||
self.dtype = dtype
|
self.dtype = dtype
|
||||||
self.shared = operations.Embedding(config_dict["vocab_size"], model_dim, device=device, dtype=dtype)
|
self.shared = operations.Embedding(config_dict["vocab_size"], model_dim, device=device, dtype=dtype)
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ class Noise_EmptyNoise:
|
|||||||
|
|
||||||
def generate_noise(self, input_latent):
|
def generate_noise(self, input_latent):
|
||||||
latent_image = input_latent["samples"]
|
latent_image = input_latent["samples"]
|
||||||
return torch.zeros(latent_image.shape, dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
|
return comfy.sample.prepare_noise(latent_image, self.seed, disable_noise=True)
|
||||||
|
|
||||||
|
|
||||||
class Noise_RandomNoise:
|
class Noise_RandomNoise:
|
||||||
|
5
nodes.py
5
nodes.py
@ -1485,11 +1485,8 @@ def common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive,
|
|||||||
latent_image = latent["samples"]
|
latent_image = latent["samples"]
|
||||||
latent_image = comfy.sample.fix_empty_latent_channels(model, latent_image)
|
latent_image = comfy.sample.fix_empty_latent_channels(model, latent_image)
|
||||||
|
|
||||||
if disable_noise:
|
|
||||||
noise = torch.zeros(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
|
|
||||||
else:
|
|
||||||
batch_inds = latent["batch_index"] if "batch_index" in latent else None
|
batch_inds = latent["batch_index"] if "batch_index" in latent else None
|
||||||
noise = comfy.sample.prepare_noise(latent_image, seed, batch_inds)
|
noise = comfy.sample.prepare_noise(latent_image, seed, batch_inds, disable_noise)
|
||||||
|
|
||||||
noise_mask = None
|
noise_mask = None
|
||||||
if "noise_mask" in latent:
|
if "noise_mask" in latent:
|
||||||
|
Loading…
Reference in New Issue
Block a user