Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command with RuntimeError #44

Open
yanyu2015 opened this issue Aug 21, 2023 · 2 comments
Open

command with RuntimeError #44

yanyu2015 opened this issue Aug 21, 2023 · 2 comments

Comments

@yanyu2015
Copy link

yanyu2015 commented Aug 21, 2023

When running the following command, an error occurs:

python seal_link_pred.py --dataset ogbl-citation2 --num_hops 1 --use_feature --use_edge_weight --eval_steps 1 --epochs  3 --dynamic_train --dynamic_val --dynamic_test --train_percent 2 --val_percent 1 --test_percent 1

error :

 python seal_link_pred.py --dataset ogbl-citation2 --num_hops 1 --use_feature --use_edge_weight --eval_steps 1 --epochs  3 --dynamic_train --dynamic_val --dynamic_test --train_percent 2 --val_percent 1 --test_percent 1
Results will be saved in results/ogbl-citation2_20230821205719
Command line input: python seal_link_pred.py --dataset ogbl-citation2 --num_hops 1 --use_feature --use_edge_weight --eval_steps 1 --epochs 3 --dynamic_train --dynamic_val --dynamic_test --train_percent 2 --val_percent 1 --test_percent 1
 is saved.
Total number of parameters is 260802
SortPooling k is set to 115
  0%|                                       | 0/37985 [00:00<?, ?it/s]
Results will be saved in results/ogbl-citation2_20230821205742
Command line input: python E:\Notes\PyNote\GNN\seal\SEAL_OGB-main\seal_link_pred.py --dataset ogbl-citation2 --num_hops 1 --use_feature --use_edge_weight --eval_steps 1 --epochs 3 --dynamic_train --dynamic_val --dynamic_test --train_percent 2 --val_percent 1 --test_percent 1
 is saved.
Total number of parameters is 260802
SortPooling k is set to 115
  0%|                                       | 0/37985 [00:00<?, ?it/s]

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\spawn.py", line 120, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\spawn.py", line 129, in _main
    prepare(preparation_data)
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\spawn.py", line 240, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "E:\Notes\PyNote\GNN\seal\SEAL_OGB-main\seal_link_pred.py", line 700, in <module>
    loss = train()
           ^^^^^^^
  File "E:\Notes\PyNote\GNN\seal\SEAL_OGB-main\seal_link_pred.py", line 164, in train
    for data in pbar:
  File "C:\Users\admin\anaconda3\Lib\site-packages\tqdm\std.py", line 1178, in __iter__
    for obj in iterable:
  File "C:\Users\admin\anaconda3\Lib\site-packages\torch\utils\data\dataloader.py", line 441, in __iter__
    return self._get_iterator()
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\anaconda3\Lib\site-packages\torch\utils\data\dataloader.py", line 388, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\anaconda3\Lib\site-packages\torch\utils\data\dataloader.py", line 1042, in __init__
    w.start()
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\context.py", line 336, in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\spawn.py", line 158, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\admin\anaconda3\Lib\multiprocessing\spawn.py", line 138, 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.

Where par refers pbar = tqdm(train_loader, ncols=70).
The command corresponding to the ogbl-ppa dataset also encounters the same error. Only ogbl-collab is working fine.

-- updaye --
It seems the parameters --dynamic_train --dynamic_val --dynamic_test cause this problem.

@muhanzhang
Copy link
Collaborator

Hi, did you use windows OS? I haven't tested it on windows. I suggest to run the code on Linux, as windows has different multiprocessing mechanisms that might need some modification to the code. See https://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing.

@yanyu2015
Copy link
Author

Yes,I use windows OS.
I haven't fully understood your code yet, so modifying it as per the link you provided is currently beyond my capabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants