Kosinkadink / ComfyUI-AnimateDiff-Evolved

Improved AnimateDiff for ComfyUI and Advanced Sampling Support
Apache License 2.0
2.76k stars 208 forks source link

ModelPatcherAndInjector.unpatch_model() got an unexpected keyword argument 'unpatch_weights' #325

Closed AugmentedRealityCat closed 7 months ago

AugmentedRealityCat commented 7 months ago

I get this error when trying to run the AnimateDiff-Lightning sample workflow. It is triggered by the KSampler node, but the error message directly references the AnimateDiff-Evolved code. I have seen this error mentioned on the ComfyUI Issues page as well and I tried the solutions proposed in that thread, but it did not work. link to that page: https://github.com/comfyanonymous/ComfyUI/issues/3100 I deleted AnimateDiff-Evolved (after first backing up the models) and git-cloned it from scratch (and then I put the models back there) I updated Comfy. I tried installing the AnimateDiff-Evolved develop branch since the "unpatch_weights" function was mentioned quite a few times over there. I tried the current main branch version as well, of course. It's with that one that I get the error below:

Error occurred when executing KSampler:

ModelPatcherAndInjector.unpatch_model() got an unexpected keyword argument 'unpatch_weights'

  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, 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 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1369, in sample
    return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1339, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\Comfyui-StableSR-main\nodes.py", line 69, in hook_sample
    return original_sample(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 9, in informative_sample
    return original_sample(*args, **kwargs)  # This code helps interpret error messages that occur within exceptions but does not have any impact on other operations.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateLCM\animatediff\sampling.py", line 334, in motion_sample
    latents = wrap_function_to_inject_xformers_bug_info(orig_comfy_sample)(model, noise, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateLCM\animatediff\utils_model.py", line 272, in wrapped_function
    return function_to_wrap(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 267, in motion_sample
    return orig_comfy_sample(model, noise, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sample.py", line 93, in sample
    real_model, positive_copy, negative_copy, noise_mask, models = prepare_sampling(model, noise.shape, positive, negative, noise_mask)
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sample.py", line 86, in prepare_sampling
    comfy.model_management.load_models_gpu([model] + models, model.memory_required([noise_shape[0] * 2] + list(noise_shape[1:])) + inference_memory)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 436, in load_models_gpu
    cur_loaded_model = loaded_model.model_load(lowvram_model_memory)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 302, in model_load
    self.model_unload()
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 312, in model_unload
    self.model.unpatch_model(self.model.offload_device, unpatch_weights=unpatch_weights)
Kosinkadink commented 7 months ago

This was already fixed yesterday - simply use the main branch and update to the newest version of AnimateDiff-Evolved. Whatever method you may have tried to update AnimateDiff-Evolved with might failed.

AugmentedRealityCat commented 7 months ago

I tried the following methods:

  1. delete the animateDiff-Evolved folder, and git-clone using this link: git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved
  2. delete the animateDiff-Evolved folder, and installed it via the ComfyUI manager interface
  3. delete the animateDiff-Evolved folder, and installed the Develop branch via git checkout
  4. delete the animateDiff-Evolved folder, and downloaded a zip from this repo, put the content in the custom nodes folder, and renamed it to remove the "-main" suffix at the end, just to make sure.

None of those have been working. ComfyUI tells me I have the latest version when I try to update it.

What should I do to solve my problem and make your fix work ? I am out of ideas. Maybe I have forgotten something very simple, or overlooked something, but I just can't get it to work.

Kosinkadink commented 7 months ago

The fix itself is just a normal update - you still getting that error means you are not running the latest code. The only other possibility is that you may have more than one install of AnimateDiff-Evolved in custom_nodes, one outdated and one not, and them both trying to load causes some parts of the updated install to be overwritten by the outdated install when ComfyUI boots up. Can you post a screenshot of the entirety of your custom_nodes directory?

Kosinkadink commented 7 months ago

Also, be sure you restart ComfyUI! Code gets loaded on startup.

AugmentedRealityCat commented 7 months ago

Here is my custom nodes dir listing:

D:\ComfyUI_windows_portable\ComfyUI\custom_nodes>dir
 Volume in drive D is D2TBNVME
 Volume Serial Number is 4CC9-D99A

 Directory of D:\ComfyUI_windows_portable\ComfyUI\custom_nodes

2024-03-22  01:49 AM    <DIR>          .
2024-03-22  01:49 AM    <DIR>          ..
2024-03-13  03:43 AM    <DIR>          cg-use-everywhere
2024-01-18  03:59 AM            10,143 clipseg.py
2024-01-28  11:04 PM    <DIR>          comfy-image-saver
2024-02-25  06:05 PM    <DIR>          comfy-todo
2024-02-13  10:40 PM    <DIR>          ComfyMath
2024-03-13  04:31 AM    <DIR>          ComfyUI-ADMotionDirector
2024-03-02  03:45 AM    <DIR>          ComfyUI-Advanced-ControlNet
2024-03-22  01:50 AM    <DIR>          ComfyUI-AnimateDiff-Evolved
2024-02-07  09:30 PM    <DIR>          ComfyUI-AnimateLCM
2024-03-02  06:38 AM    <DIR>          comfyui-art-venture
2024-02-09  12:18 AM    <DIR>          ComfyUI-BRIA_AI-RMBG
2024-03-03  03:02 AM    <DIR>          ComfyUI-CCSR
2024-02-01  12:42 AM    <DIR>          ComfyUI-Crystools
2024-01-15  04:42 AM    <DIR>          ComfyUI-Custom-Scripts
2024-03-20  06:09 AM    <DIR>          comfyui-dynamicprompts
2024-02-08  01:46 AM    <DIR>          ComfyUI-DynamiCrafter
2024-03-20  01:44 AM    <DIR>          ComfyUI-DynamiCrafterWrapper
2024-03-13  03:43 AM    <DIR>          ComfyUI-Easy-Use
2024-03-14  06:45 PM    <DIR>          ComfyUI-Flowty-LDSR
2024-03-02  03:45 AM    <DIR>          ComfyUI-Frame-Interpolation
2024-03-14  10:12 PM    <DIR>          ComfyUI-Image-Filters
2024-03-13  03:43 AM    <DIR>          ComfyUI-Impact-Pack
2024-03-13  03:43 AM    <DIR>          ComfyUI-Inspire-Pack
2024-03-19  05:55 AM    <DIR>          ComfyUI-Keyframed
2024-03-13  03:43 AM    <DIR>          ComfyUI-KJNodes
2024-01-31  06:08 AM    <DIR>          comfyui-lama-remover
2024-03-13  03:43 AM    <DIR>          ComfyUI-layerdiffusion
2024-01-28  11:04 PM    <DIR>          ComfyUI-Logic
2024-01-28  11:07 PM    <DIR>          ComfyUI-LogicUtils-main
2024-03-20  01:49 AM    <DIR>          ComfyUI-Manager
2024-01-31  07:08 PM    <DIR>          ComfyUI-Marigold
2024-03-13  03:43 AM    <DIR>          comfyui-mixlab-nodes
2024-02-09  01:24 AM    <DIR>          ComfyUI-MotionCtrl-SVD
2024-03-21  09:59 PM    <DIR>          ComfyUI-N-Sidebar
2024-01-17  10:43 PM    <DIR>          ComfyUI-post-processing-nodes
2024-03-13  03:43 AM    <DIR>          comfyui-prompt-composer
2024-03-02  03:45 AM    <DIR>          comfyui-prompt-control
2024-03-02  03:45 AM    <DIR>          comfyui-propost
2024-02-26  06:50 AM    <DIR>          ComfyUI-QualityOfLifeSuit_Omar92
2024-01-31  07:41 PM    <DIR>          ComfyUI-RAFT
2024-01-31  07:08 PM    <DIR>          ComfyUI-RAVE
2024-03-02  03:45 AM    <DIR>          ComfyUI-sampler-lcm-alternative
2024-03-19  11:36 PM    <DIR>          ComfyUI-SaveImgPrompt
2024-03-19  11:36 PM    <DIR>          Comfyui-StableSR-main
2024-03-19  11:29 PM    <DIR>          ComfyUI-SUPIR
2024-02-08  03:05 PM    <DIR>          ComfyUI-SVD-ZHO
2024-02-08  03:05 PM    <DIR>          ComfyUI-svd_txt2vid
2024-03-02  03:45 AM    <DIR>          ComfyUI-TiledDiffusion
2024-03-05  11:22 PM    <DIR>          comfyui-tooling-nodes
2024-03-13  03:43 AM    <DIR>          comfyui-various
2024-02-08  01:46 AM    <DIR>          ComfyUI-Video-Matting
2024-01-10  03:25 AM    <DIR>          ComfyUI-VideoHelperSuite
2024-01-31  07:08 PM    <DIR>          ComfyUI-WD14-Tagger
2024-03-02  04:04 AM    <DIR>          ComfyUI_3dPoseEditor
2024-01-28  03:04 AM    <DIR>          comfyui_ab_samplercustom
2024-02-01  01:07 AM    <DIR>          ComfyUI_ADV_CLIP_emb
2024-03-02  03:45 AM    <DIR>          comfyui_bmad_nodes
2024-01-22  05:20 AM    <DIR>          ComfyUI_ColorMod
2024-01-27  01:29 AM    <DIR>          ComfyUI_Comfyroll_CustomNodes
2024-03-13  03:43 AM    <DIR>          comfyui_controlnet_aux
2024-01-28  05:47 AM    <DIR>          ComfyUI_Custom_Nodes_AlekPet-9a5b69fe0652244e17b07a69b52195f5b5b38db4
2024-03-13  03:43 AM    <DIR>          ComfyUI_essentials
2024-01-22  02:26 AM    <DIR>          ComfyUI_experiments
2024-03-02  03:45 AM    <DIR>          ComfyUI_FizzNodes
2024-01-23  04:08 AM    <DIR>          ComfyUI_GradientDeepShrink
2024-03-13  03:43 AM    <DIR>          ComfyUI_InstantID
2024-03-02  03:45 AM    <DIR>          ComfyUI_IPAdapter_plus
2024-01-29  03:30 AM    <DIR>          ComfyUI_MileHighStyler
2024-02-27  12:24 AM    <DIR>          ComfyUI_MSSpeech_TTS
2024-02-05  03:46 AM    <DIR>          ComfyUi_NNLatentUpscale
2024-01-21  03:00 AM    <DIR>          ComfyUI_Noise
2024-01-18  05:55 AM    <DIR>          ComfyUI_restart_sampling
2024-02-01  12:37 AM    <DIR>          comfyui_segment_anything
2024-01-31  07:08 PM    <DIR>          ComfyUI_SimpleTiles
2024-03-13  03:43 AM    <DIR>          ComfyUI_smZNodes
2024-03-13  03:43 AM    <DIR>          ComfyUI_tinyterraNodes
2024-01-18  03:29 AM    <DIR>          ComfyUI_UltimateSDUpscale
2024-03-19  05:55 AM    <DIR>          ComfyUI_VisualStylePrompting-main
2024-03-15  01:45 AM    <DIR>          ComfyUI_VLM_nodes
2024-03-13  03:43 AM    <DIR>          comfy_mtb
2024-02-28  01:30 AM    <DIR>          ControlNet-LLLite-ComfyUI
2024-01-28  01:14 AM    <DIR>          demofusion-comfyui
2024-01-18  06:37 AM    <DIR>          Derfuu_ComfyUI_ModdedNodes
2024-01-31  07:08 PM    <DIR>          efficiency-nodes-comfyui
2024-02-25  05:55 PM             5,305 example_node.py.example
2024-02-24  05:21 PM               608 gcLatentTunnel.py
2024-01-21  12:38 AM            20,445 hakkun_nodes.py
2024-01-31  06:08 AM    <DIR>          image-resize-comfyui
2024-02-01  12:39 AM    <DIR>          komojini-comfyui-nodes
2024-02-04  04:47 AM    <DIR>          LoadLoraWithTags
2024-03-13  03:43 AM    <DIR>          mikey_nodes
2024-01-27  07:03 PM             1,117 NK_4way Image Switch_v2.py
2024-01-27  07:03 PM             1,065 Nk_4way Latent Switch.py
2024-01-27  07:03 PM               921 Nk_imgInputSwitch3Way.py
2024-01-27  07:03 PM               742 Nk_vaeswitch.py
2024-03-02  03:45 AM    <DIR>          OneButtonPrompt
2024-03-15  02:06 AM    <DIR>          rgthree-comfy
2024-01-28  06:57 AM    <DIR>          SD-Advanced-Noise
2024-02-23  05:25 AM    <DIR>          SD-Latent-Interposer
2024-01-27  07:03 PM             3,217 SDXLAspectRatio.py
2024-01-27  01:29 AM    <DIR>          sdxl_prompt_styler
2024-01-18  07:36 AM             2,803 sdxl_utility.py
2024-01-28  05:11 AM    <DIR>          SeargeSDXL
2024-01-28  11:04 PM    <DIR>          stability-ComfyUI-nodes
2024-03-02  03:45 AM    <DIR>          steerable-motion
2024-01-23  03:32 AM    <DIR>          tiled_ksampler
2024-03-13  03:43 AM    <DIR>          was-node-suite-comfyui
2024-02-22  01:22 AM             1,500 websocket_image_save.py.disabled
2024-02-04  04:47 AM    <DIR>          wlsh_nodes
2024-02-24  05:21 PM    <DIR>          __pycache__
              11 File(s)         47,866 bytes
             101 Dir(s)  582,675,857,408 bytes free
AugmentedRealityCat commented 7 months ago

All the nodes are loading properly at startup as well:

Import times for custom nodes:
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\Nk_vaeswitch.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\gcLatentTunnel.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\Nk_imgInputSwitch3Way.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\SDXLAspectRatio.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\sdxl_utility.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-svd_txt2vid
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\NK_4way Image Switch_v2.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\efficiency-nodes-comfyui
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\Nk_4way Latent Switch.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-N-Sidebar
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\hakkun_nodes.py
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\sdxl_prompt_styler
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\image-resize-comfyui
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\SD-Latent-Interposer
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-sampler-lcm-alternative
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\LoadLoraWithTags
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_GradientDeepShrink
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-RAVE
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy-todo
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-prompt-composer
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_ab_samplercustom
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Noise
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ControlNet-LLLite-ComfyUI
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_ADV_CLIP_emb
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\tiled_ksampler
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Logic
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SaveImgPrompt
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-post-processing-nodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\stability-ComfyUI-nodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\cg-use-everywhere
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-tooling-nodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_3dPoseEditor
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SVD-ZHO
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\SD-Advanced-Noise
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUi_NNLatentUpscale
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_SimpleTiles
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_experiments
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-BRIA_AI-RMBG
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_ColorMod
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_restart_sampling
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\Comfyui-StableSR-main
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-lama-remover
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\mikey_nodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_VisualStylePrompting-main
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-layerdiffusion
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_FizzNodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Video-Matting
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Flowty-LDSR
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-LogicUtils-main
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyMath
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DynamiCrafterWrapper
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\demofusion-comfyui
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-QualityOfLifeSuit_Omar92
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-DynamiCrafter
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-RAFT
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-various
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\steerable-motion
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_UltimateSDUpscale
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Marigold
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Frame-Interpolation
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\rgthree-comfy
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\Derfuu_ComfyUI_ModdedNodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateLCM
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Custom-Scripts
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_bmad_nodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\wlsh_nodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-SUPIR
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_essentials
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-KJNodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Comfyroll_CustomNodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-TiledDiffusion
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Keyframed
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy_mtb
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Inspire-Pack
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_smZNodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy-image-saver
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-prompt-control
   0.0 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\komojini-comfyui-nodes
   0.1 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-MotionCtrl-SVD
   0.1 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_InstantID
   0.1 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-ADMotionDirector
   0.1 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_MileHighStyler
   0.1 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts
   0.1 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-propost
   0.1 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_VLM_nodes
   0.2 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_MSSpeech_TTS
   0.2 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Crystools
   0.2 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Impact-Pack
   0.2 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\clipseg.py
   0.3 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager
   0.4 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Easy-Use
   0.4 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Image-Filters
   0.5 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-art-venture
   0.5 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-mixlab-nodes
   0.6 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-CCSR
   0.6 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\SeargeSDXL
   0.9 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\OneButtonPrompt
   1.3 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui
   2.2 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_segment_anything
   4.5 seconds: D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Custom_Nodes_AlekPet-9a5b69fe0652244e17b07a69b52195f5b5b38db4
Kosinkadink commented 7 months ago

Go into ComfyUI-AnimateDiff-Evolved/animatediff/model_injection.py, and take a screenshot around line 69, and post it here. Here is what it should look like: (and here is the link directly to the line in main branch: https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved/blob/main/animatediff/model_injection.py#L69) image

AugmentedRealityCat commented 7 months ago

I took a bit more before and after just to make sure.

    def patch_model(self, device_to=None, patch_weights=True):
        # first, perform model patching
        if patch_weights: # TODO: keep only 'else' portion when don't need to worry about past comfy versions
            patched_model = super().patch_model(device_to)
        else:
            patched_model = super().patch_model(device_to, patch_weights)
        # finally, perform motion model injection
        self.inject_model(device_to=device_to)
        return patched_model

    def unpatch_model(self, device_to=None, unpatch_weights=True):
        # first, eject motion model from unet
        self.eject_model(device_to=device_to)
        # finally, do normal model unpatching
        if unpatch_weights: # TODO: keep only 'else' portion when don't need to worry about past comfy versions
            return super().unpatch_model(device_to)
        else:
            return super().unpatch_model(device_to, unpatch_weights)

    def inject_model(self, device_to=None):
        if self.motion_models is not None:
            for motion_model in self.motion_models.models:
                motion_model.model.inject(self)
                try:
                    motion_model.model.to(device_to)
                except Exception:
                    pass
Kosinkadink commented 7 months ago

Then it should be fine. Are you sure you're looking in the right instance of ComfyUI? If that line is there, and there is no other version of ComfyUI-AnimateDiff-Evolved installed on that version of ComfyUI, then there is no reason why your ComfyUI should be using an old version of ComfyUI-AnimateDiff-Evolved. There is nothing I can do; there is nothing unique about this commit compared to any other, and the fix has worked as expected for everyone else.

AugmentedRealityCat commented 7 months ago

Here as a picture with the line numbers Untitled-1

AugmentedRealityCat commented 7 months ago

Look at the log - you can see it's directly referencing that install, and it's the only one.


Error occurred when executing KSampler:

ModelPatcherAndInjector.unpatch_model() got an unexpected keyword argument 'unpatch_weights'

  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, 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 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1369, in sample
    return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1339, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\Comfyui-StableSR-main\nodes.py", line 69, in hook_sample
    return original_sample(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 9, in informative_sample
    return original_sample(*args, **kwargs)  # This code helps interpret error messages that occur within exceptions but does not have any impact on other operations.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateLCM\animatediff\sampling.py", line 334, in motion_sample
    latents = wrap_function_to_inject_xformers_bug_info(orig_comfy_sample)(model, noise, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateLCM\animatediff\utils_model.py", line 272, in wrapped_function
    return function_to_wrap(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 267, in motion_sample
    return orig_comfy_sample(model, noise, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sample.py", line 93, in sample
    real_model, positive_copy, negative_copy, noise_mask, models = prepare_sampling(model, noise.shape, positive, negative, noise_mask)
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\sample.py", line 86, in prepare_sampling
    comfy.model_management.load_models_gpu([model] + models, model.memory_required([noise_shape[0] * 2] + list(noise_shape[1:])) + inference_memory)
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 436, in load_models_gpu
    cur_loaded_model = loaded_model.model_load(lowvram_model_memory)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 302, in model_load
    self.model_unload()
  File "D:\ComfyUI_windows_portable\ComfyUI\comfy\model_management.py", line 312, in model_unload
    self.model.unpatch_model(self.model.offload_device, unpatch_weights=unpatch_weights)

I'll remove all the custom nodes and I'll just add the ones I need to run the sample and I'll see if I can get some more info that way. I just cannot understand where the problem can be coming from.

Kosinkadink commented 7 months ago

Looking at your startup log again, I have a theory - disable/delete ComfyUI-AnimateLCM, it is entirely pointless to have it. ComfyUI-AnimateDiff-Evolved supports AnimateLCM natively, and ComfyUI-AnimateLCM copies and pastes my code, INCLUDING the ModelPatcherAndInjector class. And as you can imagine, they do not keep up with the ComfyUI updates like I do lol, so they dont have unpatch_weights added.

AugmentedRealityCat commented 7 months ago

I had the same intuition - and I can see AnimateLCM mentioned in the error message as well. This might well be the source of my problems ! I'll check that immediately and I'll come back asap to tell you if we have found the culprit.

Thanks for your help by the way - I really appreciate it !

AugmentedRealityCat commented 7 months ago

Y E S !

IT WORKS ! Thank you so much, I would never had that intuition without your help, and your confirmation just saved me a lot of time and hesitation.

Kosinkadink commented 7 months ago

No problem, glad we figured it out. It will help out anyone else has the same problem in the future - it was very adjacent to the "two installs, one outdated" problem.

AugmentedRealityCat commented 7 months ago

TLDR : if you have the same problem as the one I describre above, just uninstall AnimateLCM - you don't need it anyways.

Thanks again @Kosinkadink , it was very generous of you to help me solve this the way you did, and so quickly as well !

guge2772135136 commented 7 months ago

After reinstallation, everything is normal.