OpenKE 的使用(二)— TransX 系列论文复现
前言: 之前踩了VM中ubuntu不能使用Nvidia驱动的坑,于是我在安装好Windows+Ubuntu双系统,并在Ubuntu 20.04子系统中配置好深度学习环境后,终于得以成功使用OpenKE对 KGE模型进行复现,本篇主要是关于TransX系列模型的实现,如下是我实验的环境,论文原文,我对论文的理解和OpenKE的GitHub地址
Environment: 联想R7000P,Ubuntu 20.04(子系统),Pytorch,cuda 11.5,cuDNN,OpenKE
Paper Understanding: TransX 系列,知识图谱嵌入(KGE)论文阅读
Download from Github:
git clone -b OpenKE-PyTorch https://github.com/thunlp/OpenKE
说明: git clone -b OpenKE-PyTorch https://github.com/thunlp/OpenKE
命令如果执行出错,可以参考OpenKE 的初步探索(VM 中的 Ubuntu 踩坑)的 准备工作:VM 中 Ubuntu 20.04 系统 git 的配置及与 github 的连接
部分,虽然是在VM中Ubuntu系统中的配置,但是原理和操作都是一样的
OpenKE中各种模型的统一评价指标:
; TransH
数据集:FB15K237
手动复制examples文件夹中的 train_transh_FB15K237.py
到OpenKE目录下,并在此处打开终端
使用的命令如下:
python train_transh_FB15K237.py
TransR
数据集:FB15K237
手动复制examples文件夹中的 train_transr_FB15K237.py
到OpenKE目录下,并在此处打开终端
使用的命令如下:
python train_transr_FB15K237.py
报错: FileNotFoundError: [Errno 2] No such file or directory: './result/transr_transe.json'
解决:在 OpenKE 目录下建立 result 文件夹:
重新运行,报错,应该是显存不够用:
RuntimeError: CUDA out of memory. Tried to allocate 10.54 GiB (GPU 0; 5.80 GiB total capacity; 234.79 MiB already allocated; 4.64 GiB free; 286.00 MiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
; TransD
数据集:FB15K237
手动复制examples文件夹中的 train_transd_FB15K237.py
到OpenKE目录下,并在此处打开终端
使用的命令如下:
python train_transd_FB15K237.py
把TransD的模型也跑一下吧,万一以后用到,日后若有缘,可以研究一下此模型的对抗攻击
Original: https://blog.csdn.net/qq_40506723/article/details/123252700
Author: 白白净净吃了没病
Title: OpenKE 的使用(二)— TransX 系列论文复现
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/556191/
转载文章受原作者版权保护。转载请注明原作者出处!