jags111 / efficiency-nodes-comfyui

A collection of ComfyUI custom nodes.- Awesome smart way to work with nodes!
https://civitai.com/models/32342
GNU General Public License v3.0
882 stars 89 forks source link

[BUG] AttributeError: 'BaseModel' object has no attribute 'num_timesteps' #35

Closed alicat22 closed 8 months ago

alicat22 commented 9 months ago

When queuing the following workflow, I receive an error on the KSampler Adv. (Efficent), AttributeError: 'BaseModel' object has no attribute 'num_timesteps'. Workflow for replication: Bug_Report.json

Expected outcome: The workflow should queue and generate an xy plot with each model located in the folder with 4 seeds.

See below for the error log:

Starting server

To see the GUI go to: http://127.0.0.1:8188
FETCH DATA from: D:\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json
got prompt
Requested to load SD1ClipModel
Loading 1 new model
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
----------------------------------------
Efficient Loader Models Cache:
Ckpt:
  [1] AnythingV5V3_v5PrtRE
Vae:
  [1] blessed2.vae
----------------------------------------
XY Plot Script Inputs:
(X) Seeds++ Batch:
    8948454
    8948455
    8948456
    8948457
(Y) Checkpoint:
    ('AnythingV5V3_v5PrtRE.safetensors', None, None)
    ('CounterfeitV30_v30.safetensors', None, None)
    ('FaceBombMix-fp16-no-ema.safetensors', None, None)
    ('MF-AscendanceOfABookworm_V2_T3.1.safetensors', None, None)
    ('MF-EminenceInShadow_V1.ckpt', None, None)
    ('MF-KonoSuba-V1.1-T2.11.ckpt', None, None)
    ('MeinaHentai V5.safetensors', None, None)
    ('MyneFactoryBase V1.0.safetensors', None, None)
    ('SomethingV2_2.safetensors', None, None)
    ('aurora_v10.safetensors', None, None)
    ('bofuri-ep01-gs57751.safetensors', None, None)
    ('calicomix_v75.safetensors', None, None)
    ('cetusMix_v4.safetensors', None, None)
    ('corneos7thHeavenMix_100.safetensors', None, None)
    ('ctd-darkmix.safetensors', None, None)
    ('darkSushi25D25D_v40.safetensors', None, None)
    ('deepboys25D_v30.safetensors', None, None)
    ('detailedprojectv4-fin.safetensors', None, None)
    ('dpep3-chillout.safetensors', None, None)
    ('dreamlike-anime-1.0.safetensors', None, None)
    ('hell5-dpep.safetensors', None, None)
    ('meinaalter_v3.safetensors', None, None)
    ('meinamix_meinaV11.safetensors', None, None)
    ('sakushimixFinished_sakushimixFinal.safetensors', None, None)
    ('sakushimixHentai_v11.safetensors', None, None)
    ('udonNoodleMix_udonNoodleMix.safetensors', None, None)
----------------------------------------
Requested to load SD1ClipModel
Loading 1 new model
ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
  File "D:\ComfyUI\execution.py", line 153, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\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\execution.py", line 76, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\efficiency-nodes-comfyui\efficiency_nodes.py", line 2175, in sample_adv
    return super().sample(model, noise_seed, steps, cfg, sampler_name, scheduler, positive, negative,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\efficiency-nodes-comfyui\efficiency_nodes.py", line 1542, in sample
    process_values(model, refiner_model, add_noise, seed, steps, start_at_step, end_at_step,
  File "D:\ComfyUI\custom_nodes\efficiency-nodes-comfyui\efficiency_nodes.py", line 1413, in process_values
    samples, images, _, _ = process_latent_image(model, seed, steps, cfg, sampler_name, scheduler, positive, negative,
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\efficiency-nodes-comfyui\efficiency_nodes.py", line 537, in process_latent_image
    samples = KSamplerAdvanced().sample(model, add_noise, seed, steps, cfg, sampler_name, scheduler,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\nodes.py", line 1271, in sample
    return common_ksampler(model, noise_seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise, disable_noise=disable_noise, start_step=start_at_step, last_step=end_at_step, force_full_denoise=force_full_denoise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\nodes.py", line 1207, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\sample_error_enhancer.py", line 9, in informative_sample
    return original_sample(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\ComfyUI-AnimateDiff-Evolved\animatediff\sampling.py", line 147, in animatediff_sample
    return orig_comfy_sample(model, noise, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\comfy\sample.py", line 98, in sample
    sampler = comfy.samplers.KSampler(real_model, steps=steps, device=model.load_device, sampler=sampler_name, scheduler=scheduler, denoise=denoise, model_options=model.model_options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\efficiency-nodes-comfyui\py\smZ_cfg_denoiser.py", line 321, in __init__
    set_model_k(self)
  File "D:\ComfyUI\custom_nodes\efficiency-nodes-comfyui\py\smZ_cfg_denoiser.py", line 308, in set_model_k
    self.model_denoise = CFGNoisePredictor(self.model) # main change
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ComfyUI\custom_nodes\efficiency-nodes-comfyui\py\smZ_cfg_denoiser.py", line 256, in __init__
    self.inner_model2.num_timesteps = model.num_timesteps
                                      ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ali\miniconda3\envs\comfy\Lib\site-packages\torch\nn\modules\module.py", line 1695, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'BaseModel' object has no attribute 'num_timesteps'

Prompt executed in 4.54 seconds

If you require anything additional, please let me know!

Platform: Windows Install method: Manual (Conda) Python: 3.11 Commit: 8cae155233444c9f16172389dedbe38d386f1b15

alicat22 commented 9 months ago

Full log containing all the nodes loaded: https://gist.github.com/alicat22/55029b196bc0a5e4ddcf676cf5b84d33

jags111 commented 9 months ago

okay will need to review this and update!

alicat22 commented 9 months ago

I did some troubleshooting and I figured out what is causing it! If cfg_denoiser is set to True then it produces the above error. If it's set to False then it works correctly.

image

Natotela commented 9 months ago

Hd the same issue and FALSE resolved it, but I figure at the cost of some of the point in that workflow?

jags111 commented 9 months ago

I am aware of it and will change part of the code on same so it will resolve