Shen-Lab / GraphCL

[NeurIPS 2020] "Graph Contrastive Learning with Augmentations" by Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, Yang Shen
MIT License
547 stars 103 forks source link

Code #1

Closed wangzeyu135798 closed 3 years ago

wangzeyu135798 commented 3 years ago

Hi: In GraphCL/semisupervised_TU/pre-training/ I take NCI1 as an example as you stated, run CUDA_VISIBLE_DEVICES=$GPU_ID python main.py --dataset NCI1 --aug1 random2 --aug2 random2 --lr 0.001 --suffix 0. There is an error that "No such file or directory: data/NCI1/NCI1/processed/data_deg+odeg100.pt". How could I get the file data_deg+odeg100.pt? Should I run another code before getting .pt file?

yyou1996 commented 3 years ago

Hi, @wangzeyu135798,

The code should automatically download the dataset at the first run if you download the correct dependencies. Please feel free to drop questions if it still not works.

wangzeyu135798 commented 3 years ago

你好:       感谢你的回复!       在运行你的github代码的时候,在semisupervised_TU/pre-training/tu_dataset.py line 50 报错,错误为不存在.pt文件。       我想问下代码在自动下载数据的时候包括相关的.pt文件吗?我看到你的这个项目在github网页上提到了gfn-master,对于gfn-master这套代码,我也遇到了相关的问题。 

------------------ 原始邮件 ------------------ 发件人: "Shen-Lab/GraphCL" <notifications@github.com>; 发送时间: 2020年10月30日(星期五) 晚上9:36 收件人: "Shen-Lab/GraphCL"<GraphCL@noreply.github.com>; 抄送: "天津工业大学王泽宇"<1051533398@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [Shen-Lab/GraphCL] Code (#1)

Hi, @wangzeyu135798,

The code should automatically download the dataset at the first run if you download the correct dependencies. Please feel free to drop questions if it still not work.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

yyou1996 commented 3 years ago

包括的。他会自动下载数据,然后预处理成.pt文件。需要torch-geometric版本之类的正确才行。

yyou1996 commented 3 years ago

I make an update to provide the conda environment file that might help you collect the required dependencies. Please see https://github.com/Shen-Lab/GraphCL/tree/master/semisupervised_TU#option-2.

Any other questions feel free to drop here. Thanks.

wangzeyu135798 commented 3 years ago

Hi:    After reading you data, I have two questions.    First, is one positive pair is the same graph data instance augmented in two aspects?    Second, when calculating the loss, line res_gcn.py line 233, loss = pos_sim / (sim_matrix.sum(dim=1)) - pos_sim - self_sim, while in paper equation(3) the last  two components(pos_sim and self_dim) are lost, why?    I hope your reply.    Thanks.        

------------------ 原始邮件 ------------------ 发件人: "Shen-Lab/GraphCL" <notifications@github.com>; 发送时间: 2020年11月5日(星期四) 晚上10:59 收件人: "Shen-Lab/GraphCL"<GraphCL@noreply.github.com>; 抄送: "天津工业大学王泽宇"<1051533398@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [Shen-Lab/GraphCL] Code (#1)

Hi @wangzeyu135798,

I make an update to provide the conda environment file that might help you collect the required dependencies. Please see https://github.com/Shen-Lab/GraphCL/tree/master/semisupervised_TU#option-2.

Any other questions feel free to drop here. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

wangzeyu135798 commented 3 years ago

Hi:    When I run the finetuning step, there is a code error.    In semisupervised_TU/finetuning/traineval.py line 181,     for , idx in skf_semi.split(torch.zeros(idx_train.size()[0]), dataset[idx_trian].data.y)    ValueError: Found input variables with inconsistent numbers of samples: [3699, 4110]    How to solve it?    Thanks.

------------------ 原始邮件 ------------------ 发件人: "Shen-Lab/GraphCL" <notifications@github.com>; 发送时间: 2020年11月5日(星期四) 晚上10:59 收件人: "Shen-Lab/GraphCL"<GraphCL@noreply.github.com>; 抄送: "天津工业大学王泽宇"<1051533398@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [Shen-Lab/GraphCL] Code (#1)

Hi @wangzeyu135798,

I make an update to provide the conda environment file that might help you collect the required dependencies. Please see https://github.com/Shen-Lab/GraphCL/tree/master/semisupervised_TU#option-2.

Any other questions feel free to drop here. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

wangzeyu135798 commented 3 years ago

你好:       还有一个问题。在semisupervised-TU/fine-tuning/train_eval.py 里面,调用train函数的时候是在进行有监督训练,那么此时的model不也应该被保存吗?在代码中没有看到调用train函数时模型被save。

------------------ 原始邮件 ------------------ 发件人: "Shen-Lab/GraphCL" <notifications@github.com>; 发送时间: 2020年11月5日(星期四) 晚上10:59 收件人: "Shen-Lab/GraphCL"<GraphCL@noreply.github.com>; 抄送: "天津工业大学王泽宇"<1051533398@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [Shen-Lab/GraphCL] Code (#1)

Hi @wangzeyu135798,

I make an update to provide the conda environment file that might help you collect the required dependencies. Please see https://github.com/Shen-Lab/GraphCL/tree/master/semisupervised_TU#option-2.

Any other questions feel free to drop here. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

yyou1996 commented 3 years ago

First, is one positive pair is the same graph data instance augmented in two aspects?: Yes.

_Second, when calculating the loss, line res_gcn.py line 233, loss = pos_sim / (sim_matrix.sum(dim=1)) - pos_sim - self_sim, while in paper equation(3) the last  two components(pos_sim and selfdim) are lost, why? Thanks for pointing it out. The denominator in formulation should be corrected as sum_{k=1, k!=i}^N xxx.

ValueError: Found input variables with inconsistent numbers of samples: [3699, 4110] Would you mind sharing your environment.yml file that I can double-check? Thanks.

_还有一个问题。在semisupervised-TU/fine-tuning/traineval.py 里面,调用train函数的时候是在进行有监督训练,那么此时的model不也应该被保存吗?在代码中没有看到调用train函数时模型被save。 In finetuning I only saved the results before since the overall results are 10- or 100-fold evaluation with 5 runs. Of course, you can make small modification in code to save the models.

Hope my answers can help you.

wangzeyu135798 commented 3 years ago

你好:      我现在在看你的这篇文章When Does Self-Supervision Help Graph Convolutional Networks? 在看到Graph partition的时候,对应代码里用到了metis的一个分割图的函数metis.part_graph, 对于metis这个包,我直接pip install metis,安装0.2a4这个版本,运行后报错RuntimeError: Could not locate METIS dll. Please set the METIS_DLL environment variable to its full path.我一直没有找到解决方案。我现在的环境是windows,请问你当时是怎么安装的这个包?

------------------ 原始邮件 ------------------ 发件人: "Shen-Lab/GraphCL" <notifications@github.com>; 发送时间: 2020年11月10日(星期二) 凌晨5:38 收件人: "Shen-Lab/GraphCL"<GraphCL@noreply.github.com>; 抄送: "天津工业大学王泽宇"<1051533398@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [Shen-Lab/GraphCL] Code (#1)

Thanks @wangzeyu135798,

First, is one positive pair is the same graph data instance augmented in two aspects?: Yes.

Second, when calculating the loss, line res_gcn.py line 233, loss = pos_sim / (sim_matrix.sum(dim=1)) - pos_sim - self_sim, while in paper equation(3) the last  two components(pos_sim and selfdim) are lost, why? Thanks for pointing it out. The denominator in formulation should be corrected as sum{k=1, k!=i}^N xxx.

ValueError: Found input variables with inconsistent numbers of samples: [3699, 4110] Would you mind sharing your environment.yml file that I can double-check? Thanks.

还有一个问题。在semisupervised-TU/fine-tuning/train_eval.py 里面,调用train函数的时候是在进行有监督训练,那么此时的model不也应该被保存吗?在代码中没有看到调用train函数时模型被save。 In finetuning I only saved the results before since the overall results are 10- or 100-fold evaluation with 5 runs. Of course, you can make small modification in code to save the models.

Hope my answers can help you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

yyou1996 commented 3 years ago

Please follow the dependencies part https://github.com/Shen-Lab/SS-GCNs#dependencies that pip install only provide your the API between python and METIS, but you also need to install METIS such that python can call METIS.

In https://github.com/Shen-Lab/SS-GCNs#dependencies for Linux thus we need to run sudo apt-get install libmetis-dev.

wangzeyu135798 commented 3 years ago

Hi:    Under SS-GCN/cluster_labels, there are three .npy files. I want to learn how to make these npy files?

------------------ 原始邮件 ------------------ 发件人: "Shen-Lab/GraphCL" <notifications@github.com>; 发送时间: 2020年11月12日(星期四) 晚上11:22 收件人: "Shen-Lab/GraphCL"<GraphCL@noreply.github.com>; 抄送: "天津工业大学王泽宇"<1051533398@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [Shen-Lab/GraphCL] Code (#1)

Hi @wangzeyu135798,

Please follow the dependencies part https://github.com/Shen-Lab/SS-GCNs#dependencies that pip install only provide your the API between python and METIS, but you also need to install METIS such that python can call METIS.

In https://github.com/Shen-Lab/SS-GCNs#dependencies for Linux thus we need to run sudo apt-get install libmetis-dev.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

yyou1996 commented 3 years ago

Please see the bottom of this README.md https://github.com/Shen-Lab/SS-GCNs/tree/master/SS-GCNs#training--evaluation.