shiimizu / ComfyUI_smZNodes

Custom nodes for ComfyUI such as CLIP Text Encode++
GNU General Public License v3.0
168 stars 12 forks source link

RecursionError: maximum recursion depth exceeded #66

Closed fcolecumberri closed 3 months ago

fcolecumberri commented 3 months ago

For some reason now I get RecursionError, my (resumed) log is:

!!! Exception during processing !!!
Traceback (most recent call last):
  File "/home/franky/git_projects/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/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 "/home/franky/git_projects/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/nodes.py", line 1344, in sample
    return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/nodes.py", line 1314, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/sample_error_enhancer.py", line 22, in informative_sample
    raise e
  File "/home/franky/git_projects/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 "/home/franky/git_projects/ComfyUI/comfy/sample.py", line 37, in sample
    samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1427, in KSampler_sample
    return _KSampler_sample(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1427, in KSampler_sample
    return _KSampler_sample(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/samplers.py", line 755, in sample
    return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1450, in sample
    return _sample(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1450, in sample
    return _sample(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/samplers.py", line 657, in sample
    return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/samplers.py", line 644, in sample
    output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/samplers.py", line 623, in inner_sample
    samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/samplers.py", line 534, in sample
    samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/k_diffusion/sampling.py", line 695, in sample_dpmpp_3m_sde_gpu
    return sample_dpmpp_3m_sde(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, eta=eta, s_noise=s_noise, noise_sampler=noise_sampler)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/venv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/k_diffusion/sampling.py", line 655, in sample_dpmpp_3m_sde
    denoised = model(x, sigmas[i] * s_in, **extra_args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/samplers.py", line 272, in __call__
    out = self.inner_model(x, sigma, model_options=model_options, seed=seed)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/comfy/samplers.py", line 610, in __call__
    return self.predict_noise(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1102, in apply_model
    out = sup.predict_noise(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1102, in apply_model
    out = sup.predict_noise(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1102, in apply_model
    out = sup.predict_noise(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1102, in apply_model
    out = sup.predict_noise(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1102, in apply_model
    out = sup.predict_noise(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.
.
.
.
2000 Lines of the same
.
.
.

  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1102, in apply_model
    out = sup.predict_noise(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 974, in predict_noise
    return self.apply_model(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1015, in apply_model
    if (any([getp(p).get('from_smZ', False) for p in cc]) or
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franky/git_projects/ComfyUI/custom_nodes/ComfyUI_smZNodes/smZNodes.py", line 1015, in <listcomp>
    if (any([getp(p).get('from_smZ', False) for p in cc]) or
                 ^^^^^^^
RecursionError: maximum recursion depth exceeded

I have been trying to checkout to previous commits, however for some reason it throws other errors (wich I think are related to some change on comfy).

fcolecumberri commented 3 months ago

Update: I think this only happens with Img2Img workflows.

shiimizu commented 3 months ago

Thanks for the report. Does https://github.com/shiimizu/ComfyUI_smZNodes/commit/a4804c6f3b66314c7c0b1cea0c17f0b291d38d50 fix it?

fcolecumberri commented 3 months ago

No, the error is still there.

shiimizu commented 3 months ago

Do you have a workflow I can test?

fcolecumberri commented 3 months ago

Let me make a simpler workflow that can reproduce the error (Also, here it's 1am so I'll make it tomorrow), thanks a lot.

fcolecumberri commented 3 months ago

RecursionError_workflow.json

Here, this is a simple workflow I could made to replicate the error.

Also if I go back in time with bash:

MASTER=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
git checkout "$MASTER@{2024-04-04 18:30:00}"

for GITDIR in $(ls -d custom_nodes/*/)
do
    pushd $GITDIR
        if [ $(git rev-parse --show-toplevel) == $(pwd) ]
        then
            MASTER=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
            git checkout "$MASTER@{2024-04-04 18:30:00}"
            if [ -f requirements.txt ]
            then
                pip3 install --require-virtualenv -r requirements.txt &
            fi
        fi
    popd
done

Everything works fine.

shiimizu commented 3 months ago

Thanks for the workflow. Though, things still worked fine on my end. Does the latest commit (https://github.com/shiimizu/ComfyUI_smZNodes/commit/378ed4567f3290823d5dc5e9556c7d742dc82d23) fix it?

fcolecumberri commented 3 months ago

Yes, Thanks a LOT!!