7
7
import torch
8
8
9
9
from cogdl .data import Graph , Dataset
10
- from cogdl .utils import download_url
10
+ from cogdl .utils import untar , download_url
11
11
from cogdl .utils .grb_utils import adj_to_tensor
12
12
13
13
@@ -16,36 +16,11 @@ class GRBDataset(Dataset):
16
16
MODES = ["easy" , "medium" , "hard" , "full" ]
17
17
FEAT_NORMS = [None , "linearize" , "arctan" , "tanh" , "standardize" ]
18
18
URLs = {
19
- "grb-cora" : {
20
- "adj.npz" : "https://cloud.tsinghua.edu.cn/f/2e522f282e884907a39f/?dl=1" ,
21
- "features.npz" : "https://cloud.tsinghua.edu.cn/f/46fd09a8c1d04f11afbb/?dl=1" ,
22
- "labels.npz" : "https://cloud.tsinghua.edu.cn/f/88fccac46ee94161b48f/?dl=1" ,
23
- "index.npz" : "https://cloud.tsinghua.edu.cn/f/d8488cbf78a34a8c9c5b/?dl=1" ,
24
- },
25
- "grb-citeseer" : {
26
- "adj.npz" : "https://cloud.tsinghua.edu.cn/f/d3063e4e010e431b95a6/?dl=1" ,
27
- "features.npz" : "https://cloud.tsinghua.edu.cn/f/172b66d454d348458bca/?dl=1" ,
28
- "labels.npz" : "https://cloud.tsinghua.edu.cn/f/f594655156c744da9ef6/?dl=1" ,
29
- "index.npz" : "https://cloud.tsinghua.edu.cn/f/cb25124f9a454dcf989f/?dl=1" ,
30
- },
31
- "grb-reddit" : {
32
- "adj.npz" : "https://cloud.tsinghua.edu.cn/f/22e91d7f34494784a670/?dl=1" ,
33
- "features.npz" : "https://cloud.tsinghua.edu.cn/f/000dc5cd8dd643dcbfc6/?dl=1" ,
34
- "labels.npz" : "https://cloud.tsinghua.edu.cn/f/3e228140ede64b7886b2/?dl=1" ,
35
- "index.npz" : "https://cloud.tsinghua.edu.cn/f/24310393f5394e3a8b73/?dl=1" ,
36
- },
37
- "grb-aminer" : {
38
- "adj.npz" : "https://cloud.tsinghua.edu.cn/f/dca1075cd8cc408bb4c0/?dl=1" ,
39
- "features.npz" : "https://cloud.tsinghua.edu.cn/f/e93ba93dbdd94673bce3/?dl=1" ,
40
- "labels.npz" : "https://cloud.tsinghua.edu.cn/f/0ddbca54864245f3b4e1/?dl=1" ,
41
- "index.npz" : "https://cloud.tsinghua.edu.cn/f/3444a2e87ef745e89828/?dl=1" ,
42
- },
43
- "grb-flickr" : {
44
- "adj.npz" : "https://cloud.tsinghua.edu.cn/f/90a513e35f0a4f3896eb/?dl=1" ,
45
- "features.npz" : "https://cloud.tsinghua.edu.cn/f/54b2f1d7ee7c4d5bbcd4/?dl=1" ,
46
- "labels.npz" : "https://cloud.tsinghua.edu.cn/f/43e9ec09458e4d30b528/?dl=1" ,
47
- "index.npz" : "https://cloud.tsinghua.edu.cn/f/8239dc6a729e489da44f/?dl=1" ,
48
- },
19
+ "grb-cora" : "https://cogdl-data.oss-cn-beijing.aliyuncs.com/data/grb-cora.zip" ,
20
+ "grb-citeseer" : "https://cogdl-data.oss-cn-beijing.aliyuncs.com/data/grb-citeseer.zip" ,
21
+ "grb-reddit" : "https://cogdl-data.oss-cn-beijing.aliyuncs.com/data/grb-reddit.zip" ,
22
+ "grb-aminer" : "https://cogdl-data.oss-cn-beijing.aliyuncs.com/data/grb-aminer.zip" ,
23
+ "grb-flickr" : "https://cogdl-data.oss-cn-beijing.aliyuncs.com/data/grb-flickr.zip" ,
49
24
}
50
25
51
26
def __init__ (self , root , name , mode = "full" , feat_norm = None ):
@@ -83,9 +58,9 @@ def processed_file_names(self):
83
58
return ["data_" + self .mode + "_" + str (self .feat_norm ) + ".pt" ]
84
59
85
60
def download (self ):
86
- print (self .name )
87
- for name in self .raw_file_names :
88
- download_url (self .URLs [ self . name ][ name ], self . raw_dir , name )
61
+ fname = "{}.zip" . format (self .name . lower () )
62
+ download_url ( self . URLs [ self . name . lower ()], self .raw_dir , fname )
63
+ untar (self .raw_dir , fname )
89
64
90
65
def get (self , idx ):
91
66
assert idx == 0
0 commit comments