Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Towards Robust Few-Shot Relation Classification: Incorporating Relation Description with Agreement

Environments

  • python 3.8.13
  • torch 1.12.1
  • transformers 4.22.2
  • scikit-learn 1.1.2

Datasets

FewRel

You can find the training and validation data here: FewRel.

Training

O-Proto model:

python train.py --N {} --K {} --Q {} --na_rate {} --batch_size 2 --train_iter 30000 --test_iter 10000 --val_iter 1000 --val_step 1000 --model OProto --encoder bert --max_length 128 --lr 2e-5 --hidden_size 768 --seed {}

Bert-Pair model:

python train.py --N {} --K {} --Q {} --na_rate {} --batch_size 2 --train_iter 30000 --test_iter 10000 --val_iter 1000 --val_step 1000 --model pair --pair --encoder bert --max_length 128 --lr 2e-5 --hidden_size 768 --seed {}

MNAV model:

python train.py --N {} --K {} --Q {} --na_rate {} --batch_size 2 --train_iter 30000 --test_iter 10000 --val_iter 1000 --val_step 1000 --model MNAV --vector_num 20 --encoder bert --max_length 128 --lr 2e-5 --hidden_size 768 --seed {}

PRM model:

python train.py --N {} --K {} --Q {} --na_rate {} --batch_size 2 --train_iter 30000 --test_iter 10000 --val_iter 1000 --val_step 1000 --model PRM --encoder bert --max_length 128 --lr 2e-5 --hidden_size 768 --seed {}

RoFRC model (ours):

python train.py --N {} --K {} --Q {} --na_rate {} --batch_size 2 --train_iter 30000 --test_iter 10000 --val_iter 1000 --val_step 1000 --model RoFRC --encoder bert --max_length 128 --lr 2e-5 --hidden_size 768 --lamb 1e-5 --seed {}
  • N: N in N-way K-shot.
  • K: K in N-way K-shot.
  • Q: The number of query instances for each relation in the query set. Q is set to 1 in our experiments.
  • na_rate: NOTA rate in training phase. The default is 5.
  • seed: seed. 5/10/15/20/25.

About

RoFRC framework.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages