vincentherrmann / pytorch-wavenet

An implementation of WaveNet with fast generation
MIT License
968 stars 225 forks source link

TypeError: cannot serialize '_io.BufferedReader' object #25

Open TSMLuL opened 5 years ago

TSMLuL commented 5 years ago

Hi!

I am currently trying to execute the WaveNet_demo.ipynb file which you kindly provided for download.

When executing the trainer.train(batch_size=16, epochs=10) part, I unfortunately run into an error message like this TypeError: cannot serialize '_io.BufferedReader' object (full error message below).

Do you know why this could be or how to fix it? I did not find any related threads on the internet unfortuately...

I am on a windows 10 machine, python 3.7.3, torch version 1.0.1.

Cheers and thanks a lot

Full error message:

Traceback (most recent call last): File "C:/Users/Benedict/PycharmProjects/pytorch-wavenet/SCRIPTtest.py", line 80, in <module> trainer.train(batch_size=16, epochs=1) File "C:\Users\Benedict\PycharmProjects\pytorch-wavenet\wavenet_training.py", line 64, in train for (x, target) in iter(self.dataloader): File "C:\Users\Benedict\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 819, in __iter__ return _DataLoaderIter(self) File "C:\Users\Benedict\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 560, in __init__ w.start() File "C:\Users\Benedict\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start self._popen = self._Popen(self) File "C:\Users\Benedict\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\Benedict\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\Benedict\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__ reduction.dump(process_obj, to_child) File "C:\Users\Benedict\AppData\Local\Programs\Python\Python37\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) TypeError: cannot serialize '_io.BufferedReader' object

thinking-tower commented 5 years ago

@TSMLuL I'm also working through this repo!

I've found the issue (but don't know why it's an issue). In WavenetTrainer.train(), do this: `dataloader = torch.utils.data.DataLoader(self.dataset, batch_size=32, shuffle=True,

num_workers=4,

                                     pin_memory=False)`

I don't know how to do new lines in code but anyways main point is comment out the num_workers line. (Sauce)