Error when running example: 'list' object has no attribute 'to'
ndahlquist opened this issue · comments
When attempting to run the example from the readme. Saw the same error when attempting to run the example at https://github.com/akanimax/pro_gan_pytorch-examples.
Possibly an incompatibility with Pytorch v1.0.0?
Files already downloaded and verified
<class 'torchvision.datasets.cifar.CIFAR10'>
Starting the training process ...
Currently working on Depth: 0
Current resolution: 4 x 4
Epoch: 1
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-ca3c71ce5bd6> in <module>()
25 epochs=num_epochs,
26 fade_in_percentage=fade_ins,
---> 27 batch_sizes=batch_sizes
28 )
29 # ======================================================================
/usr/local/lib/python3.5/dist-packages/pro_gan_pytorch/PRO_GAN.py in train(self, dataset, epochs, batch_sizes, fade_in_percentage, num_samples, start_depth, num_workers, feedback_factor, log_dir, sample_dir, save_dir, checkpoint_factor)
605
606 # extract current batch of data for training
--> 607 images = batch.to(self.device)
608
609 gan_input = th.randn(images.shape[0], self.latent_size).to(self.device)
AttributeError: 'list' object has no attribute 'to'
Hi @ndahlquist,
Thank you for your issue. There is a slight problem with the CIFAR-10 code that I have displayed on the README.md. It should be for a ConditionalProGAN
and not an unconditional ProGAN. It's a new feature that is why I wanted to display it. Basically, for the conditional discrimination, the package uses the projection mechanism from the paper -> "cGANs with Projection Discriminator". You can definitely go ahead and try this feature.
Please try running the code displayed on the README.md at or after 2711c3f2923dad02da4fc90449342a2d57d848d3
There is no problem with the v1.0.0 of PyTorch. I have tested with old as well as new versions.
Also take a look at the examples at the examples repository that you mentioned.
Hope this helps.
Best regards,
@akanimax
Confirmed that this works now; thank you for the quick fix!! Happy holidays 🎄
You too.
Cheers 🍻!