TianBian95 / BiGCN

Source Codes: Rumor Detection on Social Media with Bi-Directional Graph Convolutional Networks--AAAI 2020
250 stars 73 forks source link

Getting freeze_support() error #11

Open jawad3692 opened 3 years ago

jawad3692 commented 3 years ago

Hello I'm getting the following error when I run the command 'python ./model/Twitter/BiGCN_Weibo.py 100' I've tested it on Colab, PyCharm, and by using WindowsShell

loading weibo label: 4664 2351 2313 reading Weibo tree tree no: 4659 loading train set train no: 3618 loading test set test no: 909 0%| | 0/227 [00:00<?, ?it/s]loading weibo label: 4664 2351 2313 reading Weibo tree tree no: 4659 loading train set 0%| | 0/227 [00:00<?, ?it/s]Traceback (most recent call last): File "", line 1, in File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 125, in _main prepare(preparation_data) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 236, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path main_content = runpy.run_path(main_path, File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 263, in run_path return _run_module_code(code, init_globals, run_name, File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 96, in _run_module_code _run_code(code, mod_globals, init_globals, File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "D:\BiGCN-master\BiGCN-master\model\Weibo\BiGCN_Weibo.py", line 216, in train_losses, val_losses, train_accs, val_accs, accs_0, acc1_0, pre1_0, rec1_0, F1_0, acc2_0, pre2_0, rec2_0, F2_0 = train_GCN(treeDic, File "D:\BiGCN-master\BiGCN-master\model\Weibo\BiGCN_Weibo.py", line 116, in train_GCN for Batch_data in tqdm_train_loader: File "D:\BiGCN-master\BiGCN-master\venv\lib\site-packages\tqdm\std.py", line 1097, in iter for obj in iterable: train no: 3626 loading test set test no: 901 File "D:\BiGCN-master\BiGCN-master\venv\lib\site-packages\torch\utils\data\dataloader.py", line 359, in iter return self._get_iterator() File "D:\BiGCN-master\BiGCN-master\venv\lib\site-packages\torch\utils\data\dataloader.py", line 305, in _get_iterator return _MultiProcessingDataLoaderIter(self) File "D:\BiGCN-master\BiGCN-master\venv\lib\site-packages\torch\utils\data\dataloader.py", line 918, in init w.start() File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 224, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 326, in _Popen return Popen(process_obj) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\popen_spawn_win32.py", line 45, in init prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 154, in get_preparation_data _check_not_importing_main() File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main raise RuntimeError(''' 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.

0%| | 0/227 [00:00<?, ?it/s]

zjc-code commented 2 years ago

this problem can be used remove Dataloader's parameter——number_works to solve. Windows' environment can not support multithreads.