thuml / Koopa

Code release for "Koopa: Learning Non-stationary Time Series Dynamics with Koopman Predictors" (NeurIPS 2023), https://arxiv.org/abs/2305.18803
MIT License
186 stars 23 forks source link

run problem #2

Closed zhybest closed 1 year ago

zhybest commented 1 year ago

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()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

when I run the run.py, Program encountered operational issues,so how to resolve it?

lichenyu20 commented 1 year ago

Could you please give more details about how you run the run.py? It is not recommended to run the run.py using python run.py directly. Instead, you could refer to bash script in scripts folder.

zhybest commented 1 year ago

when I use the bash scripts,terminal shows Args in experiment: Namespace(alpha=0.2, batch_size=32, c_out=321, checkpoints='./checkpoints/', data='custom', data_path='electricity.csv', dec_in=321, des='Exp', devices='0,1,2,3', do_predict=False, dropou t=0.05, dynamic_dim=64, embed='timeF', enc_in=321, features='M', freq='h', gpu=0, hidden_dim=512, hidden_layers=2, is_training=1, itr=1, label_len=48, learning_rate=0.001, loss='mse', lra dj='type1', model='Koopa', model_id='ECL_384_192', multistep=False, num_blocks=1, num_workers=10, patience=3, pred_len=192, root_path='./dataset/electricity/', seed=2023, seg_len=192, seq _len=384, target='OT', train_epochs=10, use_amp=False, use_gpu=False, use_multi_gpu=False) Use CPU train 17837 Traceback (most recent call last): File "", line 1, in File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 114, in _main prepare(preparation_data) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 225, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path Traceback (most recent call last): File "run.py", line 111, in run_name="mp_main__") File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 263, in run_path exp = Exp(args) # set experiments pkg_name=pkg_name, script_name=fname) File "E:\下载\Koopa-main\Koopa-main\exp\exp_main.py", line 23, in init File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 96, in _run_module_code super(Exp_Main, self).init(args) File "E:\下载\Koopa-main\Koopa-main\exp\exp_basic.py", line 10, in init mod_name, mod_spec, pkg_name, script_name) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code self.model = self._build_model().to(self.device) File "E:\下载\Koopa-main\Koopa-main\exp\exp_main.py", line 42, in _build_model exec(code, run_globals) File "E:\下载\Koopa-main\Koopa-main\run.py", line 111, in self.args.mask_spectrum = self._get_mask_spectrum() File "E:\下载\Koopa-main\Koopa-main\exp\exp_main.py", line 31, in _get_mask_spectrum exp = Exp(args) # set experiments File "E:\下载\Koopa-main\Koopa-main\exp\exp_main.py", line 23, in init for data in train_loader: File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 435, in iter super(Exp_Main, self).init(args) File "E:\下载\Koopa-main\Koopa-main\exp\exp_basic.py", line 10, in init self.model = self._build_model().to(self.device) File "E:\下载\Koopa-main\Koopa-main\exp\exp_main.py", line 42, in _build_model return self._get_iterator() File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 381, in _get_iterator self.args.mask_spectrum = self._get_mask_spectrum() File "E:\下载\Koopa-main\Koopa-main\exp\exp_main.py", line 31, in _get_mask_spectrum for data in train_loader: File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 435, in iter return _MultiProcessingDataLoaderIter(self) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 1034, in init return self._get_iterator() File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 381, in _get_iterator w.start() return _MultiProcessingDataLoaderIter(self) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 1034, in init File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start self._popen = self._Popen(self) w.start() File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 223, in _Popen self._popen = self._Popen(self) File "C:\Users\pc\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\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in init__ return Popen(process_obj) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 46, in init reduction.dump(process_obj, to_child) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\reduction.py", line 60, in dump prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data ForkingPickler(file, protocol).dump(obj) BrokenPipeError _check_not_importing_main() File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main : [Errno 32] Broken pipe 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()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

just like I used python run.py to run the run.py directle It shows same problem.

zhybest commented 1 year ago

I already solved this problem.Because my ps uses windows system, so I need to change the parameter num_workers=0.