AntixK / PyTorch-VAE

A Collection of Variational Autoencoders (VAE) in PyTorch.
Apache License 2.0
6.44k stars 1.05k forks source link

AttributeError: 'VAEDataset' object has no attribute '_has_setup_TrainerFn.FITTING #80

Open Jarye0612 opened 12 months ago

Jarye0612 commented 12 months ago

when i use vae.yaml,I get the error code:AttributeError: 'VAEDataset' object has no attribute '_has_setup_TrainerFn.FITTING,how to fix the problem? PS: pytorch_lightning==1.5.6 torch==2.0.1

CristianoPatricio commented 11 months ago

Hi @Jarye0612,

I got the same error. Try to install the following configuration:

alexanderfroeber commented 2 months ago

Maybe someone is still interested in this issue...

I use pytorch-lightning == 1.5.10. This works with Python 3.10.x but not with 3.11.x.

The problem is that Python 3.11 changed the way how Enums are formatted. PyTorch-Lightning does the following: name = "setup" stage = TrainerFn.FITTING attr = f"has{name}_{stage}" has_run = getattr(obj, attr)

where TrainerFn is an Enum: class TrainerFn(LightningEnum): FITTING = "fit" VALIDATING = "validate" ...

In Python 3.10.x this results in '_has_setup_fit'. In Python >=3.11.0 this leads to '_has_setup_TrainerFn.FITTING'