-
H. Ambre Ayats authoredH. Ambre Ayats authored
LUKE-ReDect
Fork of LUKE in order to specialize it for relation detection in texts.
Installation
LUKE can be installed using Poetry:
$ poetry install
The virtual environment automatically created by Poetry can be activated by
poetry shell
.
Released Models
We initially release the pre-trained model with 500K entity vocabulary based on
the roberta.large
model.
Name | Base Model | Entity Vocab Size | Params | Download |
---|---|---|---|---|
LUKE-500K (base) | roberta.base | 500K | 253 M | Link |
LUKE-500K (large) | roberta.large | 500K | 483 M | Link |
Reproducing Experimental Results
The experiments were conducted using Python3.7 and PyTorch 1.5.1 installed on a server with a single NVidia V100 GPUs. For computational efficiency, we used mixed precision training based on APEX library which can be installed as follows:
$ git clone https://github.com/NVIDIA/apex.git
$ cd apex
$ git checkout c3fad1ad120b23055f6630da0b029c8b626db78f
$ pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .
The APEX library is not needed if you do not use --fp16
option or reproduce
the results based on the trained checkpoint files.
Relation Classification on TACRED Dataset
Dataset: Link
Checkpoint file (compressed): Link
Using the checkpoint file:
$ python -m examples.cli \
--model-file=luke_large_500k.tar.gz \
--output-dir=<OUTPUT_DIR> \
relation-classification run \
--data-dir=<DATA_DIR> \
--checkpoint-file=<CHECKPOINT_FILE> \
--no-train
Fine-tuning the model:
$ python -m examples.cli \
--model-file=luke_large_500k.tar.gz \
--output-dir=<OUTPUT_DIR> \
relation-classification run \
--data-dir=<DATA_DIR> \
--train-batch-size=4 \
--gradient-accumulation-steps=8 \
--learning-rate=1e-5 \
--num-train-epochs=5 \
--fp16
Relation Detection on TACRED Dataset
Dataset: Link\
Fine-tuning the model:
$ python -m examples.cli \
--model-file=luke_large_500k.tar.gz \
--output-dir=<OUTPUT_DIR> \
relation-detection run \
--data-dir=<DATA_DIR> \
--train-batch-size=4 \
--gradient-accumulation-steps=8 \
--learning-rate=1e-5 \
--num-train-epochs=5 \
--hidden-layer-size=400
--fp16
Citation
If you use LUKE in your work, please cite the original paper:
@inproceedings{yamada2020luke,
title={LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention},
author={Ikuya Yamada and Akari Asai and Hiroyuki Shindo and Hideaki Takeda and Yuji Matsumoto},
booktitle={EMNLP},
year={2020}
}