facebookresearch / pytorch_GAN_zoo

A mix of GAN implementations including progressive growing
BSD 3-Clause "New" or "Revised" License
1.61k stars 270 forks source link

AttributeError: 'module' object has no attribute 'functional' #64

Open VictorZuanazzi opened 5 years ago

VictorZuanazzi commented 5 years ago

Hello,

I am trying to get started with GAN zoo, but I cannot the steps of the instructions don't seem to work for me.

Which python version does it use? Python 2 or 3?

When I run the following line (as per instructions), I get several errors including a 'module' object has no attribute 'functional', which seems to point out to torch versioning issue.

I did not change anything in the code yet.

`ubuntu@ip-172-31-32-19:~/GAN-ZOO$ python train.py PGAN -c config_celeba_cropped.json --restart -n celeba_cropped 2.7.15 |Anaconda, Inc.| (default, May 1 2018, 23:32:55) [GCC 7.2.0] True WARNING:root:Setting up a new session... Exception in user code:

Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/visdom/init.py", line 548, in _send data=json.dumps(msg), File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/requests/sessions.py", line 581, in post return self.request('POST', url, data=data, json=json, kwargs) File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) ConnectionError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fbc3e858b50>: Failed to establish a new connection: [Errno 111] Connection refused',)) WARNING:visdom:Visdom python client failed to establish socket to get messages from the server. This feature is optional and can be disabled by initializing Visdom with use_incoming_socket=False, which will prevent waiting for this request to timeout. Running PGAN ERROR:visdom:[Errno 111] Connection refused ('size', 10) 125854 images found 125854 images detected ('size', (4, 4)) 125854 images found Traceback (most recent call last): File "train.py", line 138, in GANTrainer.train() File "/home/ubuntu/pycharm/arno-victor/GAN-ZOO/models/trainer/progressive_gan_trainer.py", line 239, in train maxIter=self.modelConfig.maxIterAtScale[scale]) File "/home/ubuntu/pycharm/arno-victor/GAN-ZOO/models/trainer/gan_trainer.py", line 469, in trainOnEpoch for item, data in enumerate(dbLoader, 0): File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 286, in next return self._process_next_batch(batch) File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 307, in _process_next_batch raise batch.exc_type(batch.exc_msg) AttributeError: Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/ubuntu/pycharm/arno-victor/GAN-ZOO/models/datasets/attrib_dataset.py", line 215, in getitem img = self.transform(img) File "/home/ubuntu/anaconda3/lib/python2.7/site-packages/torchvision/transforms.py", line 29, in call img = t(img) File "/home/ubuntu/pycharm/arno-victor/GAN-ZOO/models/utils/image_transform.py", line 71, in call return Transforms.functional.to_tensor(img) AttributeError: 'module' object has no attribute 'functional' `

Molugan commented 5 years ago

That's weird. What version of pytorch do you use ?

VictorZuanazzi commented 5 years ago

I am currently using Pytorch 1.1. Other implementations are working allright, but I really could not use the GAN-ZOO

Molugan commented 5 years ago

What is your version of torchvision then ?

To check that there isn't an issue over a variable name, can you try to replace the line https://github.com/facebookresearch/pytorch_GAN_zoo/blob/d87a196fc382d6904180c6d9e241458bcb37ce22/models/utils/image_transform.py#L71 by return torchvision.transforms.functional.to_tensor(img) ?