fix:sampling missing add some parameters #198

This commit is contained in:
yolain
2024-06-07 11:27:15 +08:00
parent 9639c3a85e
commit d18fec0e16
3 changed files with 31 additions and 12 deletions
-1
View File
@@ -2349,7 +2349,6 @@ class applyInpaint:
else:
raise Exception("Differential Diffusion not found,please update comfyui")
return (new_pipe,)
# ---------------------------------------------------------------Inpaint 结束----------------------------------------------------------------------#
+27 -9
View File
@@ -12,6 +12,7 @@ from PIL import Image, ImageDraw, ImageFilter
from torchvision.transforms import Resize, CenterCrop, GaussianBlur
from torchvision.transforms.functional import to_pil_image
from .libs.log import log_node_info
from .libs.utils import AlwaysEqualProxy
from .libs.image import pil2tensor, tensor2pil, ResizeMode, get_new_bounds, RGB2RGBA, image2mask
from .libs.colorfix import adain_color_fix, wavelet_color_fix
from .libs.chooser import ChooserMessage, ChooserCancelled
@@ -1411,10 +1412,15 @@ class imageToBase64:
return {"result": (base64_str,)}
class removeLocalImage:
def __init__(self):
self.hasFile = False
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"any": (AlwaysEqualProxy("*"),),
"file_name": ("STRING",{"default":""}),
},
}
@@ -1424,15 +1430,27 @@ class removeLocalImage:
FUNCTION = "remove"
CATEGORY = "EasyUse/Image"
def remove(self, file_name):
hasFile = False
for file in os.listdir(folder_paths.input_directory):
name_without_extension, file_extension = os.path.splitext(file)
if name_without_extension == file_name or file == file_name:
os.remove(os.path.join(folder_paths.input_directory, file))
hasFile = True
break
if hasFile:
def remove(self, any, file_name):
self.hasFile = False
def listdir(path, dir_name=''):
for file in os.listdir(path):
file_path = os.path.join(path, file)
if os.path.isdir(file_path):
dir_name = os.path.basename(file_path)
listdir(file_path, dir_name)
else:
file = os.path.join(dir_name, file)
name_without_extension, file_extension = os.path.splitext(file)
if name_without_extension == file_name or file == file_name:
os.remove(os.path.join(folder_paths.input_directory, file))
self.hasFile = True
break
listdir(folder_paths.input_directory, '')
if self.hasFile:
PromptServer.instance.send_sync("easyuse-toast", {"content": "Removed SuccessFully", "type":'success'})
else:
PromptServer.instance.send_sync("easyuse-toast", {"content": "Removed Failed", "type": 'error'})
+4 -2
View File
@@ -98,7 +98,6 @@ class easySampler:
preview_bytes = previewer.decode_latent_to_preview_image(preview_format, x0)
pbar.update_absolute(step + 1, total_steps, preview_bytes)
if disable_noise:
noise = torch.zeros(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout,
device="cpu")
@@ -106,7 +105,10 @@ class easySampler:
batch_inds = latent["batch_index"] if "batch_index" in latent else None
noise = comfy.sample.prepare_noise(latent_image, seed, batch_inds)
kSampler = comfy.samplers.KSampler(model=model, steps=steps, device=device)
comfy.model_management.load_model_gpu(model)
model_patcher = comfy.model_patcher.ModelPatcher(model.model, load_device=device,
offload_device=comfy.model_management.unet_offload_device())
kSampler = comfy.samplers.KSampler(model_patcher, steps=steps, device=model.load_device, sampler=sampler_name, scheduler=scheduler, denoise=denoise, model_options=model.model_options)
samples = kSampler.sample(noise, positive, negative, cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=None, callback=callback, disable_pbar=disable_pbar, seed=seed)
out = latent.copy()
out["samples"] = samples