Namkyeong / RGRL

The official source code for "Relational Self-Supervised Learning on Graphs"
https://arxiv.org/abs/2208.10493
23 stars 2 forks source link

Dataset Issue #1

Open liyp0095 opened 1 year ago

liyp0095 commented 1 year ago

I was trying to run your code and got a FileNotFoundError. Here is the log.

`python main.py --device 0 --embedder RGRL --layers 512 256 --pred_hid 512 --lr 0.001 --epochs 1500 --sample 2048 --topk 2 --dataset wikics --aug_params 0.2 0.1 0.2 0.3 --temp_t 0.05 --temp_t_diff 1.0 --alpha 0.99 --beta 0.01 --lam 1.0 --eval_freq 5 ['dataset', 'embedder', 'root', 'device', 'eval_freq', 'lr', 'es', 'epochs', 'dropout', 'aug_params', 'layers', 'pred_hid', 'sample', 'topk', 'temp_t', 'temp_s', 'temp_t_diff', 'temp_s_diff', 'alpha', 'beta', 'lam'] ['wikics', 'RGRL', 'data', 0, 5.0, 0.001, 3000, 1500, 0.0, ['0.2', '0.1', '0.2', '0.3'], ['512', '256'], 512, 2048, 2, 0.05, 0.1, 1.0, 0.1, 0.99, 0.01, 1.0]

[Config] dataset_wikics_embedder_RGRL_lr_0.001_augparams['0.2', '0.1', '0.2', '0.3']_sample_2048_topk_2_temp_t_0.05_temp_s_0.1_temp_t_diff_1.0_temp_s_diff_0.1_alpha_0.99_beta_0.01_lam_1.0

/work/LAS/xxx-lab/xxxxx/envs/star/lib/python3.7/site-packages/torch_geometric/datasets/wikics.py:39: UserWarning: The WikiCS dataset now returns an undirected graph by default. Please explicitly specify 'is_undirected=False' to restore the old behaviour. f"The {self.class.name} dataset now returns an " Downloading https://github.com/pmernyei/wiki-cs-dataset/raw/master/dataset/data.json Processing... Done! Traceback (most recent call last): File "/work/LAS/xxx-lab/xxxxx/temp/RGRL/models/RGRL.py", line 40, in _init diffusion = torch.load("./diffusion/{}_top{}.pt".format(args.dataset, args.topk)) File "/work/LAS/xxx-lab/xxxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 771, in load with _open_file_like(f, 'rb') as opened_file: File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 270, in _open_file_like return _open_file(name_or_buffer, mode) File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 251, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: './diffusion/wikics_top2.pt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 28, in main() File "main.py", line 22, in main embedder = RGRL_ModelTrainer(args) File "/work/LAS/xxx-lab/xxxxxx/temp/RGRL/models/RGRL.py", line 31, in init self._init() File "/work/LAS/xxx-lab/xxxxxx/temp/RGRL/models/RGRL.py", line 43, in _init temp = Dataset(root=args.root, dataset=args.dataset)[0] File "/work/LAS/xxx-lab/xxxxxx/temp/RGRL/data.py", line 60, in init self.data, self.slices = torch.load(path) File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 771, in load with _open_file_like(f, 'rb') as opened_file: File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 270, in _open_file_like return _open_file(name_or_buffer, mode) File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 251, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'data/pyg/WikiCS/processed/byg.data.aug.pt'`

I can not figure out what wikics_top2.pt and byg.data.aug.pt is. Please give me some suggestions.

SwaggyZhang commented 1 year ago

I was trying to run your code and got a FileNotFoundError. Here is the log.

`python main.py --device 0 --embedder RGRL --layers 512 256 --pred_hid 512 --lr 0.001 --epochs 1500 --sample 2048 --topk 2 --dataset wikics --aug_params 0.2 0.1 0.2 0.3 --temp_t 0.05 --temp_t_diff 1.0 --alpha 0.99 --beta 0.01 --lam 1.0 --eval_freq 5 ['dataset', 'embedder', 'root', 'device', 'eval_freq', 'lr', 'es', 'epochs', 'dropout', 'aug_params', 'layers', 'pred_hid', 'sample', 'topk', 'temp_t', 'temp_s', 'temp_t_diff', 'temp_s_diff', 'alpha', 'beta', 'lam'] ['wikics', 'RGRL', 'data', 0, 5.0, 0.001, 3000, 1500, 0.0, ['0.2', '0.1', '0.2', '0.3'], ['512', '256'], 512, 2048, 2, 0.05, 0.1, 1.0, 0.1, 0.99, 0.01, 1.0]

[Config] dataset_wikics_embedder_RGRL_lr_0.001_augparams['0.2', '0.1', '0.2', '0.3']_sample_2048_topk_2_temp_t_0.05_temp_s_0.1_temp_t_diff_1.0_temp_s_diff_0.1_alpha_0.99_beta_0.01_lam_1.0

/work/LAS/xxx-lab/xxxxx/envs/star/lib/python3.7/site-packages/torch_geometric/datasets/wikics.py:39: UserWarning: The WikiCS dataset now returns an undirected graph by default. Please explicitly specify 'is_undirected=False' to restore the old behaviour. f"The {self.class.name} dataset now returns an " Downloading https://github.com/pmernyei/wiki-cs-dataset/raw/master/dataset/data.json Processing... Done! Traceback (most recent call last): File "/work/LAS/xxx-lab/xxxxx/temp/RGRL/models/RGRL.py", line 40, in _init diffusion = torch.load("./diffusion/{}_top{}.pt".format(args.dataset, args.topk)) File "/work/LAS/xxx-lab/xxxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 771, in load with _open_file_like(f, 'rb') as opened_file: File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 270, in _open_file_like return _open_file(name_or_buffer, mode) File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 251, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: './diffusion/wikics_top2.pt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 28, in main() File "main.py", line 22, in main embedder = RGRL_ModelTrainer(args) File "/work/LAS/xxx-lab/xxxxxx/temp/RGRL/models/RGRL.py", line 31, in init self._init() File "/work/LAS/xxx-lab/xxxxxx/temp/RGRL/models/RGRL.py", line 43, in _init temp = Dataset(root=args.root, dataset=args.dataset)[0] File "/work/LAS/xxx-lab/xxxxxx/temp/RGRL/data.py", line 60, in init self.data, self.slices = torch.load(path) File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 771, in load with _open_file_like(f, 'rb') as opened_file: File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 270, in _open_file_like return _open_file(name_or_buffer, mode) File "/work/LAS/xxx-lab/xxxxxx/envs/star/lib/python3.7/site-packages/torch/serialization.py", line 251, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'data/pyg/WikiCS/processed/byg.data.aug.pt'`

I can not figure out what wikics_top2.pt and byg.data.aug.pt is. Please give me some suggestions.

Hello , I also had the same problem as yours, and I solved it with such method:

You can edit the initialization function of Dataset class in data.py as following:

def __init__(self, root="data", dataset='cora', augumentation=None, transform=None,
                 pre_transform=None):
        self.augumentation = augumentation
        self.root, self.name, self.data_dir = download_data(root=root, dataset=dataset)
        utils.create_dirs(self.dirs)
        super().__init__(root=self.data_dir, transform=transform, pre_transform=pre_transform)
        processed_path = osp.join(self.data_dir, "processed", self.processed_file_names[0])
        if osp.exists(processed_path)==True:
            self.data, self.slices = torch.load(processed_path)
        else:
            path = osp.join(self.raw_dir, self.raw_file_names[0])
            data, _ = torch.load(path)
            edge_attr = data.edge_attr
            edge_attr = torch.ones(data.edge_index.shape[1]) if edge_attr is None else edge_attr
            data.edge_attr = edge_attr
            data_list = self.process_full_batch_data(data)
            data, slices = self.collate(data_list)
            torch.save((data, slices), processed_path)

The authors realized the data process in Dataset.process(self).