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 when with flag --use_vae #34

Closed
timhouben opened this issue Apr 24, 2019 · 4 comments
Closed

AttributeError when with flag --use_vae #34

timhouben opened this issue Apr 24, 2019 · 4 comments

Comments

@timhouben
Copy link

Cloned SPADE with cityscapes dataset on my google cloud instance. Inference is working, also training is possible. But when enabling the --use_vae flag i get the following error.

command:
python train.py --name cityscapes_selftrained --dataset_mode cityscapes --dataroot /home/user/SPADE/SPADE/datasets/cityscapes --use_vae

output:

Network [SPADEGenerator] was created. Total number of parameters: 101.1 million. To see the architecture, do print(network).
Network [MultiscaleDiscriminator] was created. Total number of parameters: 1.4 million. To see the architecture, do print(network).
Network [ConvEncoder] was created. Total number of parameters: 10.5 million. To see the architecture, do print(network).
create web directory ./checkpoints/cityscapes_selftrained/web...
/opt/anaconda3/lib/python3.7/site-packages/torch/nn/functional.py:2423: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode))
Traceback (most recent call last):
  File "train.py", line 40, in <module>
    trainer.run_generator_one_step(data_i)
  File "/home/user/SPADE/SPADE/trainers/pix2pix_trainer.py", line 35, in run_generator_one_step
    g_losses, generated = self.pix2pix_model(data, mode='generator')
  File "/opt/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 141, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/opt/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/user/SPADE/SPADE/models/pix2pix_model.py", line 46, in forward
    input_semantics, real_image)
  File "/home/user/SPADE/SPADE/models/pix2pix_model.py", line 137, in compute_generator_loss
    input_semantics, real_image, compute_kld_loss=self.opt.use_vae)
  File "/home/user/SPADE/SPADE/models/pix2pix_model.py", line 192, in generate_fake
    z, mu, logvar = self.encode_z(real_image)
  File "/home/user/SPADE/SPADE/models/pix2pix_model.py", line 184, in encode_z
    mu, logvar = self.netE(real_image)
  File "/opt/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/user/SPADE/SPADE/models/networks/encoder.py", line 46, in forward
    if self.opt.crop_size >= 256:
  File "/opt/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 535, in __getattr__
    type(self).__name__, name))
AttributeError: 'ConvEncoder' object has no attribute 'opt'

Does anyone know howto fix this?

@dickkky
Copy link

dickkky commented Apr 26, 2019

same problem.

@taesungp
Copy link
Contributor

It was a bug on my side in the initial release of the code (Sorry about that). This should have been fixed in the later commit. Could you pull the latest version and try again?

@dickkky
Copy link

dickkky commented Apr 28, 2019

yes,I got it. thanks a lot.

@timhouben
Copy link
Author

Indeed, one simple git pull solved it. Thanks!

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