ArtVentureX / comfyui-animatediff

AnimateDiff for ComfyUI
Apache License 2.0
649 stars 41 forks source link

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

Open Dxtrmst opened 7 months ago

Dxtrmst commented 7 months ago

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 commented 7 months ago

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

artventuredev commented 7 months ago

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

zlx2030 commented 7 months ago

me too

451518328 commented 6 months ago

same wrong....

artventuredev commented 6 months ago

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

isaac-bj commented 5 months ago

update custom_nodes

gogdodog commented 5 months ago

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 commented 5 months ago

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.