Colab Session Crashes on importing torch_geometric.data

1.2k views Asked by At

My colab session always crashes while trying to import torch_geometric.data module. For reference, the code I am writing is as follows:

import torch

def format_pytorch_version(version):

  return version.split('+')[0]

TORCH_version = torch.__version__

TORCH = format_pytorch_version(TORCH_version)

def format_cuda_version(version):

  return 'cu' + version.replace('.', '')

CUDA_version = torch.version.cuda

CUDA = format_cuda_version(CUDA_version)

!pip install torch-scatter     -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html

!pip install torch-sparse      -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html

!pip install torch-cluster     -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html

!pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html

!pip install torch-geometric

!pip install torch_geometric

from torch_geometric.data import Data 

When the execution reaches the lats line, the colab session crashes, I have tried switching to GPU and TPU as well, but nothing happens.

The logs shows this:

WARNING:root:kernel fc8fda2d-f1ce-4808-b78f-a18a55132346 restarted

1

There are 1 answers

0
Mivsher On BEST ANSWER

Got same issue this week. Downgrading PyTorch to the same version as pytorch_geometric seems to have solved the issue.

!pip install torch==1.10.0+cu111 torchvision==0.11.0+cu111 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html