Giter VIP home page Giter VIP logo

comfyui's Introduction

ComfyUI

The most powerful and modular stable diffusion GUI and backend.

ComfyUI Screenshot

This ui will let you design and execute advanced stable diffusion pipelines using a graph/nodes/flowchart based interface. For some workflow examples and see what ComfyUI can do you can check out:

Features

Workflow examples can be found on the Examples page

Shortcuts

Keybind Explanation
Ctrl + Enter Queue up current graph for generation
Ctrl + Shift + Enter Queue up current graph as first for generation
Ctrl + Z/Ctrl + Y Undo/Redo
Ctrl + S Save workflow
Ctrl + O Load workflow
Ctrl + A Select all nodes
Alt + C Collapse/uncollapse selected nodes
Ctrl + M Mute/unmute selected nodes
Ctrl + B Bypass selected nodes (acts like the node was removed from the graph and the wires reconnected through)
Delete/Backspace Delete selected nodes
Ctrl + Delete/Backspace Delete the current graph
Space Move the canvas around when held and moving the cursor
Ctrl/Shift + Click Add clicked node to selection
Ctrl + C/Ctrl + V Copy and paste selected nodes (without maintaining connections to outputs of unselected nodes)
Ctrl + C/Ctrl + Shift + V Copy and paste selected nodes (maintaining connections from outputs of unselected nodes to inputs of pasted nodes)
Shift + Drag Move multiple selected nodes at the same time
Ctrl + D Load default graph
Q Toggle visibility of the queue
H Toggle visibility of history
R Refresh graph
Double-Click LMB Open node quick search palette

Ctrl can also be replaced with Cmd instead for macOS users

Installing

Windows

There is a portable standalone build for Windows that should work for running on Nvidia GPUs or for running on your CPU only on the releases page.

Simply download, extract with 7-Zip and run. Make sure you put your Stable Diffusion checkpoints/models (the huge ckpt/safetensors files) in: ComfyUI\models\checkpoints

If you have trouble extracting it, right click the file -> properties -> unblock

How do I share models between another UI and ComfyUI?

See the Config file to set the search paths for models. In the standalone windows build you can find this file in the ComfyUI directory. Rename this file to extra_model_paths.yaml and edit it with your favorite text editor.

Jupyter Notebook

To run it on services like paperspace, kaggle or colab you can use my Jupyter Notebook

Manual Install (Windows, Linux)

Git clone this repo.

Put your SD checkpoints (the huge ckpt/safetensors files) in: models/checkpoints

Put your VAE in: models/vae

AMD GPUs (Linux only)

AMD users can install rocm and pytorch with pip if you don't have it already installed, this is the command to install the stable version:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.7

This is the command to install the nightly with ROCm 6.0 which might have some performance improvements:

pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.0

NVIDIA

Nvidia users should install stable pytorch using this command:

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121

This is the command to install pytorch nightly instead which might have performance improvements:

pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121

Troubleshooting

If you get the "Torch not compiled with CUDA enabled" error, uninstall torch with:

pip uninstall torch

And install it again with the command above.

Dependencies

Install the dependencies by opening your terminal inside the ComfyUI folder and:

pip install -r requirements.txt

After this you should have everything installed and can proceed to running ComfyUI.

Others:

Apple Mac silicon

You can install ComfyUI in Apple Mac silicon (M1 or M2) with any recent macOS version.

  1. Install pytorch nightly. For instructions, read the Accelerated PyTorch training on Mac Apple Developer guide (make sure to install the latest pytorch nightly).
  2. Follow the ComfyUI manual installation instructions for Windows and Linux.
  3. Install the ComfyUI dependencies. If you have another Stable Diffusion UI you might be able to reuse the dependencies.
  4. Launch ComfyUI by running python main.py

Note: Remember to add your models, VAE, LoRAs etc. to the corresponding Comfy folders, as discussed in ComfyUI manual installation.

DirectML (AMD Cards on Windows)

pip install torch-directml Then you can launch ComfyUI with: python main.py --directml

I already have another UI for Stable Diffusion installed do I really have to install all of these dependencies?

You don't. If you have another UI installed and working with its own python venv you can use that venv to run ComfyUI. You can open up your favorite terminal and activate it:

source path_to_other_sd_gui/venv/bin/activate

or on Windows:

With Powershell: "path_to_other_sd_gui\venv\Scripts\Activate.ps1"

With cmd.exe: "path_to_other_sd_gui\venv\Scripts\activate.bat"

And then you can use that terminal to run ComfyUI without installing any dependencies. Note that the venv folder might be called something else depending on the SD UI.

Running

python main.py

For AMD cards not officially supported by ROCm

Try running it with this command if you have issues:

For 6700, 6600 and maybe other RDNA2 or older: HSA_OVERRIDE_GFX_VERSION=10.3.0 python main.py

For AMD 7600 and maybe other RDNA3 cards: HSA_OVERRIDE_GFX_VERSION=11.0.0 python main.py

Notes

Only parts of the graph that have an output with all the correct inputs will be executed.

Only parts of the graph that change from each execution to the next will be executed, if you submit the same graph twice only the first will be executed. If you change the last part of the graph only the part you changed and the part that depends on it will be executed.

Dragging a generated png on the webpage or loading one will give you the full workflow including seeds that were used to create it.

You can use () to change emphasis of a word or phrase like: (good code:1.2) or (bad code:0.8). The default emphasis for () is 1.1. To use () characters in your actual prompt escape them like \( or \).

You can use {day|night}, for wildcard/dynamic prompts. With this syntax "{wild|card|test}" will be randomly replaced by either "wild", "card" or "test" by the frontend every time you queue the prompt. To use {} characters in your actual prompt escape them like: \{ or \}.

Dynamic prompts also support C-style comments, like // comment or /* comment */.

To use a textual inversion concepts/embeddings in a text prompt put them in the models/embeddings directory and use them in the CLIPTextEncode node like this (you can omit the .pt extension):

embedding:embedding_filename.pt

How to increase generation speed?

Make sure you use the regular loaders/Load Checkpoint node to load checkpoints. It will auto pick the right settings depending on your GPU.

You can set this command line setting to disable the upcasting to fp32 in some cross attention operations which will increase your speed. Note that this will very likely give you black images on SD2.x models. If you use xformers or pytorch attention this option does not do anything.

--dont-upcast-attention

How to show high-quality previews?

Use --preview-method auto to enable previews.

The default installation includes a fast latent preview method that's low-resolution. To enable higher-quality previews with TAESD, download the taesd_decoder.pth (for SD1.x and SD2.x) and taesdxl_decoder.pth (for SDXL) models and place them in the models/vae_approx folder. Once they're installed, restart ComfyUI to enable high-quality previews.

Support and dev channel

Matrix space: #comfyui_space:matrix.org (it's like discord but open source).

QA

Why did you make this?

I wanted to learn how Stable Diffusion worked in detail. I also wanted something clean and powerful that would let me experiment with SD without restrictions.

Who is this for?

This is for anyone that wants to make complex workflows with SD or that wants to learn more how SD works. The interface follows closely how SD works and the code should be much more simple to understand than other SD UIs.

comfyui's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

comfyui's Issues

Feature request: connectable ints/floats/strings

Right now to edit width/height i need to manually edit two fields.

My idea was to make ConstInt node and to connect it to width and height node. Right now it's not possible.

(Also having ability to make integer/float nodes would allow to move Random seed after every generation to specialized seed node).

Error when running "Update_all.bat"

Ran update_all.bat and received this error:

Collecting xformers
Using cached xformers-0.0.16-cp310-cp310-win_amd64.whl (40.0 MB)
Using cached xformers-0.0.13.tar.gz (292 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\RETHINK\AppData\Local\Temp\pip-install-vlaokrbw\xformers_ae0f169475684b26844e6512005ab351\setup.py", line 239, in
ext_modules=get_extensions(),
File "C:\Users\RETHINK\AppData\Local\Temp\pip-install-vlaokrbw\xformers_ae0f169475684b26844e6512005ab351\setup.py", line 157, in get_extensions
raise RuntimeError(
RuntimeError: CUTLASS submodule not found. Did you forget to run git submodule update --init --recursive ?
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

D:\ComfyUI\update>pause

How can I fix?

[Feature Request] Batch image processing

This would allow mass-processing of images, being particularly useful for processing video frames.

It would be even better if you could use multiple sets of images in pairs, e.g. using one node for img2img frames frame0001.png, frame0002.png, ..., and another node for ControlNet inputs segment0001.png, segment0002.png, ..., then combine these two image sets in the pipeline.

Feature Request: coloured connecting wires

As our work flows increase in complexity, it would be handy to either colour the wires at will, or different colours for different connector types. it would make at a glance debugging easier too.

[Feature Request] Possible to have different node for some default prompts?

May I know if it is possible to have different nodes for positive prompts and negative prompts?
Use case:
Node 1: Main Prompt content
Node 2: some Default prompts (like best quality, masterpiece) etc.
Node 3 ( Combine 1+2)

This will be more easier to finetune the prompts and make the prompt more clear to read. thanks!

Disabling xformers when using 3rd party venv

Run into a slight issue using webui venv.
image
Xformers work in webui ,but here it doesn't as something might be not compatible
Is there a way to disable it when starting comfyUI ?

Im getting just messy images.

Idk what im doing wrong. Im using protogen fp16 with fp16 yaml. Then tried img2img, but all i got is this. Prompt "Pretty girl" or something. The most coherent thing i got is a very deformed main picture at 0.1 denoising, wich doesn`t make sense.

ComfyUI_00002_
ComfyUI_00003_
ComfyUI_00006_

Specifying incorrect type in custom node doens't report error

Consider

    class ConstFloat:
        @classmethod
        def INPUT_TYPES(s):
            return {"required": { "n":   ("FlOAT", {"default": 1.0, "min": -512.0, "max": 512.0})}}
        RETURN_TYPES = ("FLOAT",)
        FUNCTION = "test"
        CATEGORY = "Example"
        def test(self, n):
            return (n,)

    NODE_CLASS_MAPPINGS = {
        "ConstFloat": ConstFloat
    }

Right now I can add it to the graph normally:

image

There is no indication in the console or browser UI that something is wrong:

Set vram state to: NORMAL VRAM
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
No module 'xformers'. Proceeding without it.
Starting server

To see the GUI go to: http://127.0.0.1:8188

Intermediate Steps

I'd like to see intermediate steps so I know what I'm doing. Isn't it possible to allow VAE's or KSamplers to have the ability to show a preview of what the sampler doing?

TypeError: ControlNet.get_control() missing 1 required positional argument: 'batched_number'

I am getting this error when using the example at: https://comfyanonymous.github.io/ComfyUI_examples/controlnet/mixing_controlnets.png

The only changes I made are changing the controlnet model names to the names of my files, swapping to anything 4.5 (also happens on anything 3.0), and changing the vae. Attached is my workspace save (with .txt added so github lets me upload)
I'm on the latest version as of time of posting.

Let me know what else you need. Thanks! Great tool btw :D

Traceback (most recent call last):
File "D:\user\git\ComfyUI\main.py", line 193, in execute
executed += recursive_execute(prompt, self.outputs, x, extra_data)
File "D:\user\git\ComfyUI\main.py", line 87, in recursive_execute
executed += recursive_execute(prompt, outputs, input_unique_id, extra_data)
File "D:\user\git\ComfyUI\main.py", line 87, in recursive_execute
executed += recursive_execute(prompt, outputs, input_unique_id, extra_data)
File "D:\user\git\ComfyUI\main.py", line 92, in recursive_execute
outputs[unique_id] = getattr(obj, obj.FUNCTION)(**input_data_all)
File "D:\user\git\ComfyUI\nodes.py", line 610, in sample
return common_ksampler(self.device, model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
File "D:\user\git\ComfyUI\nodes.py", line 576, in common_ksampler
samples = sampler.sample(noise, positive_copy, negative_copy, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask)
File "D:\user\git\ComfyUI\comfy\samplers.py", line 443, in sample
samples = uni_pc.sample_unipc(self.model_wrap, noise, latent_image, sigmas, sampling_function=sampling_function, max_denoise=max_denoise, extra_args=extra_args, noise_mask=denoise_mask, variant='bh2')
File "D:\user\git\ComfyUI\comfy\extra_samplers\uni_pc.py", line 879, in sample_unipc
x = uni_pc.sample(img, timesteps=timesteps, skip_type="time_uniform", method="multistep", order=3, lower_order_final=True)
File "D:\user\git\ComfyUI\comfy\extra_samplers\uni_pc.py", line 731, in sample
model_prev_list = [self.model_fn(x, vec_t)]
File "D:\user\git\ComfyUI\comfy\extra_samplers\uni_pc.py", line 422, in model_fn
return self.data_prediction_fn(x, t)
File "D:\user\git\ComfyUI\comfy\extra_samplers\uni_pc.py", line 404, in data_prediction_fn
noise = self.noise_prediction_fn(x, t)
File "D:\user\git\ComfyUI\comfy\extra_samplers\uni_pc.py", line 398, in noise_prediction_fn
return self.model(x, t)
File "D:\user\git\ComfyUI\comfy\extra_samplers\uni_pc.py", line 330, in model_fn
return noise_pred_fn(x, t_continuous)
File "D:\user\git\ComfyUI\comfy\extra_samplers\uni_pc.py", line 298, in noise_pred_fn
output = sampling_function(model, x, t_input, **model_kwargs)
File "D:\user\git\ComfyUI\comfy\samplers.py", line 193, in sampling_function
cond, uncond = calc_cond_uncond_batch(model_function, cond, uncond, x, timestep, max_total_area, cond_concat)
File "D:\user\git\ComfyUI\comfy\samplers.py", line 170, in calc_cond_uncond_batch
c['control'] = control.get_control(input_x, timestep_, c['c_crossattn'], len(cond_or_uncond))
File "D:\user\git\ComfyUI\comfy\sd.py", line 396, in get_control
control_prev = self.previous_controlnet.get_control(x_noisy, t, cond_txt)
TypeError: ControlNet.get_control() missing 1 required positional argument: 'batched_number'
error.json.txt

Feature Request: seed node

as discussed on discord :)

A seed node would be linkable to multiple sampler boxes, ideally have a toggle to be generate at start of of process or the current after process (for those that need that).

Unable to generate images

Getting this in powershell -

ValueError: The device_map provided does not give any device for the following parameters: betas, alphas_cumprod, alphas_cumprod_prev, sqrt_alphas_cumprod, sqrt_one_minus_alphas_cumprod, log_one_minus_alphas_cumprod, sqrt_recip_alphas_cumprod, sqrt_recipm1_alphas_cumprod, posterior_variance, posterior_log_variance_clipped, posterior_mean_coef1, posterior_mean_coef2

Torch version chaos

I tried following the NVIDIA installation guide of your ReadMe, but whenever i try to install xformers i get the following:

torchvision 0.15.0+cu117 requires torch==2.0.0, but you have torch 1.13.1 which is incompatible.
torchaudio 2.0.0+cu117 requires torch==2.0.0, but you have torch 1.13.1 which is incompatible.

can you help me resolve this problem?

Variables

Though of when trying to get seed and prompt in the file name.
Any way to store information for later, or create it from a note.

ConditioningSetArea - areas must be dividable by 64

Hi,

first thanks a lot for your work! The visual form of the pipeline helped me a lot to better understand some basic concepts of SD!

My challenge:
I would like to "inpaint" all the 5 windows in the following room using image2image or depth2image. I hoped that such approach would help SD to render the windows in a correct size and position - currently, the model often forgets them or make them much bigger

.

The problem is that I cannot create a small enough ConditioningSetArea (smaller than 64x64 or just at any size which is not dividable by 64).

Do you think that there is some solution to that? Standard inpainting uses a mask image where the mask can have any shape. Can such mask also be used in your approach somehow?

Thanks

Low resolution on HiDPi monitor

I'm using this on a 4K monitor and it looks like most of the UI, apart from buttons and editable text, is rendered at half resolution. A screenshot of the issue is below:
image

Alternative UI

Hi,
This isn't really an issue, but more of a question. I've been using a fork of your repo with various changes applied on top of it. One of them is a quick prototype of a React/TailwindCSS interface with slightly altered UI elements and things like a gallery view. I intend to maintain it and use it for my own purposes, but I can contribute it back to your repo if you wish.
I have a ready-to-use demo branch available here that only makes minimal changes to your existing code: https://github.com/jac3km4/ComfyUI/tree/reactui

Let me know if you'd be interested in integrating it. If not, feel free to close this PR.

Create non-existent folders when saving images

When I set the filename prefix to testing/dog or testing\dog, no images are saved to the output folder. Instead, an error is logged in the console.

FileNotFoundError: [Errno 2] No such file or directory: '...\\ComfyUI\\output\\testing\\dog_00001_.png'

Creating a testing folder in output fixes the error. It would be great if ComfyUI could create any missing folders for the user instead.

[Feature Request] Several ideas

I really think your actualy have the best UI, so if you want :

1-input text boxes (e.g. the prompt) have a problem: when you select the text and move the cursor outside the box, it deselects, it's annoying.

2-it could be cool to see the image used, on the controlNET and loadimage modules.

3- it could be cool that ctrl + arrow up/down after selecting a keyword in the prompt, increases the weight, like with 1111. example: "(keyword:1.1)"

4 - right click on "Queue Prompt" to reduce the queue.
2023-03-14 22_59_27-aezaeazddez0000000003 jpg - ACDSee Pro 10

5 - The possibility to delete a group with all its content.

6 - When you refresh the page, the view is not centered on the modules.

7 - The possibility to close these boxes with a click outside of it :
2023-03-14 23_15_10-127 0 0 1_8188

8 - The possibility to temporary disable a module and a group.

9 - An excellent trick I think : a new module that has several states and where you can "plug in" all possible connections, and return all possible connections. I explain: for example you want a state of this module that uses a ckpt, and another state that uses LORA, so you create a state 1 of this module that is connected to the ckpt_loader, and a state 2 connected to the LORA_loader, and you can change the state of the module in 1 click. The problem is that the module must be able to remember and change the options of the connected modules, because these options change depending on whether you use LORA or EMA for example... (an other situation for exemple : sometimes you want to use a latent_image from a new image generation, and sometimes from a load_image module.)

10 - the possibility to "lock" a group, because sometimes they are moved unintentionally, they overlap with other groups and get mixed up. The lock could either prevent the group from overlapping other modules or from being moved.

11 - this should be "random seed before every gen" :
2023-03-15 08_30_45-127 0 0 1_8188
Because if I had it enabled just before and I want to keep the seed, I check the box, the seed will change one last time.

12 - an option for a sound when the queue is finished (to help with alt+tab).

I move it here because I'm not sure you still get notifs on my other ticket.

Add Upscaler + more documentation?

This UI is amazing! :)
Which folder can I add my own upscaler such as 4x-AnimeSharp? -
Also is there more documentation on this UI? I'd love to read it!

About latent composition.

Hello. I am trying to combine two images using latent composition. Specifically, I want both of their noises to influence the same area.
However, I don't know the function of X, Y and Feather.
Using 0,0,80 (copying an example), I was able to get it to show me the result of image noise 1, but none of noise 2, or vice versa (by switching sample from and sample to)
Would you be so kind to guide me? I think it's somewhat doable according to the examples, but I'm not figuring out how.

[Feature request]: Programmatic use and API

I would like to request a feature that allows for the saving and loading of pipelines as JSON. This will enable users to create complex and advanced pipelines using the graph/nodes/flowchart based interface and then leverage the visually built pipelines programmatically or via API through a runner

When using .ckpt, "comfy/sd.py": KeyError: 'state_dict'

This will probably be a long-term issue others encounter and can serve as a convenient reference. It might not be a ComfyUI issue at all. tl;dr Running the error'ing model through any model merger or converter (such as WebUI's) fixes the issue, see below for details.

When using some models, but not others, seemingly only model merges created months ago in WebUI, the following error occurs:

making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Loading model from /home/user/ComfyUI/models/checkpoints/model1.ckpt
Traceback (most recent call last):
  File "/home/user/ComfyUI/main.py", line 160, in execute
    executed += recursive_execute(prompt, self.outputs, x, extra_data)
  File "/home/user/ComfyUI/main.py", line 54, in recursive_execute
    executed += recursive_execute(prompt, outputs, input_unique_id, extra_data)
  File "/home/user/ComfyUI/main.py", line 54, in recursive_execute
    executed += recursive_execute(prompt, outputs, input_unique_id, extra_data)
  File "/home/user/ComfyUI/main.py", line 54, in recursive_execute
    executed += recursive_execute(prompt, outputs, input_unique_id, extra_data)
  File "/home/user/ComfyUI/main.py", line 59, in recursive_execute
    outputs[unique_id] = getattr(obj, obj.FUNCTION)(**input_data_all)
  File "/home/user/ComfyUI/nodes.py", line 83, in load_checkpoint
    return comfy.sd.load_checkpoint(config_path, ckpt_path, output_vae=True, output_clip=True)
  File "/home/user/ComfyUI/comfy/sd.py", line 123, in load_checkpoint
    model = load_model_from_config(config, ckpt_path, verbose=False, load_state_dict_to=load_state_dict_to)
  File "/home/user/ComfyUI/comfy/sd.py", line 20, in load_model_from_config
    sd = pl_sd["state_dict"]
KeyError: 'state_dict'

A reminder, the code for pl_sd is...

def load_model_from_config ...
    ...
    if ckpt.lower().endswith(".safetensors"):
        import safetensors.torch
        sd = safetensors.torch.load_file(ckpt, device="cpu")
    else:
        pl_sd = torch.load(ckpt, map_location="cpu")
        if "global_step" in pl_sd:
            print(f"Global Step: {pl_sd['global_step']}")
        sd = pl_sd["state_dict"] # <-- PROBLEM OCCCURS HERE
    model = instantiate_from_config(config.model)
...
model = load_model_from_config(config, ckpt_path, verbose=False, load_state_dict_to=load_state_dict_to)

... and as the error says, ckpt and ckpt_path are certainly correct.

This error is resolved by entering WebUI and running either of the following, after which ComfyUI can use the model. FP16 and Pruning are not necessary, but just provided as examples (as they are now the default used in WebUI's model merge utility):

It seems the offending models were made with PyTorch 12.x, and both WebUI and ComfyUI are running on PyTorch 13.1. WebUI can read these (malformed?) ckpt files, but ComfyUI cannot.

EDIT: This seems to be a common problem with a simple compatibility fix:

ControlNet - doesn't work with difference models

ControlNet comes in two variations:
The full models (5.2 GB) which contain the full ControlNet network together with weights from the model it was trained with, and difference models which are made by subtracting the model it was trained on from the ControlNet model (e.g: ControlNet trained on SD1.5 -> Difference = ControlNet - SD.15) as mentioned here and described in the linked discussions there.
In ComfyUI, only the full models seem to work.
This is most likely because of the implementation, which I quite frankly have no idea of. Therefor I unfortunately cannot provide a solution suggestion. It if can't be fixed that's fine as well, the normal models are good enough, just unnecessarily big. In that case it would suffice to mention it somewhere, because some people will only have the difference models and will probably be wondering why it doesn't work.

[Feature request] On image save generate txt file with parameters

Would be nice that for each image that gets generated you get the parameter txt file with prompt, size, seed, cfg, samplet, steps, etc.

Another cool thing would be able to import that txt file, with drag n drop, and it populates ksampler node and the prompt node.

[Feature Request] Custom node plugin API

In my opinion this idea has so much potential. It's really cool to be able to set up my own pipeline without having to write a single line of code.

I would like the community to be able to create custom nodes like upscaler nodes or controlnet processing, text nodes (i.e. to reuse prompts for different parts of the same pipeline), stuff like this.

How hard would it be to make an API that allows people to write their own nodes as external code?

lowvram and novram OOM at slightly higher resolutions

OS: Arch Linux
Kernel: 6.1.9-arch1-2
GPU: Nvidia GeForce GTX 1060 3GB
Nvidia Driver Version: 525.85.05
CUDA Version: 12.0

When attempting to generate a picture that was 768x768 on novram and lowvram, CUDA experienced an out of memory error. Used "Load Default", with only difference being step count reduced to 8 from 20 for faster testing time. This amount of VRAM should reasonably be able to output higher resolution images (up to around 1152x768~) with low vram optimizations.

    executed += recursive_execute(prompt, self.outputs, x, extra_data)
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/main.py", line 71, in recursive_execute
    executed += recursive_execute(prompt, outputs, input_unique_id, extra_data)
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/main.py", line 76, in recursive_execute
    outputs[unique_id] = getattr(obj, obj.FUNCTION)(**input_data_all)
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/nodes.py", line 101, in decode
    return (vae.decode(samples), )
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/comfy/sd.py", line 311, in decode
    pixel_samples = self.first_stage_model.decode(1. / self.scale_factor * samples)
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/comfy/ldm/models/autoencoder.py", line 94, in decode
    dec = self.decoder(z)
  File "/home/salt/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/comfy/ldm/modules/diffusionmodules/model.py", line 637, in forward
    h = self.up[i_level].block[i_block](h, temb)
  File "/home/salt/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/comfy/ldm/modules/diffusionmodules/model.py", line 132, in forward
    h = nonlinearity(h)
  File "/mnt/2TBDa/SDSoftware/comfyfork/ComfyUI/comfy/ldm/modules/diffusionmodules/model.py", line 43, in nonlinearity
    return x*torch.sigmoid(x)
RuntimeError: CUDA out of memory. Tried to allocate 576.00 MiB (GPU 0; 2.94 GiB total capacity; 1.45 GiB already allocated; 364.56 MiB free; 2.02 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF```

Feature Request: model and output path setting

Sym linking is not ideal, setting a model folder is pretty standard these days and most of us use more than one software that uses models.
The same for choosing where to put the output images, personally mine go to a portable drive, not sure how to do that with ComfyUI.

[Feature request] Keyboard shortcut to add queue

In A1111 when you press CTRL+Enter, it launches the generation... and.. maybe it's only me, but when I modify the prompt I use a lot this shortcut to view the changes rapidly... ;)

Maybe I missed a thing and there's the same behaviour on Comfy ?

4gb vram out of memory

1 batch, 128 x 128, 20 steps, 8cfg, euler a.

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 26.00 MiB (GPU 0; 4.00 GiB total capacity; 3.38 GiB already allocated; 0 bytes free; 3.45 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

It auto detects -lowvram but still cant generate imanges.
I tried -lowvram and -novram still same problem.

this gui works fine 512 x 512 50 steps.
https://github.com/n00mkrad/text2image-gui#features-and-how-to-use-them

I love the idea of your GUI, it looks awesome to learn with it.

Seed is not updated in metadata when running in batch

Hey,

I just see that, when launching a batch generation, the seed in the metadatas of each PNG File is not updated, all the PNG Files have the first Seed in Prompt data, so we can't reuse the seed from an image.

Prompt: {"3": {"inputs": {"seed": 648312782957426, "steps": 32, ....

[Feature Request] TensorRT support

I think I remember somewhere you were looking into supporting tensortRT models, is that still in the backlog somewhere? or would implementing support for tensortRT require too much rework of the existing codebase?

[Feature request] A request for more nodes.

I've managed to make a few basic nodes directly in the nodes.py file for a few constant values (int, string, float). But I've had no luck with more complicated conversions of other scripts into nodes so far. Namely, I'd very much like the following to be implemented as nodes.

This outpainting script (https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/scripts/outpainting_mk_2.py)
This Latent Mirroring extension (https://github.com/dfaker/SD-latent-mirroring)
This dynamic CFG extension (https://github.com/mcmonkeyprojects/sd-dynamic-thresholding)
This tiling extension (https://github.com/tjm35/asymmetric-tiling-sd-webui/)
This symmetry script (https://gist.github.com/1ort/2fe6214cf1abe4c07087aac8d91d0d8a)

Likely in that order of concern as well. Also, any other outpaint scripts would be very handy as optional nodes most likely. There are a few others around I could link later if needed.

In general, a means of consuming the big pile of scripts and extensions available to this (https://github.com/AUTOMATIC1111/stable-diffusion-webui) could be extremely useful. That would quickly extend this node system into something much more useful all in one go. Not really sure how viable that is given the difficulties I've had thus far simply trying for making that outpaint script into a node. But, I've been attempting to do it in the most lazy copy/paste chatgpt fashion ever too, so maybe that doesn't help.

Likely with some thought and effort it wouldn't be too hard to make at least some of these into nodes. I think all the things I listed could each help extend this node system into something even more useful than it already is. I will likely mess with it more but I'm not sure how much, or how fiercely. If someone else felt like actually trying, that would likely be more useful than whatever my tinkering might lead to on this.

collab not working link

after using the collab after running all the cells in collab the output of that link is not showing anything
its blank and showing some error

FileNotFoundError

Traceback (most recent call last):
File "D:\ComfyUI\main.py", line 178, in execute
executed += recursive_execute(prompt, self.outputs, x, extra_data)
File "D:\ComfyUI\main.py", line 76, in recursive_execute
outputs[unique_id] = getattr(obj, obj.FUNCTION)(**input_data_all)
File "D:\ComfyUI\nodes.py", line 497, in save_images
img.save(f"output/{filename_prefix}{counter:05}.png", pnginfo=metadata, optimize=True)
File "D:\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 2428, in save
fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: 'output/ComfyUI_00010_.png'

No idea how to solve this problem.
I can't generate new image

Image generated from API doesn't load the workflow on the page

I generated images using the basic_api_example.py but when I try to drag them into the page, it doesn't load the workflow.

I checked the difference between the metadata of the image generated inside the page and from the api and the api images don't have the workflow metadata.

[Feature Request] ControlNet lowvram

The Mikubill/sd-webui-controlnet has a nice lowvram optimization, I can run it on stable-diffusion-webui in my 2GB GPU, but I cannot run the ControlNet from here because I get an out of memory error.

I tried to understand how it works to make that optimization in this repo, but I guess I'm not smart enough for that, I know it keeps things on cpu and load to gpu only when needed and send back to cpu after used, but I couldn't figure out how to make it in this repo.

It would be nice if someone smart like you could add this optimization here 😁

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.