snap-stanford / ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
https://ogb.stanford.edu
MIT License
1.93k stars 397 forks source link

_pickle.PicklingError: Can't pickle typing.Union[torch.Tensor, NoneType]: it's not the same object as typing.Union #152

Closed CnBDM-Su closed 3 years ago

CnBDM-Su commented 3 years ago

my environment: python 3.6 cuda 10.1 torch 1.6.0
torch-geometric 1.6.3
torch-scatter 2.0.6
torch-sparse 0.6.8 pytorch-lightning 1.2.7

when I run gnn baseline, the log is WARNING:root:The OGB package is out of date. Your version is 1.3.0, while the latest version is 1.3.1. Namespace(batch_size=1024, device='0', dropout=0.5, epochs=100, evaluate=False, hidden_channels=1024, model='graphsage', parallel=True, sizes=[25, 15]) Global seed set to 42

Params 4884633

/home/user/miniconda/envs/py36/lib/python3.6/site-packages/pytorch_lightning/utilities/distributed.py:52: UserWarning: You requested multiple GPUs but did not specify a backend, e.g. Trainer(accelerator="dp"|"ddp"|"ddp2"). Setting accelerator="ddp_spawn" for you. warnings.warn(*args, kwargs) GPU available: True, used: True TPU available: False, using: 0 TPU cores Converting adjacency matrix... Done! [682.63s] Reading dataset... Done! [47.16s] LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0,1,2,3,4,5,6,7] Traceback (most recent call last): File "gnn.py", line 238, in trainer.fit(model, datamodule=datamodule) File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 499, in fit self.dispatch() File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py", line 546, in dispatch self.accelerator.start_training(self) File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/pytorch_lightning/accelerators/accelerator.py", line 73, in start_training self.training_type_plugin.start_training(trainer) File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/pytorch_lightning/plugins/training_type/ddp_spawn.py", line 108, in start_training mp.spawn(self.new_process, self.mp_spawn_kwargs) File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 200, in spawn return start_processes(fn, args, nprocs, join, daemon, start_method='spawn') File "/home/user/miniconda/envs/py36/lib/python3.6/site-packages/torch/multiprocessing/spawn.py", line 149, in start_processes process.start() File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/process.py", line 105, in start self._popen = self._Popen(self) File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/context.py", line 284, in _Popen return Popen(process_obj) File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/popen_spawn_posix.py", line 32, in init super().init(process_obj) File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/popen_fork.py", line 19, in init self._launch(process_obj) File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/popen_spawn_posix.py", line 47, in _launch reduction.dump(process_obj, fp) File "/home/user/miniconda/envs/py36/lib/python3.6/multiprocessing/reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) _pickle.PicklingError: Can't pickle typing.Union[torch.Tensor, NoneType]: it's not the same object as typing.Union

Do you know why? Thanks

rusty1s commented 3 years ago

Can you test the code with the recommended package versions, in particular, torch-geometric>1.6.3?

CnBDM-Su commented 3 years ago

Can you test the code with the recommended package versions, in particular, torch-geometric>1.6.3?

I have updated the torch-geometric to 1.7.0, but it doesn't work

rusty1s commented 3 years ago

I see, there was a similar issue in PyG that suggest using Pyhon>=3.7, see here. Sorry for the inconvenience!

CnBDM-Su commented 3 years ago

I see, there was a similar issue in PyG that suggest using Pyhon>=3.7, see here. Sorry for the inconvenience!

It works, Thanks.