Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Jarye0612 opened this issue Sep 11, 2023 · 2 comments

Comments

@Jarye0612
Copy link

Jarye0612 commented Sep 11, 2023

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
Copy link

Hi @Jarye0612,

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

  • pytorch-lightning ==1.8.4
  • torch==2.0.0
  • torchvision==0.15.0

@alexanderfroeber
Copy link

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants