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

Cannot import F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy module for custom nodes: No module named 'diffusers.models.unet_2d_blocks' #37

Open
Andy2024mm opened this issue Sep 17, 2024 · 8 comments

Comments

@Andy2024mm
Copy link

Traceback (most recent call last):
File "F:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1993, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy_init
.py", line 1, in
from .LCM_Nodes import NODE_CLASS_MAPPINGS
File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy\LCM_Nodes.py", line 9, in
from .LCM.LCM_reference_pipeline import LatentConsistencyModelPipeline_reference
File "F:\ComfyUI_windows_portable\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy\LCM\LCM_reference_pipeline.py", line 33, in
from diffusers.models.unet_2d_blocks import CrossAttnDownBlock2D, CrossAttnUpBlock2D, DownBlock2D, UpBlock2D
ModuleNotFoundError: No module named 'diffusers.models.unet_2d_blocks'

@Neytiri7
Copy link

Traceback (most recent call last):
  File "W:\SynologyDrive\ComfyUI-webui\ComfyUI\nodes.py", line 2001, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "W:\SynologyDrive\ComfyUI-webui\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy\__init__.py", line 1, in <module>
    from .LCM_Nodes import NODE_CLASS_MAPPINGS
  File "W:\SynologyDrive\ComfyUI-webui\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy\LCM_Nodes.py", line 9, in <module>
    from .LCM.LCM_reference_pipeline import LatentConsistencyModelPipeline_reference
  File "W:\SynologyDrive\ComfyUI-webui\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy\LCM\LCM_reference_pipeline.py", line 33, in <module>
    from diffusers.models.unet_2d_blocks import CrossAttnDownBlock2D, CrossAttnUpBlock2D, DownBlock2D, UpBlock2D
ModuleNotFoundError: No module named 'diffusers.models.unet_2d_blocks'

Cannot import W:\SynologyDrive\ComfyUI-webui\ComfyUI\custom_nodes\LCM_Inpaint-Outpaint_Comfy module for custom nodes: No module named 'diffusers.models.unet_2d_blocks'

@glg5
Copy link

glg5 commented Oct 12, 2024

Diffusers 包已将unet_2d_blocks.py 移至“diffusers/models/unets/”路径,而不是以前的“diffusers/models/”路径。 LCM_Inpaint_Outpaint_Comfy/LCM的py文件(包括LCM_lora_inpaint.py,LCM_refinpaint_pipeline.py,LCM_reference_pipeline.py,LCM_lora_inpaint_ipadapter.py,pipeline_cn_reference_img2img.py,pipeline_inpaint_cn_reference.py,stable_diffusion_reference_img2img.py,stable_diffusion_reference_img2img_controlnet.py)应从 更改from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block为from diffusers.models.unets.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block。

@johnnynunez
Copy link

#38

@johnnynunez
Copy link

I changed in workflow.json \ to /

@prashanthkannan
Copy link

You have to replace from diffusers.models.unet_2d_blocks to from diffusers.models.unets.unet_2d_blocks (everywhere) its in like a 20 places.

@Neytiri7
Copy link

LCM_Inpaint_Outpaint_Comfy\LCM When diffusers.models.unet_2d_blocks of py files in this folder were replaced with diffusers.models.unet_2d_blocks, the error disappeared.

@goodluck821
Copy link

goodluck821 commented Dec 1, 2024

在大家的指导下,特别是 Neytiri7的提醒,解决了问题。思路和方法如下:一、from diffusers.models.unet_2d_blocks import CrossAttnDownBlock2D, CrossAttnUpBlock2D, DownBlock2D, UpBlock2D,找不到python库的模块,我就到python\Lib\site-packages\diffusers\models确实没有unet_2d_blocks块,最后在python\Lib\site-packages\diffusers\models\unets里面找到这一块;二、分析说明是这个模块发生了变化,只需要修改from就可以;三、在LCM中很多个文件中都有from diffusers.models.unet_2d_blocks,要逐一找到修改;四、修改内容很简单:将from diffusers.models.unet_2d_blocks修改成from diffusers.models.unets.unet_2d_blocks,问题完美解决。

@Neytiri7
Copy link

Neytiri7 commented Dec 1, 2024

I hope it will be fixed formally.

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

6 participants