ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

VAE Encode (For Inpaint) 'VAE' object has no attribute 'vae_dtype'

Open FVolral opened this issue 2 years ago • 7 comments

Expected Behavior

VAEEncodeForInpaint should not Fail

Actual Behavior

VAEEncodeForInpaint does fail and this error message is displayed : image

Steps to Reproduce

Add a node "VAE Encode for Inpainting" image

Debug Logs

I got this error

2024-09-10 18:46:41,889 - root - ERROR - Traceback (most recent call last):
  File "XXXX\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "XXXX\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "XXXX\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "XXXX\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "XXXX\ComfyUI_windows_portable\ComfyUI\nodes.py", line 363, in encode
    t = vae.encode(pixels)
        ^^^^^^^^^^^^^^^^^^
  File "XXXX\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 348, in encode
    memory_used = self.memory_used_encode(pixel_samples.shape, self.vae_dtype)
                                                               ^^^^^^^^^^^^^^
AttributeError: 'VAE' object has no attribute 'vae_dtype'

Other

No response

FVolral avatar Sep 10 '24 16:09 FVolral

Sorry I didn't saw the warning message here : WARNING - WARNING: No VAE weights detected, VAE not initalized.

FVolral avatar Sep 10 '24 17:09 FVolral

Sorry I didn't saw the warning message here : WARNING - WARNING: No VAE weights detected, VAE not initalized.

hey how did you resolved this issue

DevishMittal avatar Sep 19 '24 21:09 DevishMittal

同样的问题 请问怎么解决的

zhili007 avatar Oct 05 '24 10:10 zhili007

The VAE Loader should be used to load VAE Models, not to attempt loading checkpoint models.

ltdrdata avatar Oct 06 '24 14:10 ltdrdata

Hi, can you explain how to add the safetensors file as a VAE? I’m having trouble following the instructions because I can't download the image—my browser says it’s blocked or missing.

IL3DCR avatar Oct 22 '24 16:10 IL3DCR

@IL3DCR To add only-VAE safetensors files, you need to place them inside ComfyUI/models/vae folder. Then you can load them through VAE Loader node.

But if you mean "only a VAE from a Checkpoint", you need to load the entire model through Load Checkpoint and just connect the VAE. Or you can use VAESave node to extract the VAE from the Checkpoint, and then use VAE Loader.

LukeG89 avatar Oct 22 '24 17:10 LukeG89

Hi, can you explain how to add the safetensors file as a VAE? I’m having trouble following the instructions because I can't download the image—my browser says it’s blocked or missing.

Talk to ChatGPT, he can help you

RakibMohaimin726 avatar Nov 06 '24 07:11 RakibMohaimin726