PyGOD 使用 成功解决 Runtimeerror: No such operator torch_sparse::hetero_neighbor_sample 报错

2022-07-17 10:15:57 浏览数 (1)

问题描述:

按照教程一步步装好了 PyGOD,用到的命令如下所示(我的环境:PyTorch1.8.1 CUDA11.1):

代码语言:javascript复制
pip list
nvidia-smi
nvcc --version


pip install networkx
pip install scikit-learn==0.23.1


pip install torch-scatter==2.0.8 -f https://pytorch-geometric.com/whl/torch-1.8.1 cu111.html
pip install torch-cluster==1.5.9 -f https://pytorch-geometric.com/whl/torch-1.8.1 cu111.html
pip install torch-sparse==0.6.10 -f https://pytorch-geometric.com/whl/torch-1.8.1 cu111.html
pip install torch-spline-conv==1.2.1 -f https://pytorch-geometric.com/whl/torch-1.8.1 cu111.html
pip install torch-geometric -f https://pytorch-geometric.com/whl/torch-1.8.1 cu111.html

pip install --upgrade pygod -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

然而,运行代码测试图异常检测时,报错如下:

代码语言:javascript复制
from pygod.utils import load_data

data = load_data('inj_cora')
data.y = data.y.bool()

from pygod.models import DOMINANT

model = DOMINANT()

model.fit(data)
代码语言:javascript复制
......
Runtimeerror: No such operator torch_sparse::hetero_neighbor_sample
......

分析觉得是 torch_sparse 版本的问题,卸载后重新安装 0.6.12 版本解决了问题:

代码语言:javascript复制
pip uninstall torch-sparse
pip install torch-sparse==0.6.12 -f https://pytorch-geometric.com/whl/torch-1.8.1 cu111.html

References:

  • Github Issues Is PyTorch 1.7.1 and cuda 9.2 able to use neighbor_sample?#179
  • PyGOD 0.3.0 document Installation
  • PyGOD Github 页面
  • pytorch-geometric 安装教程
  • PyTorch与PyTorch Geometric的安装
  • pytorch-geometric.com whl匹配版本

0 人点赞