Codes for our ACL 2022 paper: Pre-training to Match for Unified Low-shot Relation Extraction. [Arxiv]
the data is on FewRel official page https://github.com/thunlp/FewRel, please download and put into ./data directory.
- Create a Python 3 environment (3.7 or greater), eg using
conda create --name MCMN python=3.9
- Activate the environment:
conda activate MCMN
- Install the dependency packages:
pip install -r requirements.txt
- Clone the repository:
git clone git@github.com:allenai/flex.git
- enter into flex directory:
cd flex
- Install the package locally with
pip install -e .
- For detail usage of Flex, please refer to https://github.com/allenai/flex
- replace the file
flex/fewshot/challenges/__init__.py
with file__ROOT__/challenge/__init__.py
(This step removes other unrelated tasks in FLEX and only keeps FewRel tasks.) - Make dataset:
python -c "import fewshot; fewshot.make_challenge('flex');"
./test_flex_ft.sh
./test_flex_pt_ft.sh
- na rate 0.15:
./test_nota_0.15_ft.sh
- na rate 0.5:
./test_nota_0.5_ft.sh
- na rate 0.15:
./test_nota_0.15_pt_ft.sh
- na rate 0.5:
./test_nota_0.5_pt_ft.sh
The code is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License for Noncommercial use only. Any commercial use should get formal permission first.