pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.11k stars 3.63k forks source link

can not import torch_geometric.loader in PyG2.0.0 #3127

Closed yingtongxiong closed 3 years ago

yingtongxiong commented 3 years ago

❓ Questions & Help

when I try to use NeighborLoader, there was an error. I do not know how to solve it? But when I import NeighborSampler, there is no import error. How can I solve it? Anyone can help me? 捕获

yingtongxiong commented 3 years ago

Sorry,I forget to flush my environment in VS code. I am very appreciate for your amazing framework.

rusty1s commented 3 years ago

Super :)

yingtongxiong commented 3 years ago

Thank you very much. I have an another problem. When I read the document, I can not understand the function NeighborLoader's parameter named num_neighbors,especially iteration, dose the "iteration" means the tradional "iteration" in DNN? I can not classify them.  When I use NeighborSample, this parameter means the number of neighbors to be sampled in each layer. However, when it turns to NeighborLoader, it becomes the number of neighbors to be sampled in each iteration. Does its mean the same as NeighborSample? when we train a model, the iteration would be very large such as 100,200,500 and so on. So would you please explain the "iteration" in NeighborLoader?

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年9月14日(星期二) 下午2:43 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

Super :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 3 years ago

The num_neighbors input argument is equivalent to the sizes argument of NeighborSampler. Here, iteration means the same as layer. For example

num_neighbors = [20, 10]

means that we first sample 20 neighbors for each node in the mini-batch, and then sample 10 neighbors for each already sampled node.

yingtongxiong commented 3 years ago

ok. Thank you very much

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年9月14日(星期二) 下午2:58 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

The num_neighbors input argument is equivalent to the sizes argument of NeighborSampler. Here, iteration means the same as layer. For example num_neighbors = [20, 10]

means that we first sample 20 neighbors for each node in the mini-batch, and then sample 10 neighbors for each already sampled node.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

yingtongxiong commented 3 years ago

I'm so sorry for bothering you again. I can not understand the parameter "replace" and "directed" in NeighborLoader.  I'm afraid I have misunderstood them, so would you please explain them to me? Thank you very much.

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年9月14日(星期二) 下午2:58 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

The num_neighbors input argument is equivalent to the sizes argument of NeighborSampler. Here, iteration means the same as layer. For example num_neighbors = [20, 10]

means that we first sample 20 neighbors for each node in the mini-batch, and then sample 10 neighbors for each already sampled node.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 3 years ago

replace dictates whether we want to sample neighbors with our without replacement. The directed argument denotes how the returned subgraph looks like. In case directed=True, the returned subgraph is directed, holding only the edges that are necessary for message passing pointing to the original mini-batch nodes. In contrast, using directed=False, will return the complete subgraph between sampled nodes, which allows you to apply deeper GNNs (similar to the idea of the ShaDow sampler).

yingtongxiong commented 3 years ago

Thank you very much. I've got it. I want to know the sampler you implemented in PyG such as clusterLoader, NeighborLoader can apply to any GNN network? I am trying to figure out how to do mini-batch training in large graph through PyG.

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年9月15日(星期三) 晚上9:00 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

replace dictates whether we want to sample neighbors with our without replacement. The directed argument denotes how the returned subgraph looks like. In case directed=True, the returned subgraph is directed, holding only the edges that are necessary for message passing pointing to the original mini-batch nodes. In contrast, using directed=False, will return the complete subgraph between sampled nodes, which allows you to apply deeper GNNs (similar to the idea of the ShaDow sampler).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 3 years ago

We currently provide two loaders for learning on large-scale heterogeneous graphs: NeighborLoader and HGTLoader. The other ones, such as, ClusterLoader or GraphSAINTLoader currently only support homogeneous graphs, but we aim to support heterogeneous graphs for those as well :)

yingtongxiong commented 3 years ago

Thank you very much. I want to know whether sampler can be applied to different GNN network or not. For example, can NeighborLoader combine with GCN? That is to say, I want to train GCN in mini-batch and want to apply sampler such as NeighborLoader or ClusterLoader, it can be implemented?

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年9月16日(星期四) 下午2:33 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

We currently provide two loaders for learning on large-scale heterogeneous graphs: NeighborLoader and HGTLoader. The other ones, such as, ClusterLoader or GraphSAINTLoader currently only support homogeneous graphs, but we aim to support heterogeneous graphs for those as well :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 3 years ago

Yes, every loader can be used for any GNN. They mostly differ in the way sampling is performed, but their general interface is similar.

yingtongxiong commented 3 years ago

okay, I know, Thank you very much

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年9月16日(星期四) 下午3:25 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

Yes, every loader can be used for any GNN. They mostly differ in the way sampling is performed, but their general interface is similar.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

yingtongxiong commented 2 years ago

I'm sorry for turning you again. I want to know how to install PyG by compiling way? And I also want to know PyG is implemented by python? any else language? Looking forward for your reply.

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年9月16日(星期四) 下午3:25 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

Yes, every loader can be used for any GNN. They mostly differ in the way sampling is performed, but their general interface is similar.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 2 years ago

PyG is pure Python, so installation is straightforward via pip install .... Our internal C++/CUDA code is out-sourced to the torch-scatter and torch-sparse packages.

yingtongxiong commented 2 years ago

ok,Thank you very much

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年10月14日(星期四) 下午4:48 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

PyG is pure Python, so installation is straightforward via pip install .... Our internal C++/CUDA code is out-sourced to the torch-scatter and torch-sparse packages.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

yingtongxiong commented 2 years ago

Excuse me, I have met some problems during installing PyG recently. I want to know the version relationship between PyG2.0 and torch_sparse, torch_scatter, torch_cluster. I do not understand your document in github somewhat. Thank you very much.

------------------ 原始邮件 ------------------ 发件人: "974106207" @.>; 发送时间: 2021年10月14日(星期四) 下午4:50 @.>;

主题: 回复: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

ok,Thank you very much

------------------ 原始邮件 ------------------ 发件人: "pyg-team/pytorch_geometric" @.>; 发送时间: 2021年10月14日(星期四) 下午4:48 @.>; @.**@.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

PyG is pure Python, so installation is straightforward via pip install .... Our internal C++/CUDA code is out-sourced to the torch-scatter and torch-sparse packages.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 2 years ago

Let me know how you tried to install and what's the error you encounter :)

yingtongxiong commented 2 years ago

Actually, I try to install torch_sparse through source build. But I met the gcc version problem. So I want to know whether the lower version is implemented using c++11 so that I can use a lower version gcc.(build gcc for me is so difficult)

------------------ 原始邮件 ------------------ 发件人: "Matthias @.>; 发送时间: 2021年11月10日(星期三) 下午4:30 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

Let me know how you tried to install and what's the error you encounter :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 2 years ago

Why do you want to install from source? I think PyTorch >= 1.8.0 requires building with c++14.

yingtongxiong commented 2 years ago

I'd like to read its source code so that I can know it how to work. I have solved gcc problem. Anyway, Thank you very much and hope you have a nice life.

------------------ 原始邮件 ------------------ 发件人: "Matthias @.>; 发送时间: 2021年11月10日(星期三) 晚上9:52 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

Why do you want to install from source? I think PyTorch >= 1.8.0 requires building with c++14.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rusty1s commented 2 years ago

Source codes can be found in https://github.com/rusty1s/pytorch_scatter and https://github.com/rusty1s/pytorch_sparse

yingtongxiong commented 2 years ago

ok, thank you very much.

------------------ 原始邮件 ------------------ 发件人: "Matthias @.>; 发送时间: 2021年11月10日(星期三) 晚上9:59 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [pyg-team/pytorch_geometric] can not import torch_geometric.loader in PyG2.0.0 (#3127)

Source codes can be found in https://github.com/rusty1s/pytorch_scatter and https://github.com/rusty1s/pytorch_sparse

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.