This repository contains the official implementation for the paper: AlignRE: An Encoding and Semantic Alignment Approach for Zero-Shot Relation Extraction. The paper has been accepted to appear at ACL 2024 Findings.
Place them to the /data
folder.
The main requirements are:
- python==3.9.7
- pytorch==1.13.1
- transformers==4.44.2
- sentence-transformers==2.2.2
- numpy==1.22.3
- Download the pretrained Bert weights to folder './BERT_MODELS/bert-base-uncased'.
- Download the pretrained Sentence-Bert weights to folder './BERT_MODELS/stsb-bert-base'.
- Set hyperparameters and run
train.py
@inproceedings{li2024alignre,
title={AlignRE: An Encoding and Semantic Alignment Approach for Zero-Shot Relation Extraction},
author={Li, Zehan and Zhang, Fu and Cheng, Jingwei},
booktitle={Findings of the Association for Computational Linguistics ACL 2024},
pages={2957--2966},
year={2024}
}
The framework of AlignRE is based on ZS-BERT and RE-Matching. Their contributions have greatly helped in the development and implementation of our code. We appreciate their efforts and the open-source community for fostering collaboration and knowledge sharing.