Practical overview
When it fits
Use it when you need research code and scripts for training or evaluating relation-extraction models with TACRED data, rather than a hosted extraction service.
Who it is for
- Researchers studying relation extraction and slot filling.
- Developers training or evaluating neural relation-extraction models on TACRED data.
Documented uses
- Prepare vocabulary and initial word vectors from TACRED data and GloVe.
- Train a position-aware attention RNN or an LSTM model.
- Evaluate a saved checkpoint on a test set.
- Write model probability outputs for downstream ensemble experiments.
Requirements & limits
The repository is public and identifies the code as licensed under Apache License 2.0. The README lists Python 3 and PyTorch as requirements and notes Python 3.6.2 and PyTorch 1.0.0 as tested versions.
- The workflow depends on TACRED data and a separately prepared vocabulary and word-vector directory.
- GloVe download uses the included script; unzip and wget are listed for downloading.
- The training script performs word dropout and entity masking automatically.
- Evaluation defaults to best_model.pt and can accept a specified checkpoint.
- Probability-file output is documented for ensemble use, with an example ensemble script referenced separately.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Prepare vocabulary and initial word vectors
Create the vocabulary and GloVe-based word-vector matrix required by the documented training workflow.
Before you start
- Python 3
- unzip and wget for downloading
- TACRED data at dataset/tacred
- The repository's download.sh script
Steps
Download and unzip GloVe vectors using
chmod +x download.sh; ./download.sh.Run the command below.
python prepare_vocab.py dataset/tacred dataset/vocab --glove_dir dataset/glove
Expected outcome
Vocabulary and initial word vectors are written as a NumPy matrix in dataset/vocab.
Guide limitations
- This guide covers preparation only; training is a separate documented stage.
- The README identifies Python 3.6.2 and PyTorch 1.0.0 as tested versions.
Train and evaluate a position-aware attention model
Train the documented RNN model and evaluate its checkpoint on the TACRED test set.
Before you start
- Python 3 and PyTorch
- TACRED data in dataset/tacred
- Prepared vocabulary and word vectors in dataset/vocab
Steps
Run the command below.
python train.py --data_dir dataset/tacred --vocab_dir dataset/vocab --id 00 --info "Position-aware attention model"Run the command below to evaluate the default best model.
python eval.py saved_models/00 --dataset testOptionally add
--out saved_models/out/test1.pklto save model probability outputs.
Expected outcome
Training saves model checkpoints and logs; evaluation runs on the test set and can write probability outputs for ensemble use.
Guide limitations
- The README does not specify an expected score or runtime.
- For a different checkpoint, the evaluation command accepts
--modelwith a checkpoint filename.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- yuhaozhang/tacred-relation · Official homepage title · retained in its source language

