Project-MONAI / GenerativeModels

MONAI Generative Models makes it easy to train, evaluate, and deploy generative models and related applications
Apache License 2.0
604 stars 87 forks source link

Verify if len(attention_levels) == len(num_channels) #219

Closed Warvito closed 1 year ago

Warvito commented 1 year ago

Add code to verify if the number of attentions levels is the same of the number elements in num_channels. Currently, the DiffusionModelUNet is raising the following error message

Traceback (most recent call last):
  File "/media/walter/Storage/Projects/GenerativeModels/venv/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3442, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-12-1dcab9cf177c>", line 1, in <module>
    model = DiffusionModelUNet(
  File "/media/walter/Storage/Projects/GenerativeModels/generative/networks/nets/diffusion_model_unet.py", line 1696, in __init__
    with_attn=(attention_levels[i] and not with_conditioning),
IndexError: tuple index out of range

Add the same verification to AutoencoderKL code

Warvito commented 1 year ago

Addressed in #216 for the autoencoderKL