taesungp / contrastive-unpaired-translation

Contrastive unpaired image-to-image translation, faster and lighter training than cyclegan (ECCV 2020, in PyTorch)
https://taesung.me/ContrastiveUnpairedTranslation/
Other
2.22k stars 416 forks source link

Can this code run on Windows #52

Open wangjt1216 opened 4 years ago

dr-benway commented 4 years ago

code runs perfectly (on W10)

pureYioYi commented 3 years ago

code runs perfectly (on W10)

Hello, dr

I test this code in ubuntu and it works pretty well, but when I try it on win10 with the same python env, i meet some problem:

`Could not connect to Visdom server. Trying to start a server.... Command: D:\SDKs\Python\Anaconda\envs\cut\python.exe -m visdom.server -p 8097 &>/dev/null & create web directory ./checkpoints\singleimage_monet_etretat\web... Traceback (most recent call last): File "train.py", line 31, in for i, data in enumerate(dataset): # inner loop within one epoch File "D:\Code\Python\CUT\data__init.py", line 95, in iter for i, data in enumerate(self.dataloader): File "D:\SDKs\Python\Anaconda\envs\cut\lib\site-packages\torch\utils\data\dataloader.py", line 278, in iter__ return _MultiProcessingDataLoaderIter(self) File "D:\SDKs\Python\Anaconda\envs\cut\lib\site-packages\torch\utils\data\dataloader.py", line 682, in init w.start() File "D:\SDKs\Python\Anaconda\envs\cut\lib\multiprocessing\process.py", line 112, in start self._popen = self._Popen(self) File "D:\SDKs\Python\Anaconda\envs\cut\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "D:\SDKs\Python\Anaconda\envs\cut\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "D:\SDKs\Python\Anaconda\envs\cut\lib\multiprocessing\popen_spawn_win32.py", line 89, in init reduction.dump(process_obj, to_child) File "D:\SDKs\Python\Anaconda\envs\cut\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'pytorch_wrap..result'

(cut) D:\Code\Python\CUT>Traceback (most recent call last): File "", line 1, in File "D:\SDKs\Python\Anaconda\envs\cut\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "D:\SDKs\Python\Anaconda\envs\cut\lib\multiprocessing\spawn.py", line 115, in _main self = reduction.pickle.load(from_parent) EOFError: Ran out of input`

Python envs: Python = 3.6.12 pytorch=1.4.0 torchvision==0.5.0 visdom==0.1.8 packaging GPUtil==1.4.0

it seems to visdom does not work well. Could you please tell me how to solve this problem? Thanks!

Steedalion commented 3 years ago

I had the same problem. It's related to pytorch windows thread issues. To solve go to data/__init__.py and change the number of worker threads (line 79).


            self.dataset,
            batch_size=opt.batch_size,
            shuffle=not opt.serial_batches,
            # num_workers=int(opt.num_threads), This is the problem, change it to 0
            num_workers = int(0), 
            drop_last=True if opt.isTrain else False,`
Steedalion commented 3 years ago

Duplicate of #37

pureYioYi commented 3 years ago

I had the same problem. It's related to pytorch windows thread issues. To solve go to data/__init__.py and change the number of worker threads (line 79).

            self.dataset,
            batch_size=opt.batch_size,
            shuffle=not opt.serial_batches,
            # num_workers=int(opt.num_threads), This is the problem, change it to 0
            num_workers = int(0), 
            drop_last=True if opt.isTrain else False,`

Thanks! Solved!