lucidrains / imagen-pytorch

Implementation of Imagen, Google's Text-to-Image Neural Network, in Pytorch
MIT License
8.11k stars 768 forks source link

NameError: name "model_validator" is not defined with version 1.26.1 #376

Closed niklasbubeck closed 10 months ago

niklasbubeck commented 10 months ago

Hi all :)

I encountered an issue with version 1.26.1 where the @model_validator decorator does not seem to be defined.

Traceback (most recent call last): File "/home/niklas/coding_projects/MRIDiffusion/diffusion/train_mri.py", line 16, in <module> from imagen_pytorch import Unet3D, ElucidatedImagen, ImagenTrainer, Imagen File "/home/niklas/anaconda3/envs/mridiff/lib/python3.10/site-packages/imagen_pytorch/__init__.py", line 13, in <module> from imagen_pytorch.configs import UnetConfig, ImagenConfig, ElucidatedImagenConfig, ImagenTrainerConfig File "/home/niklas/anaconda3/envs/mridiff/lib/python3.10/site-packages/imagen_pytorch/configs.py", line 67, in <module> class ImagenConfig(AllowExtraBaseModel): File "/home/niklas/anaconda3/envs/mridiff/lib/python3.10/site-packages/imagen_pytorch/configs.py", line 78, in ImagenConfig @model_validator(mode="after") NameError: name 'model_validator' is not defined

The stacktrace shows, that the error occures already when importing the module which I installed using pip install imagen-pytorch

I downgraded the version to 1.25.12 which solves the issue. When looking at the difference between the versions it seems that the decorator was renamed from @validator to @model_validator.

@lucidrains Can you give some more input on that?

Best, Niklas

lucidrains commented 10 months ago

@niklasbubeck yes, should be fixed! was a pydantic update done by @TheFusion21