Skip to content

smufang/RelAdapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pytorch RelAdapter (Few-shot Link Prediction)

Evironment Setting

This code is lastly tested with:

  • Python 3.6.7
  • PyTorch 1.0.1
  • tensorboardX 1.8

You can also install dependencies by

pip install -r requirements.txt

Dataset

We provide three datasets: Wiki1, FB15K-2371 and UMLS.

Training (UMLS)

python main.py  --seed 1  --dataset umls-One  --data_path ./umls    --few 3  --step train  --mu 0.3  --alpha 0.1 --neuron 50    --eval_by_rel False   --prefix umlsone_3shot_pretrain  --device 0

Test (UMLS)

python main.py  --seed 1  --dataset umls-One  --data_path ./umls    --few 3  --step test  --mu 0.3  --alpha 0.1 --neuron 50    --eval_by_rel True --prefix umlsone_3shot_pretrain  --device 0

Wiki and FB15K-237 follow the same code format for training and test

Here are explanations of some important args,

--dataset:   "the name of dataset, Wiki, FB15K-237, UMLS"
--data_path: "directory of dataset"
--few:       "the number of few in {few}-shot, as well as instance number in support set"
--data_form: "dataset setting, Pre-Train"
--alpha : "the adapter ratio"
--mu : "the context ratio"
--neurons : "the adapter neurons"
--prefix:    "given name of current experiment"
--device:    "the GPU number"

Footnotes

  1. Due to size constraint, Wiki and FB15K-237 have been excluded. 2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages