Create Your Own Custom Nodes in ComfyUI

  Рет қаралды 6,612

Code Crafters Corner

Code Crafters Corner

Күн бұрын

Learn how to write custom nodes from scratch in ComfyUI using Python.
Hello everyone, in this video tutorial, I show you step-by-step how to create your own custom nodes for ComfyUI. We start by looking at the example node provided by default and understanding how ComfyUI loads and interprets custom nodes. We then build our own node from scratch, including defining the inputs, outputs, and processing function. Our custom node combines the positive and negative prompt encoders into one. Finally, we connect our node to sample an image, showing that it works!
Useful if you want to customize ComfyUI and streamline your workflows for Stable Diffusion image generation.
I appreciate if you can like and share the video if it was helpful.
Subscribe for more content soon!
[SUPPORT THE CHANNEL]
Patreon: bit.ly/44js1Xx
Paypal: bit.ly/45lJsIg
[PROJECT FILES]
Github: bit.ly/4a5uqcg
[SOCIAL MEDIA]
KZfaq Channel: bit.ly/47OterT
Twitter X: bit.ly/3ReP9D3
[PREVIOUS VIDEOS]
SDXL Turbo Gradio App: • How to Use My SDXL Tur...
SDXL Turbo: • How to Use SDXL Turbo ...
Python API for ComfyUI: • Building a Python API ...
Introduction to Gradio: • Introduction to Python...
Timestamps:
00:00:00 Introduction
00:00:37 Understanding how ComfyUI loads custom nodes
00:02:29 ComfyUI default example custom node
00:03:53 Start ComfyUI with default example custom node
00:04:31 Testing the example node
00:06:05 Understanding the example python file
00:10:03 Node Class Mapping and Node Display Name Mappings
00:14:58 Making own custom node for comfyui
00:16:18 Make a custom node which holds positive and negative prompt in one node
00:17:22 Writing the python code
00:19:48 How to find the input and output types - nodes.py
00:22:56 Initial testing
00:25:12 Where is the positive prompt
00:27:06 Wiring / Connecting custom nodes
00:30:46 Negative prompt and ClipTextEncode
00:32:24 Final Testing
00:34:05 More ideas
00:34:48 Impact Pack example
00:35:45 Let me know if you would like to see more videos on writing your own custom nodes
00:35:51 Thank you for watching this video.
00:35:56 I will see you next time.
Tags: ComfyUI, ComfyUI tutorial, comfyui custom node, python, custom node, text encoding, positive prompt, negative prompt, ai image generation
Hashtags:
#comfyui #tutorial #customnode #python #textencoding #positiveprompt #negativeprompt #aiimagegeneration

Пікірлер: 55
@GARDNSOUND
@GARDNSOUND 14 күн бұрын
This was a great tutorial. I felt like I was back in class. Excellent work. I do not understand python as well as cpp; but you made this particular application very easy to understand.
@CodeCraftersCorner
@CodeCraftersCorner 13 күн бұрын
Glad it was helpful!
@SebAnt
@SebAnt 7 ай бұрын
WOW! You are an incredible teacher. I started with Stable Diffusion about a month ago after a year of Midjourney, and comfyUI was like black magic to me. I often got cryptic errors loading new things I got from the internet. This AMAZING video gives me a good understanding of what is happening behind the scenes. Thank you SO MUCH 🙏🏼
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you, @SebAnt! I am glad to hear the video helped you understand ComfyUI better. Appreciate you taking your time for these kind words! Thank you.
@thschied
@thschied 10 күн бұрын
Vielen Dank für die gute Erklärung. Ein sehr gutes Video und eine angenehme Stimme.
@CodeCraftersCorner
@CodeCraftersCorner 10 күн бұрын
Thank you very much!
@jtk1996
@jtk1996 Ай бұрын
Thanks a lot for the very thorough, well organized and informative introduction to custom nodes. Thumbs up!
@kpr2
@kpr2 6 ай бұрын
LOL! Just the info I need in case I end up writing my own "token counter" for giggles. Awesome info, keep the great tutorials coming!!! Thanks much!
@CodeCraftersCorner
@CodeCraftersCorner 6 ай бұрын
Thank you, @kpr2 for the positive feedback and encouragement! I'm glad you the tutorial helped you get closer to completing your token counter project.
@robinhahn6987
@robinhahn6987 7 ай бұрын
This is *exactly* what I was looking for! And yes, please: anything to help with Python would be gratefully learnt. In particular, understanding the errors that sometimes arise (I know - that would be a weeklong, epic-length video)... but just a few pointers on where to look for the source of the problem would help so much. I sincerely hope you keep making videos, particularly with a focus on the Python functionality - these are gold.
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you, @robinhahn6987! I'm glad you found the content helpful. Certainly, I'll be making similar content in the future. Your support and encouragement mean a lot.
@ArielTavori
@ArielTavori 7 ай бұрын
Very well done, many thanks! I would love to see more on this, and would ESPECIALLY appreciate some clear and concise instructions, ideally including an overview, rules, and step by step instructions in as few words as possible, for use in prompting and AI assisted troubleshooting!.. 🙏🏻
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you, @ArielTavori! I appreciate your kind words. Currently, I'm working on a different video idea, but I've noted your request. In a future video, I will cover advanced custom nodes in Python, including AI-assisted troubleshooting. Stay tuned for updates!
@user-sp7pg4rw1t
@user-sp7pg4rw1t 7 ай бұрын
Thank you so much for your course, it helped me a lot. I was SURPRISED to see this video. Hope you can continue to persevere. I'm sorry for my English. thanks for the tutorial!!!!!!!!!🙏🙏🙏
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you, @user-sp7pg4rw1t! Don't worry about your English, it's perfectly fine! I appreciate your support and will continue to create more similar contents.
@canibalcorps
@canibalcorps 2 ай бұрын
nice, simple, and easily understandable ! thank you !
@CodeCraftersCorner
@CodeCraftersCorner 2 ай бұрын
Glad you liked it!
@AIAngelGallery
@AIAngelGallery 3 ай бұрын
this clip is really good. thx a lot
@impactframes
@impactframes 7 ай бұрын
Fantastic, thank you for the video hope you make more soon :)
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you for watching, @impactframes! Yes, there will be more of similar content in the near future. Appreciate the support.
@sb6934
@sb6934 28 күн бұрын
Thanks!!
@michaelbayes802
@michaelbayes802 4 ай бұрын
thanks a lot for this great video. I was able to follow and recreate the node you did. I also made one of my own. Only thing I was struggling with was how to add inputs as inputs rather than them appearing in the widget. This seemed to be an issue with multi-line text fields.
@CodeCraftersCorner
@CodeCraftersCorner 4 ай бұрын
Good job getting so far, @michaelbayes802! Some of the inputs fields are predefined to appear as inputs or widgets. I will check the multi-line text fields.
@MachineDelusions
@MachineDelusions 7 ай бұрын
very informative, great vid
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you, @MachineDelusions! Appreciate the positive feedback!
@venli7692
@venli7692 4 ай бұрын
Very good!❤❤❤This video is very useful for me,you are a excellent teacher❤❤
@CodeCraftersCorner
@CodeCraftersCorner 4 ай бұрын
Thank you for the kind words, @venli7692!
@PEDROMATOSFAST
@PEDROMATOSFAST 5 ай бұрын
Muito obrigado !!! ajudou muito
@CodeCraftersCorner
@CodeCraftersCorner 5 ай бұрын
Thank you, @PEDROMATOSFAST!
@glibsonoran
@glibsonoran 7 ай бұрын
Thank you, very helpful vid. Your style of explaining is very clear and shows some of the pitfalls that might occur. That's always helpful. I do have a question: I made my first custom node a while back and I'd really like to make another node to compliment it. What I'd like to do is have a node that will take a STRING input from a prompt generator node and display the prompt in a multiline text field that's editable. In looking through the nodes I have I've not seen any node that can take one of its inputs and display it another of its inputs: In this case a "forceinput" text node to an editable multiline text field. If you know of how this can be done, or of a node that does this that I can examine I'd appreciate it.
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you, @glibsonoran! I'm happy to hear that you found the video helpful. You idea of custom node to display and edit a string is interesting. I'll try and give it a shot. I'll keep you informed on the progress and a possible solution. Thanks for the feedback.
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Following up on your question about displaying and editing a string input in ComfyUI, I did some research and testing. Since ComfyUI doesn't have a built-in feature to show text output by default, you'll need to implement it using JavaScript. I came across a solution by the user 'pythongosssss' on GitHub. They've created custom nodes called 'Show Text' and 'String Function' that achieve what you're looking for. To access these nodes, you can visit their GitHub profile and look for the repo "ComfyUI-Custom-Scripts". You will need both Python and JavaScript skills to understand the code since using the Python extensions alone won't display the string output in the web UI. The files of interest from the repository are: "web\js\showText.js", "py\show_text.py". Since the project is under the MIT License, you can safely examine and use the code. Hope this helps and points you in the right direction.
@glibsonoran
@glibsonoran 7 ай бұрын
@@CodeCraftersCorner Yes I had reviewed that node and the fact that he returned values to UI. There's a math node that also returns to UI (Pythongossss' "Math Expression") it takes A, B and C values as inputs and lets you enter a math expression using those values, the result of which gets sent to output, but it also displays the equation result on the face of the node (uneditable also unfortunately) . However in both cases the result is not editable like a multiline text input would be. It seems that Comfy data only goes in one direction: Input elements => output elements. While you can process the data before output (which is the whole idea I guess), you can't direct data from one input to another for display/editing to the user. At least that's how it looks to me. The UI elements don't seem to be accessible except to read their data. Another node that attempts to get around the inaccessibility of UI elements in Preview Chooser from the Image Chooser node set. They use a set of JavaScripts and Comfy's Server object to pause the workflow. Then they poll for an "event" where the user interacts with a UI element to indicate the workflow should resume. It's pretty interesting, but I haven't been able to suss it all out yet and my JavaScript is not strong.
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
Thank you, @glibsonoran for the detailed observation. It does seem like a software design choice of ComfyUI. The observation about the data flow in one direction and the challenges in achieving an editable output field is valuable. I appreciate the mention of the Preview Chooser node, and I'll give it a try for a deeper understanding. Same here, my JavaScript skills are primarily focused on frontend development. So it is a challenge to get a good understanding of the backend scripts.
@CodeCraftersCorner
@CodeCraftersCorner 7 ай бұрын
@Mindset2Work, I cannot find your comment to reply directly but I got an email notification. To close out of your current ComfyUI session, bring your terminal / Powershell / CMD window to the front and press and hold the control key (CTRL). While held down, press the "c" key on your keyboard. So the shortcut is CTRL + C. This will close ComfyUI server. Then to restart, you can press the UP arrow on your keyboard to get your last command back and press Enter. Hope you find this comment.
@MannyGonzalez
@MannyGonzalez Ай бұрын
Awesome videos... Can you create a tutorial on how ComfyUI displays text inside a node? I was able to figure out how to have a node display images but I can't get it to display text. For example, take an input image, calculate the MD5 hash and then display the Hash as well as the image pixel dimensions. I can output to a text output and that works fine. But when I try to use the "text" format to display in the self (output node true) node, it always error or no output. Thank you!
@CodeCraftersCorner
@CodeCraftersCorner Ай бұрын
Great suggesion, I will see what I can.
@canibalcorps
@canibalcorps Ай бұрын
Your vidéo push me feather in programing my own nodes but i'm locked because of lack of information and learning, where can i learn more about ?
@CodeCraftersCorner
@CodeCraftersCorner Ай бұрын
I have other one more video on ComfyUI custom nodes. Unfortunately, there is not a website or much documentation for ComfyUI.
@rakibulhassanrocky8169
@rakibulhassanrocky8169 2 ай бұрын
How to add the INTEGER ? Only like Width/ Height?
@CodeCraftersCorner
@CodeCraftersCorner 2 ай бұрын
Hello, you have to use the INT field. To connect to the width and height of Empty Latent Image (example), convert the width/height of the node to inputs and connect them.
@MaraScottAI
@MaraScottAI 5 ай бұрын
Hi, thx for that video, any chance to have something similar for javascript based custom nodes ?
@CodeCraftersCorner
@CodeCraftersCorner 5 ай бұрын
Sure, soon!
@a.iwizard
@a.iwizard Ай бұрын
what are you using for your pipeline connecting your nodes together mine curve and i don't like it..
@CodeCraftersCorner
@CodeCraftersCorner Ай бұрын
Hello, to make the connection straight lines, you can go to the setting (gear icon) in the ComfyUI menu and change the "Link Render Mode" to Straight.
@CamiloMonsalve
@CamiloMonsalve 4 ай бұрын
How do you make the connectors look like straight lines and not curved lines?
@CodeCraftersCorner
@CodeCraftersCorner 4 ай бұрын
Hello @CamiloMonsalve! Go to Settings (gear icon above Queue Prompt button) > Look for "Link Render Mode" and change it to "Straight". There is an option to hide the lines too.
@CamiloMonsalve
@CamiloMonsalve 4 ай бұрын
@@CodeCraftersCorner Awesome Thank you very much!
@CodeCraftersCorner
@CodeCraftersCorner 4 ай бұрын
@CamiloMonsalve My pleasure!
@artistaartificial5635
@artistaartificial5635 6 ай бұрын
How much would it cost to hire you to create one or more custom nodes for ComfyUI?
@CodeCraftersCorner
@CodeCraftersCorner 6 ай бұрын
Thank you for your interest! I appreciate your inquiry. Please reach out via email CodeCraftersCorner@gmail.com. I'll review and get back to you.
@MilesBellas
@MilesBellas 3 ай бұрын
"Noowde'
@sinayagubi8805
@sinayagubi8805 4 ай бұрын
I remember I made that mistake before. You are pronouncing "node" like a different word that has a bad meaning.
@CodeCraftersCorner
@CodeCraftersCorner 4 ай бұрын
Hello @sinayagubi8805! I see what you meant. I checked the original raw recording. I did pronounce it as "node". When I applied noise reduction and voice processing, it distorted the audio slightly. Thanks for pointing this out.
End of Year ComfyUI Updates for Stable Diffusion
26:23
Code Crafters Corner
Рет қаралды 9 М.
comfyUI: Create Your Own Node in Seconds Using AI! No Programming Needed!
28:51
Cebas Visual Technology
Рет қаралды 1,4 М.
БАБУШКИН КОМПОТ В СОЛО
00:23
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 16 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 78 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 8 МЛН
How to make your own custom ComfyUI nodes
57:08
Cody The Software Engineer
Рет қаралды 17 М.
Understanding Prompting for Stable diffusion in ComfyUI
29:38
Code Crafters Corner
Рет қаралды 11 М.
Any Node: the node that can do EVERYTHING - SD Experimental
17:16
Andrea Baioni
Рет қаралды 6 М.
Build Your Own ComfyUI APP!
19:08
Latent Vision
Рет қаралды 19 М.
Fast face swap in ComfyUI / ReActor custom nodes
17:14
antinoice
Рет қаралды 2,8 М.
Noise Styling is the NEXT LEVEL of AI Image Generation
12:46
Olivio Sarikas
Рет қаралды 42 М.
Understanding ComfyUI Nodes: A Comprehensive Guide
27:29
Code Crafters Corner
Рет қаралды 3,9 М.
The RIGHT WAY To Build AI Agents with CrewAI (BONUS: 100% Local)
19:47
Matthew Berman
Рет қаралды 113 М.
БАБУШКИН КОМПОТ В СОЛО
00:23
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 16 МЛН