mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-13 06:52:42 +08:00
feat: remove custom js stuff since it just doesnt work well feat: add cond debugging feat: impls PoC refresh of custom_nodes + custom_node extensions feat: ignore workflows folder feat: add batch file to start application under windows feat: integrate reload custom node into refresh feat: update custom node ui feat: impl node change event handling !WIP! feat: add CustomNodeData class for reuse feat: remove all reloaded nodes for test purposes and save graph afterwards !WIP! feat: remove unused registeredNodes feat: comment out graph removal feat: comment on some functions for proper understanding and bookmarking (for now) feat: comment node execution location feat: add exception for IS_CHANGED issues feat: extend example_node README !WIP! feat: custom test nodes for now !WIP! feat: avoid refresh spam feat: add debug_cond custom_node with WIP ui feat: add hint for validating output_ui data feat: pass refresh button into combo function feat: impl output ui error feat: auto refresh nodes fix: various minor issues !WIP! feat: barebone JS scripting in BE for ui templating !WIP! feat: impl interrogation with clip feat: impl more debug samplers feat: change requirements.txt for transformers fix: __init__.py issues when importing custom_nodes feat: temp ignore 3rdparty code feat: add custom_nodes debug_latent and image_fx
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
import datetime
|
|
import math
|
|
import os
|
|
import random
|
|
|
|
import PIL
|
|
import einops
|
|
import torch
|
|
from torch import Tensor
|
|
import matplotlib.pyplot as plt
|
|
import torchvision.transforms as T
|
|
|
|
class DebugCond:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {
|
|
"required": {
|
|
"clip": ("CLIP",),
|
|
"cond_input": ("CONDITIONING",),
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("CONDITIONING", "IMAGE",)
|
|
FUNCTION = "debug_node"
|
|
OUTPUT_NODE = True
|
|
|
|
CATEGORY = "inflamously"
|
|
|
|
@classmethod
|
|
def IS_CHANGED(s, clip, cond_input):
|
|
# TODO: Why does this not cache immidiately
|
|
return random.randint(0, 10000)
|
|
|
|
def debug_node(self, clip, cond_input):
|
|
# print("Cond Shape:", cond_input[0][0].shape)
|
|
# signal = cond_input[0][0].reshape(-1)
|
|
# stripped_signal = signal[::2048]
|
|
plt.plot(cond_input[0][0][0])
|
|
img = PIL.Image.frombytes('RGB', plt.gcf().canvas.get_width_height(), plt.gcf().canvas.tostring_rgb())
|
|
img_tensor = T.PILToTensor()(img) / 255.0
|
|
img_tensor = einops.reduce(img_tensor, "a b c -> 1 b c a", "max")
|
|
return cond_input, img_tensor
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"DebugCond": DebugCond
|
|
}
|
|
|
|
# TODO: Impl into execution.py
|
|
SCRIPT_TEMPLATE_PATH = os.path.join(os.path.join(__file__, os.pardir), "debug_cond.js")
|