ConceptFERE
This code is the source code of our paper "Entity Concept-enhanced Few-shot Relation Extraction" in the ACL2021
Install / Use
/learn @LittleGuoKe/ConceptFEREREADME
Entity Concept-enhanced Few-shot Relation Extraction
This code is the source code of our paper "Entity Concept-enhanced Few-shot Relation Extraction" in the ACL2021.
Requirements
conda env create -f environment.yml
Checkpoint, Data files
Since the files are very large, they are placed on the Beihang cloud disk. If Beihang Cloud Disk cannot be downloaded normally, you can try to download it in Google Drive.
Training data
For the Details of training data, you can refer to FewRel.
Warning
Re-split the dataset
We divide the original training dataset into a new training dataset and a new validation dataset, the corresponding code is in the re_split_dataset module in fewshot_re_kit/utils.py, and the validation set in the original dataset is used as the new test dataset
Randomness
Due to the randomness of the experiments of the FSRE task, the results in the paper are the average of the results of multiple experiments
How the code is executed
Example:
python train_demo.py --trainN 5 --N 5 --K 1 --Q 1 --model pair --encoder bert --pair --hidden_size 768 --val_step 1000 --save_ckpt checkpoint/5way1shot.ConceptFere.pth.tar --batch_size 1 --grad_iter 4 --optim adam --fp16 --id_from MultiHeadAttentionAndBeyondWordEmbedding > 5way1shot.ConceptFere.log 2>&1
--trainN --N --K --Q: N-way-K-shot.
--model: specify the name of the model, such as proto, pair, etc.
--id_from: specify the source of the pre-trained concept embedding.
--grad_iter: in the case of insufficient GPU memory, set a small batchsize accumulate gradient every x iterations.
--fp16: use nvidia apex fp16.
Citing
If you used our code, please kindly cite our paper:
@inproceedings{yang-etal-2021-entity,
title = "Entity Concept-enhanced Few-shot Relation Extraction",
author = "Yang, Shan and
Zhang, Yongfei and
Niu, Guanglin and
Zhao, Qinghua and
Pu, Shiliang",
booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers)",
month = aug,
year = "2021",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2021.acl-short.124",
doi = "10.18653/v1/2021.acl-short.124",
pages = "987--991"
}
Related Skills
node-connect
352.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
