[ComfyUI] Installation window version

Preface

Since stable diffusion web uiit is impossible to control the process, 生成everything is handled by AI after just clicking a button. However, when used in production and life, each process needs to be carefully controlled.

Therefore, there is today’s pig’s feet:Comfyui

step

  1. Download comfyui project
  2. Configure large models and VAE
  3. Download dependent components
  4. start up

Download comfyUI

Official website address: https://github.com/comfyanonymous/ComfyUI

Download the project to your favorite directory, here is mine:

yutao@yutao MINGW64 /e/openai/project
$ git clone https://github.com/comfyanonymous/ComfyUI.git

Configure large models and VAE

  1. ComfyUI\models\checkpointsEnlarge the model file in
  2. Put the vae file in ComfyUI\models\vae.

Howeverstable diffusion , we basically learn from stable diffusion webuithe beginning, so we actually don’t need additional downloads, checkpoints and vae, but share them.

The author of ComfyUI provides configuration methods:

  1. Modify extra_model_paths.yaml.examplethe file and rename it to:extra_model_paths.yaml
  2. Open the file and modify the base_path inside:
    The following is my stable-diffusion-webuipath
a111:
    base_path: E:\openai\project\stable-diffusion-webui

Save and exit.

Download dependent components

Call up the command line in ComfyUI (type cmd on the folder path and press Enter) and execute:

E:\openai\project\ComfyUI>pip install -r requirements.txt

The download of required dependent components will begin.

start up

Order:python main.py

E:\openai\project\ComfyUI>python main.py

Insert image description here

Browser access address:http://127.0.0.1:8188

On the far left, because I had downloaded the guofeng3 large model when I played stable diffusion before. So what I show in the load checkpoint is guofeng3.

For large models, I downloaded guofeng3 .
Put it models/checkpointsin a folder, for example: E:\openai\project\ComfyUI\models\checkpoints.

Insert image description here

Generate pictures

Because the default parameters can generate a vase, click on the upper right corner Queue Prompt.
Insert image description here

But my computer is always not so smooth.

Detailed description article: [ComfyUI] RuntimeError: CUDA error: operation not supported

The following error was reported:

got prompt
model_type EPS
adm 0
making attention of type 'vanilla-pytorch' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla-pytorch' with 512 in_channels
missing {
    
    'cond_stage_model.text_projection', 'cond_stage_model.logit_scale'}
left over keys: dict_keys(['cond_stage_model.transformer.text_model.embeddings.position_ids', 'model_ema.decay', 'model_ema.num_updates'])
loading new
loading new
loading in lowvram mode 1842.6899042129517
!!! Exception during processing !!!
Traceback (most recent call last):
  File "E:\openai\project\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\ComfyUI\nodes.py", line 1236, in sample
    return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\ComfyUI\nodes.py", line 1206, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\ComfyUI\comfy\sample.py", line 81, in sample
    comfy.model_management.load_models_gpu([model] + models, comfy.model_management.batch_area_memory(noise.shape[0] * noise.shape[2] * noise.shape[3]) + inference_memory)
  File "E:\openai\project\ComfyUI\comfy\model_management.py", line 394, in load_models_gpu
    cur_loaded_model = loaded_model.model_load(lowvram_model_memory)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\openai\project\ComfyUI\comfy\model_management.py", line 288, in model_load
    accelerate.dispatch_model(self.real_model, device_map=device_map, main_device=self.device)
  File "D:\Program Files\Python\Lib\site-packages\accelerate\big_modeling.py", line 391, in dispatch_model
    attach_align_device_hook_on_blocks(
  File "D:\Program Files\Python\Lib\site-packages\accelerate\hooks.py", line 532, in attach_align_device_hook_on_blocks
    add_hook_to_module(module, hook)
  File "D:\Program Files\Python\Lib\site-packages\accelerate\hooks.py", line 155, in add_hook_to_module
    module = hook.init_hook(module)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Program Files\Python\Lib\site-packages\accelerate\hooks.py", line 253, in init_hook
    set_module_tensor_to_device(module, name, self.execution_device)
  File "D:\Program Files\Python\Lib\site-packages\accelerate\utils\modeling.py", line 307, in set_module_tensor_to_device
    new_value = old_value.to(device)
                ^^^^^^^^^^^^^^^^^^^^
RuntimeError: CUDA error: operation not supported
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

In fact, it means that my current computer's GPU or hardware does not support certain operations in current CUDA.

Solution

The official provides two solution strategies.

Method One: Blacklist Strategy

Insert image description here

Insert image description here

After adding, restart. Found it still doesn't work.

Method 2: Add –disable-cuda-malloc at startup

# 注意--disable-cuda-malloc
E:\openai\project\ComfyUI>python main.py --disable-cuda-malloc

Finally, it was solved through method two.


Reference address:

https://github.com/comfyanonymous/ComfyUI#manual-install-windows-linux

Stable Diffusion ComfyUI Getting Started Experience

Guess you like

Origin blog.csdn.net/u013066244/article/details/132868297