No module named 'points.datasets' for pytorch geometric

shangguan91: <p>Hey guys, i tried to implement Pytorch geometric for the benchmark data of point. However, i receive the<br>
No module named ‘points.datasets’ . i tried install but it shows there is not match, help pls</p>
<p>import argparse</p>
<p>import torch</p>
<p>import torch.nn.functional as F</p>
<p>from torch.nn import Linear as Lin</p>
<p>from torch_geometric.nn import XConv, fps, global_mean_pool</p>
<p>from points.datasets import get_dataset</p>
<p>from points.train_eval import run</p>
<p>parser = argparse.ArgumentParser()</p>
<p>parser.add_argument(’–epochs’, type=int, default=200)</p>
<p>parser.add_argument(’–batch_size’, type=int, default=32)</p>
<p>parser.add_argument(’–lr’, type=float, default=0.001)</p>
<p>parser.add_argument(’–lr_decay_factor’, type=float, default=0.5)</p>
<p>parser.add_argument(’–lr_decay_step_size’, type=int, default=50)</p>
<p>parser.add_argument(’–weight_decay’, type=float, default=0)</p>
<p>args = parser.parse_args()</p>
<p>class Net(torch.nn.Module):</p>
<pre><code>def __init__(self, num_classes):

    super(Net, self).__init__()

    self.conv1 = XConv(0, 48, dim=3, kernel_size=8, hidden_channels=32)

    self.conv2 = XConv(

        48, 96, dim=3, kernel_size=12, hidden_channels=64, dilation=2)

    self.conv3 = XConv(

        96, 192, dim=3, kernel_size=16, hidden_channels=128, dilation=2)

    self.conv4 = XConv(

        192, 384, dim=3, kernel_size=16, hidden_channels=256, dilation=2)

    self.lin1 = Lin(384, 256)

    self.lin2 = Lin(256, 128)

    self.lin3 = Lin(128, num_classes)

def forward(self, pos, batch):

    x = F.relu(self.conv1(None, pos, batch))

    idx = fps(pos, batch, ratio=0.375)

    x, pos, batch = x[idx], pos[idx], batch[idx]

    x = F.relu(self.conv2(x, pos, batch))

    idx = fps(pos, batch, ratio=0.334)

    x, pos, batch = x[idx], pos[idx], batch[idx]

    x = F.relu(self.conv3(x, pos, batch))

    x = F.relu(self.conv4(x, pos, batch))

    x = global_mean_pool(x, batch)

    x = F.relu(self.lin1(x))

    x = F.relu(self.lin2(x))

    x = F.dropout(x, p=0.5, training=self.training)

    x = self.lin3(x)

    return F.log_softmax(x, dim=-1)
</code></pre>
<p>train_dataset, test_dataset = get_dataset(num_points=1024)</p>
<p>model = Net(train_dataset.num_classes)</p>
<p>run(train_dataset, test_dataset, model, args.epochs, args.batch_size, args.lr,</p>
<pre><code>args.lr_decay_factor, args.lr_decay_step_size, args.weight_decay)</code></pre>

bolt25: <p>Is this code written by you or have you picked it up from some repo on github?</p>

shangguan91: <p>i picked it up from Github in <a href="https://github.com/rusty1s/pytorch_geometric/blob/master/benchmark/points/point_cnn.py" rel="nofollow noopener">https://github.com/rusty1s/pytorch_geometric/blob/master/benchmark/points/point_cnn.py</a></p>

bolt25: <p>Can you share your directory structure here?</p>

shangguan91: <p>hey, i am new to programming. i am using the google colab.<br>
I just run :<br>
! pip install torch-scatter==latest+cu101</p>
<p>! pip install torch-sparse==latest+cu101</p>
<p>! pip install torch-cluster==latest+cu101</p>
<p>! pip install torch-spline-conv==latest+cu101</p>
<p>! pip install torch-geometric</p>
<p>i do not know how to show u the directory either</p>

bolt25: <p>oh okay you are using colab.<br>
Just type !ls in a kernel and share the output here.</p>
<p>Regards!</p>

shangguan91: <p>it shows sample_data</p>

bolt25: <p>yeah, so the problem is you are not in the directory where all other files are!<br>
You have to go into that folder where all the files are stored!</p>
<p>Wait a minute! did you just copy paste the code in colab or did you clone the github repo?</p>

shangguan91: <p>i copy paste, should i use !git clone<br>
!git clone [<a href="http://github.com/rusty1s/pytorch_geometric.git" rel="nofollow noopener">github.com/rusty1s/pytorch_geometric.git</a>]].<br>
but i respond that the repository ‘[pytorch_geometric.git]’ does not exist</p>

bolt25: <p>yeah you need to clone the repo and then launch the code. If you are using colab then you need to upload the entire repo on your drive and then you can access this code file from there</p>

shangguan91: <p>will Github dektop better to solve my problem?<br>
I tried to implement GCN.py on IMBD-Binary<br>
in <a href="https://github.com/rusty1s/pytorch_geometric/tree/master/benchmark/kernel" rel="nofollow noopener">https://github.com/rusty1s/pytorch_geometric/tree/master/benchmark/kernel</a>.</p>
<p>i load data use datasets.py, GCN.py , train_eval.py. However, i could not get result that normally combined with epoch loops and accuracy. where did i do wrong?</p>
<p>Sorry for so many question in one time.</p>

shangguan91: <p>hey, i think i solve the part of my problem by<br>
!pip install -q xlrd</p>
<p>!git clone <a href="https://github.com/rusty1s/pytorch_geometric.git" rel="nofollow noopener">https://github.com/rusty1s/pytorch_geometric.git</a></p>

shangguan91: <p>i think the problem is that i do not have module named ‘points’ . I had repository installed in google drive, the problem still exist</p>

bolt25: <p>That is the problem. you dont have the file named datasets in your working directory. you have to make sure you include all the files in your working directory before running this code.</p>