1Konny / Beta-VAE

Pytorch implementation of β-VAE
MIT License
526 stars 125 forks source link

Couldn't run well with TypeError #3

Closed Hanzy1996 closed 6 years ago

Hanzy1996 commented 6 years ago

/home/hanzy/PyPro/GANandVAE/Beta-VAE-master/model.py:150: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaimingnormal. init.kaiming_normal(m.weight) unorderable types: float() > NoneType() unorderable types: float() > NoneType() unorderable types: float() > NoneType() 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. => no checkpoint found at 'checkpoints/main/last' Traceback (most recent call last): File "/home/hanzy/PyPro/GANandVAE/Beta-VAE-master/main.py", line 69, in main(args) File "/home/hanzy/PyPro/GANandVAE/Beta-VAE-master/main.py", line 21, in main net = Solver(args) File "/home/hanzy/PyPro/GANandVAE/Beta-VAE-master/solver.py", line 140, in init self.data_loader = return_data(args) File "/home/hanzy/PyPro/GANandVAE/Beta-VAE-master/dataset.py", line 80, in return_data train_data = dset(**train_kwargs) File "/home/hanzy/PyPro/GANandVAE/Beta-VAE-master/dataset.py", line 18, in init super(CustomImageFolder, self).init(root, transform) File "/usr/local/lib/python3.5/dist-packages/torchvision/datasets/folder.py", line 99, in init classes, class_to_idx = find_classes(root) File "/usr/local/lib/python3.5/dist-packages/torchvision/datasets/folder.py", line 24, in find_classes classes = [d for d in os.listdir(dir) if os.path.isdir(os.path.join(dir, d))] TypeError: argument should be string, bytes or integer, not PosixPath

1Konny commented 6 years ago

please try inserting train_kwargs['root'] = str(train_kwargs['root']) before train_data = dset(**train_kwargs) in dataset.py and see if it solves the problem

1Konny commented 6 years ago

I replaced pathlib module with os and now I guess the above issue will not happen anymore. but if you still find any problem regarding this, please let me know. thanks.

Hanzy1996 commented 6 years ago

Thanks a lot. I am downloading the datasets and will retry later.MUCH appreciation for replying timely.

Hanzy1996 commented 6 years ago

It seems pathlib works better. I retry the code I downloaded yesterday on the server with python 2, and it is going well. But the code, in which you said you replaced pathlib module with os, I downloaded today has other bug. The bug still exists after I inserted train_kwargs['root'] = str(train_kwargs['root']) before train_data = dset(**train_kwargs) in dataset.py.

Traceback (most recent call last): File "/root/anaconda2/lib/python2.7/site-packages/visdom/init.py", line 446, in _send data=json.dumps(msg), File "/root/anaconda2/lib/python2.7/site-packages/requests/api.py", line 110, in post return request('post', url, data=data, json=json, kwargs) File "/root/anaconda2/lib/python2.7/site-packages/requests/api.py", line 56, in request return session.request(method=method, url=url, kwargs) File "/root/anaconda2/lib/python2.7/site-packages/requests/sessions.py", line 488, in request resp = self.send(prep, send_kwargs) File "/root/anaconda2/lib/python2.7/site-packages/requests/sessions.py", line 609, in send r = adapter.send(request, kwargs) File "/root/anaconda2/lib/python2.7/site-packages/requests/adapters.py", line 487, in send raise ConnectionError(e, request=request) ConnectionError: HTTPConnectionPool(host='localhost', port=8097): Max retries exceeded with url: /env/main (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f6578fb9c50>: Failed to establish a new connection: [Errno 111] Connection refused',)) No handlers could be found for logger "visdom" Traceback (most recent call last): File "main.py", line 69, in main(args) File "main.py", line 21, in main net = Solver(args) File "/data2/Hanzongyan/Beta-VAE/solver.py", line 126, in init os.makedirs(self.ckpt_dir, exist_ok=True) TypeError: makedirs() got an unexpected keyword argument 'exist_ok'

Maybe pathlib with inserting train_kwargs['root'] = str(train_kwargs['root']) is a better choice.

1Konny commented 6 years ago

are you using python2? I think your python version makes the problem. It seems that keyword argument 'exist_ok' is supported only in python3, but not in python2.

https://docs.python.org/2/library/os.html#os.makedirs https://docs.python.org/3/library/os.html#os.makedirs

Hanzy1996 commented 6 years ago

Thanks so much. It finally works and I get the results after 8 hours' trainning.

1Konny commented 6 years ago

Great! closing for now.