While running main.ipynb (after completing the installation instructions), I encountered the following issue after cell [7], which called on the function 'sample':
AttributeError Traceback (most recent call last)
Cell In[7], [line 10](vscode-notebook-cell:?execution_count=7&line=10)
[7](vscode-notebook-cell:?execution_count=7&line=7) for i in range(len(classes_names)):
[8](vscode-notebook-cell:?execution_count=7&line=8) test_masks[:,:,:,i*(512//len(classes_names)):(i+1)*(512//len(classes_names))]=i+1
---> [10](vscode-notebook-cell:?execution_count=7&line=10) outputs=sample(test_masks, cond_scale=3.0)
[12](vscode-notebook-cell:?execution_count=7&line=12) xtick_positions = [(512//(2*len(classes_names)))+(512//len(classes_names))*i for i in range(4)]
[14](vscode-notebook-cell:?execution_count=7&line=14) fig,ax=plt.subplots(ncols=2)
File ~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/utils/_contextlib.py:116, in context_decorator.<locals>.decorate_context(*args, **kwargs)
[113](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/utils/_contextlib.py:113) @functools.wraps(func)
[114](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/utils/_contextlib.py:114) def decorate_context(*args, **kwargs):
[115](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/utils/_contextlib.py:115) with ctx_factory():
--> [116](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/utils/_contextlib.py:116) return func(*args, **kwargs)
Cell In[4], [line 5](vscode-notebook-cell:?execution_count=4&line=5)
[1](vscode-notebook-cell:?execution_count=4&line=1) @torch.no_grad()
[2](vscode-notebook-cell:?execution_count=4&line=2) def sample(masks, cond_scale=3.0):
[3](vscode-notebook-cell:?execution_count=4&line=3) z = torch.ones((masks.shape[0],
[4](vscode-notebook-cell:?execution_count=4&line=4) 4,512//8,512//8), device='cuda:0')
----> [5](vscode-notebook-cell:?execution_count=4&line=5) z = trainer.ema.ema_model.sample(z,masks, cond_scale=cond_scale+1)*50
[6](vscode-notebook-cell:?execution_count=4&line=6) return torch.clip(trainer.vae.decode(z).sample,0,1)
File ~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/nn/modules/module.py:1931, in Module.__getattr__(self, name)
[1929](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/nn/modules/module.py:1929) if name in modules:
...
-> [1931](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/nn/modules/module.py:1931) raise AttributeError(
[1932](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/nn/modules/module.py:1932) f"'{type(self).__name__}' object has no attribute '{name}'"
[1933](https://file+.vscode-resource.vscode-cdn.net/home/diffinfinite/~/miniforge3/envs/diffinfinite/lib/python3.10/site-packages/torch/nn/modules/module.py:1933) )
AttributeError: 'GaussianDiffusion' object has no attribute 'ema_model'
It seems that this attribute should be a part of Trainer and not the GaussianDiffusion model itself. Is this something that's supposed to happen (no modifications were made to the code)? How would I go about fixing this? Any help would be much appreciated, thanks!
Hi,
While running main.ipynb (after completing the installation instructions), I encountered the following issue after cell [7], which called on the function 'sample':
It seems that this attribute should be a part of Trainer and not the GaussianDiffusion model itself. Is this something that's supposed to happen (no modifications were made to the code)? How would I go about fixing this? Any help would be much appreciated, thanks!