yangzx 0f47107ed8 | 2 years ago | |
---|---|---|
src_npu | 2 years ago | |
README.md | 2 years ago | |
eval.py | 2 years ago | |
eval.sh | 2 years ago | |
main.py | 2 years ago | |
requirements.txt | 2 years ago | |
train.sh | 2 years ago |
原始模型参考github链接,迁移训练代码到昇腾910
环境 | 卡数/数据集 | 训练总耗时(h/m/s) | 实测精度 | 论文精度 | 实测性能(ms/step) | 基线性能(ms/step) |
---|---|---|---|---|---|---|
Ascend | 1P/Cora | 96.29s | 85.1% | 83.3 ± 0.5% | 0.095 | 0.9181 |
卷积神经网络在网格数据上取得了很大的成功,但是在学习像图这样的数据的时候就面临着很多的挑战。CNN中,可学习的局部滤波器可以自动地捕获高层次的特征。滤波器的计算需要感受野内有固定数量的单元。然而,在图结构中,邻居单元的数量不固定,而且邻居也不有序,所以阻碍了卷积的操作。我们提出了可学习图卷积层(learnable graph convolutional layer LGCL)来解决这些挑战。
基于值的排序,LGCL为每个特征自动地选择固定数量的邻居结点,以此将图结构数据变换到1维的网格结构中,然后就可以在图上使用常规的卷积操作了。为了能让模型在大尺度的图上训练,我们提出了一个子图训练方法来减少过多的内存和计算资源的开销。在顶点分类任务上,不论是transductive 还是 inductive,表现得都更好一些。我们的结果展示出了我们的子图训练方法比前人的方法更高效。
Cora数据集由许多机器学习领域的paper构成,这些paper被分为7个类别:
在该数据集中,每一篇论文至少引用了该数据集里面另外一篇论文或者被另外一篇论文所引用,数据集总共有2708篇papers。
在消除停词以及除去文档频率小于10的词汇,最终词汇表中有1433个词汇。
下载数据集到代码目录下即可。
硬件环境:
第三方库:
networkx==2.5
scipy==1.3.3
scikit-learn==0.20.0
numpy==1.17.5
├── ascend #存放自定义算子
│ └── opp
├── data #自带数据集
│ ├── ind.cora.allx
│ ├── ind.cora.ally
│ ├── ind.cora.graph
│ ├── ind.cora.test.index
│ ├── ind.cora.tx
│ ├── ind.cora.ty
│ ├── ind.cora.x
│ └── ind.cora.y
├── eval.py #模型评估py
├── eval.sh #模型评估sh
├── requirements.txt #依赖
├── src_npu
│ ├── __init__.py
│ ├── batch_utils.py #抽样逻辑
│ ├── inits.py #初始化
│ ├── network.py #构建网络脚本
│ ├── ops.py # 算子、模型封装层
│ └── utils.py # 数据预处理
├── main.py #模型训练py
└── train.sh #模型训练sh
由于SparseTensorDenseMatMul、Transpose算子在Ascend侧训练较慢,代码中使用了混合计算模式,并且修改了npu_supported_ops.json,将默认下沉的SparseTensorDenseMatMul、Transpose算子在json中删除,使其可以在CPU侧运行。
可以下载自定义opp算子,该版本为5.0.2;
wget https://model-test-yzx.obs.cn-north-4.myhuaweicloud.com/opp_502.tar.gz然后解压缩该文件,tar -zxvf opp_502.tar.gz,在train.sh指定ASCEND_OPP_PATH=解压缩路径。
自定义autotune路径:
wget https://model-test-yzx.obs.cn-north-4.myhuaweicloud.com/lgcn_ga.tar.gz,然后解压tar -zxvf lgcn_ga.tar.gz,在train.sh指定TUNE_BANK_PATH=解压缩路径。
直接执行shell:
bash train.sh
在训练后,得到对应的CheckPoint 密码:71vb从${modeldir}中查询模型step值,执行以下脚本:
python3 eval.py --modeldir=./modeldir
第四届中国软件开源创新大赛·赛道二:任务挑战赛(模型王者挑战赛):基于华为Ascend 910,利用Tensorflow 1.15.0 实现LGCN,数据集:训练集:Cora,最终精度:85.1%,性能:0.095 ms/step
Python Text Shell
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》