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

AttributeError: module 'comfy.ops' has no attribute 'Linear' #76

Open
Dxtrmst opened this issue Dec 13, 2023 · 8 comments
Open

AttributeError: module 'comfy.ops' has no attribute 'Linear' #76

Dxtrmst opened this issue Dec 13, 2023 · 8 comments

Comments

@Dxtrmst
Copy link

Dxtrmst commented Dec 13, 2023

got this error,
Error occurred when executing ADE_AnimateDiffLoaderWithContext:

module 'comfy.ops' has no attribute 'Linear'

File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 83, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\nodes.py", line 115, in load_mm_and_inject_params
motion_model = load_motion_module(model_name, model, motion_lora=motion_lora, motion_model_settings=motion_model_settings)
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\model_injection.py", line 167, in load_motion_module
ad_wrapper = AnimateDiffModel(mm_state_dict=mm_state_dict, mm_info=mm_info)
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 150, in init
self.down_blocks.append(MotionModule(c, temporal_position_encoding_max_len=self.encoding_max_len, block_type=BlockType.DOWN))
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 299, in init
get_motion_module(in_channels, temporal_position_encoding_max_len),
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 329, in get_motion_module
return VanillaTemporalModule(in_channels=in_channels, temporal_position_encoding_max_len=temporal_position_encoding_max_len)
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 347, in init
self.temporal_transformer = TemporalTransformer3DModel(
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 422, in init
[
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 423, in
TemporalTransformerBlock(
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 523, in init
VersatileAttention(
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_module_ad.py", line 619, in init
super().init(*args, **kwargs)
File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\motion_utils.py", line 45, in init
self.to_q = operations.Linear(query_dim, inner_dim, bias=False, dtype=dtype, device=device)

Thank you for your hardwork. hope you can advise how to resolve this.

@chlgks2
Copy link

chlgks2 commented Dec 17, 2023

I am also suffering from the same error. I'd like to hear some advice.

@artventuredev
Copy link
Contributor

You may want to try updating the custom node. Btw, you're using a folk of this repo.

@zlx2030
Copy link

zlx2030 commented Dec 18, 2023

me too

@451518328
Copy link

same wrong....

@artventuredev
Copy link
Contributor

If you are all using ComfyUI-AnimateDiff-Evolved, please open a new ticket here: https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved/issues

@isaac-bj
Copy link

update custom_nodes

@gogdodog
Copy link

in the path "ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff", open the file "motion_utilis.py", in the line 33 replace the lines " class CrossAttentionMM(nn.Module):
def init(self, query_dim, context_dim=None, heads=8, dim_head=64, dropout=0., dtype=None, device=None, operations=comfy.ops):
super().init()
inner_dim = dim_head * heads
context_dim = default(context_dim, query_dim)"

for

"class CrossAttentionMM(nn.Module):
def init(self, query_dim, context_dim=None, heads=8, dim_head=64, dropout=0., dtype=None, device=None,
operations=comfy.ops.disable_weight_init if hasattr(comfy.ops, "disable_weight_init") else comfy.ops):
super().init()
inner_dim = dim_head * heads
context_dim = default(context_dim, query_dim)" , save and you're done.

@Kosinkadink
Copy link

Anyone experiencing this issue, either your ComfyUI is badly outdated by 2+ months, and/or your ComfyUI-AnimateDiff-Evolved is badly outdated. Update whichever one is outdated to fix your issue.

If you are using collab or something of that nature, whatever you may have been trying to update ComfyUI was not working, making you not get any ComfyUI updates for the past few months. If you're in that boat, try to recreate ComfyUI from scratch or a different method to update. As for AnimateDiff-Evolved, that should update without any issues.

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

8 participants