有关github中snap-stanford/pretrain-gnns仓库的相关环境的配置

仓库链接:

GitHub - snap-stanford/pretrain-gnns: Strategies for Pre-training Graph Neural Networks

来自2020年的论文:

Strategies for Pre-Training Graph Neural Networks

https://arxiv.org/abs/1905.12265

这个仓库要求的配置有些古老……

pytorch                   1.0.1
torch-cluster             1.2.4              
torch-geometric           1.0.3
torch-scatter             1.1.2 
torch-sparse              0.2.4
torch-spline-conv         1.0.6
rdkit                     2019.03.1.0
tqdm                      4.31.1
tensorboardx              1.6

基本上找不到配套的环境……

所幸在仓库的issue里看到了一些希望(就是第一个参考链接),里面说从这里下载了一些环境(第二个参考链接)。同时,又从csdn上看到如何手动从网上下载相关库并安装(第三个参考链接)。就打算使用第二个链接中的相关库尝试一下,以下是相关步骤:

相关步骤

1. 创建新的虚拟环境

conda create -n graph python=3.7 

2. 下载pytorch及对应的组件(从官网上找的)

pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

3. 按照教程在第二个链接中一个个下载对应版本的库(其实直接运行下面的代码就行,最后下载torch-geometric):

torch-cluster:

pip install torch-cluster==1.5.9 -f https://pytorch-geometric.com/whl/torch-1.7.0+cu110.html

torch-scatter:

pip install torch-scatter==2.0.7 -f https://pytorch-geometric.com/whl/torch-1.7.0+cu110.html

torch-sparse:

pip install torch-sparse==0.6.9 -f https://pytorch-geometric.com/whl/torch-1.7.0+cu110.html

torch-spline-conv:

pip install torch-spline-conv==1.2.1 -f https://pytorch-geometric.com/whl/torch-1.7.0+cu110.html

torch-geometric(尝试里一下2.3.1和2.0.1,不兼容有bug,根据第四个参考链接换成了1.6.0):

 pip install torch-geometric==1.6.0

4. 最后运行程序,缺什么库就pip install什么就行啦~

pip install pandas
pip install networkx
pip install rdkit
pip install tensorboard
pip install tensorboardX
pip install ogb

5. 最后可能还会有一个bug:

ValueError: MessagePassing.propagate only supports torch.LongTensor of shape [2, num_messages] or torch_sparse.SparseTensor for argument edge_index.

经过如下修改就可以运行代码(因为这里是另一个项目的issue中提出的修改,行数和需要更换的位置都是不对的,不过要进行的更改是正确的,如果该处代码不需要修改就别修改):

运行代码

python pretrain_contextpred.py --output_model_file ‘此处填写输出模型的路径’

效果如下:

参考链接

Could you share the entire package list? Thanks! · Issue #45 · snap-stanford/pretrain-gnns · GitHub

https://pytorch-geometric.com/whl/torch-1.7.0+cu110.html

基于Pytorch中安装torch_geometric简单详细完整版_import torch_geometric-CSDN博客

The ‘data’ object was created by an older version of PyG. If this error occurred while loading ..._anshiquanshu的博客-CSDN博客

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

m0_62488776

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值