pclucas14 / pixel-cnn-pp

Pytorch Implementation of OpenAI's PixelCNN++
Other
345 stars 76 forks source link

How do I use this code? #10

Closed XiaoHao-Chen closed 5 years ago

XiaoHao-Chen commented 5 years ago

How do you use this code, please? Including the reading of datasets, the configuration of the environment, hardware requirements, and so on? Thank you for your help.

XiaoHao-Chen commented 5 years ago

What are the formatting requirements for CIFAR and mnist datasets

XiaoHao-Chen commented 5 years ago

Thanks you code firstly. I want to know how much GPU you need to train, what version of Python and Pytorch. When I run main.py, there is a hint of: KeyError: ' RUNS\\PCNN_LR '. But I don't know anything about the mistake. Could you give me some advice?Thank you

pclucas14 commented 5 years ago

Hi,

you will need pytorch 0.3 or 0.4 (I think it was originally coded on 0.3, but should be 0.4 compatible). The dataset formatting requirements are already included in the repository. As for hardware, to train the full model you will about 4 GPUs for a week. You can also train a smaller version in less than a day on a single GPU and get competitive performance.

For the last error, could you provide more information ? a full stack trace would help.

-Lucas

XiaoHao-Chen commented 5 years ago

嗨,

你需要0.3或0.4的pytorch(我认为它最初编码为0.3,但应该是0.4兼容)。数据集格式化要求已包含在存储库中。至于硬件,要训练完整的模型,您将在一周内获得大约4个GPU。您还可以在一个GPU上在不到一天的时间内训练较小的版本并获得有竞争力的性能。

对于最后一个错误,您能提供更多信息吗?完整的堆栈跟踪会有所帮助。

-Lucas

Thank you for your reply. I have solved the question I raised. Another question,:I see the trained model you released, how do I use these models? How to use the trained model directly to complete the main work of PIXELCNN?

XiaoHao-Chen commented 5 years ago

I really Windows 7 running your code under the system. After downloading the good data and after, the following error occurred: Traceback (most recent call last): File "D:/pixel-cnn-pp-master/main.py", line 119, in for batchidx, (input,) in enumerate(train_loader): File "D:\Professional\anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 501, in iter return _DataLoaderIter(self) File "D:\Professional\anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 289, in init w.start() File "D:\Professional\anaconda\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "D:\Professional\anaconda\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "D:\Professional\anaconda\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "D:\Professional\anaconda\lib\multiprocessing\popen_spawn_win32.py", line 65, in init reduction.dump(process_obj, to_child) File "D:\Professional\anaconda\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) _pickle.PicklingError: Can't pickle <function at 0x00000000077A9EA0>: attribute lookup on main failed AND Traceback (most recent call last): File "", line 1, in File "D:\Professional\anaconda\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "D:\Professional\anaconda\lib\multiprocessing\spawn.py", line 114, in _main prepare(preparation_data) File "D:\Professional\anaconda\lib\multiprocessing\spawn.py", line 225, in prepare _fixup_main_from_path(data['init_main_from_path']) File "D:\Professional\anaconda\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path run_name="mp_main__") File "D:\Professional\anaconda\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "D:\Professional\anaconda\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "D:\Professional\anaconda\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\pixel-cnn-pp-master\main.py", line 119, in for batchidx, (input,) in enumerate(train_loader): File "D:\Professional\anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 501, in iter__ return _DataLoaderIter(self) File "D:\Professional\anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 289, in init w.start() File "D:\Professional\anaconda\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "D:\Professional\anaconda\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "D:\Professional\anaconda\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "D:\Professional\anaconda\lib\multiprocessing\popen_spawn_win32.py", line 33, in init prep_data = spawn.get_preparation_data(process_obj._name) File "D:\Professional\anaconda\lib\multiprocessing\spawn.py", line 143, in get_preparation_data _check_not_importing_main() File "D:\Professional\anaconda\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main is not going to be frozen to produce an executable.''') RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()

I found some solutions on the internet, but it didn't work. So can you give me some advice?Thank you!

XiaoHao-Chen commented 5 years ago

And after the above error occurred, the program did not stop, but continued to run, but nothing came of it. Why is that?

pclucas14 commented 5 years ago

Sometimes the pytorch dataloaders throws errors and keeps running. Usually this is fine. Try playing with the num_workers flag, maybe it will help.

Sorry I don't have a better answer for you

XiaoHao-Chen commented 5 years ago

Thank you very much for your help!