Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!! Exception during processing !!! 'AutoencoderKLCogVideoX' object has no attribute '_clear_fake_context_parallel_cache' #445

Open
1 of 2 tasks
XiangGuilin opened this issue Oct 24, 2024 · 5 comments
Assignees

Comments

@XiangGuilin
Copy link

System Info / 系統信息

cuda:12.6
torch: 2.5.0+cu124
Python: 3.12.5

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

when i run cogvideox-i2v, i will get the error in this node: CogVideo ImageEncode
here is the log :

!!! Exception during processing !!! 'AutoencoderKLCogVideoX' object has no attribute '_clear_fake_context_parallel_cache'
Traceback (most recent call last):
File "E:\comfyui-aki\ComfyUI-aki-v1.4\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 "E:\comfyui-aki\ComfyUI-aki-v1.4\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 "E:\comfyui-aki\ComfyUI-aki-v1.4\execution.py", line 169, in _map_node_over_list
process_inputs(input_dict, i)
File "E:\comfyui-aki\ComfyUI-aki-v1.4\execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
File "E:\comfyui-aki\ComfyUI-aki-v1.4\custom_nodes\ComfyUI-CogVideoXWrapper\nodes.py", line 986, in encode
latents = vae.encode(image_chunk)
File "E:\comfyui-aki\ComfyUI-aki-v1.4\python\lib\site-packages\diffusers\utils\accelerate_utils.py", line 46, in wrapper
return method(self, *args, **kwargs)
File "E:\comfyui-aki\ComfyUI-aki-v1.4\custom_nodes\ComfyUI-CogVideoXWrapper\mz_enable_vae_encode_tiling.py", line 27, in encode
h = self._encode(x)
File "E:\comfyui-aki\ComfyUI-aki-v1.4\custom_nodes\ComfyUI-CogVideoXWrapper\mz_enable_vae_encode_tiling.py", line 113, in _encode
return self.tiled_encode(x)
File "E:\comfyui-aki\ComfyUI-aki-v1.4\custom_nodes\ComfyUI-CogVideoXWrapper\mz_enable_vae_encode_tiling.py", line 86, in tiled_encode
self._clear_fake_context_parallel_cache()
File "E:\comfyui-aki\ComfyUI-aki-v1.4\python\lib\site-packages\diffusers\models\modeling_utils.py", line 155, in getattr
return super().getattr(name)
File "E:\comfyui-aki\ComfyUI-aki-v1.4\python\lib\site-packages\torch\nn\modules\module.py", line 1709, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'AutoencoderKLCogVideoX' object has no attribute '_clear_fake_context_parallel_cache'

Expected behavior / 期待表现

no error

@s2n-Gribbly
Copy link

I noticed that in nodes.py, the vae._clear_fake_context_parallel_cache() are all wrapped with a try except.

mz_enable_var_encode_tiling.py, vae._clear_fake_context_parallel_cache() doesn't have the same, I added the try, except around the vae._clear_fake_context_parallel_cache() instances and all is working fine now!

@smbell1979
Copy link

I'm also having this same issue.
image

I tried the fix that @s2n-Gribbly mentioned, but I don't have the vae._clear_fake_context_parallel_cache() in my mz_enable_vae_encode_tiling.py file.

There is a self._clear_fake_context_parallel_cache(). I tried to wrap this in the same try/except and it caused more errors. I possibly did it incorrectly.

Do you mind posting exactly how you modified the file?

@smbell1979
Copy link

smbell1979 commented Oct 24, 2024

Ok, I've successfully fixed the error on two separate machines.... These are steps I came across accidentally:

I dropped a new CogVideo ImageEncode node, I restarted comfyUI and reloaded the workflow, disabled "enable_tlling" and it works fine now, no error.

Edit: I reconnected the original node, disabled tiling and this also works, so it's not the new node, it's the "enable_tiling" What's weird is that I tried to disable that initially and still got the error.

Edit 2: More detective work... Once the error occurs once, you will need to restart comfyUI or it will continue to error even though "enable_tiling" is disabled.

@XiangGuilin
Copy link
Author

好的,我已经成功修复了不同机器上的错误……这些是我偶然遇到的步骤:

我删除了一个新的 CogVideo ImageEncode 节点,重新启动了 comfyUI 并重新加载了工作流程,取消了“enable_tlling”,现在运行良好,没有错误。

编辑:我重新连接了原始节点,取消了平铺,但是也有效,所以它不是新节点,然后“enable_tiling”奇怪的是,我最初尝试取消它,但仍然出现错误。

编辑2:更多的侦探工作...一旦错误发生一次,您将需要重新启动comfyUI,否则即使“enable_tiling”被取消,它仍然会继续出错。

oh! crazy! it works! but when i disabled "enable_tiling", i will get an OOM, hahaha~
its indeed a bug,and i saw it has been fixed.
0d30077edaee47dadba6bb467161edd4
46fc246ae7c2bd3fd81ceb06217582df

@zRzRzRzRzRzRzR zRzRzRzRzRzRzR self-assigned this Oct 28, 2024
@zRzRzRzRzRzRzR
Copy link
Member

zRzRzRzRzRzRzR commented Oct 28, 2024

Has this issue been resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants