OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

Tacred Relation

Tacred Relation is a Python/PyTorch research implementation of position-aware attention RNN and LSTM models for relation extraction using TACRED data. It includes scripts for GloVe and vocabulary preparation, training, test-set evaluation, and saving probability outputs for ensemble experiments.

Independent OpenViST project profile, based on linked sources.

Tacred Relation — OpenViST project profile in AI Models.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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.

Source-based practical guide

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

  1. Download and unzip GloVe vectors using chmod +x download.sh; ./download.sh.

  2. Run the command below.

    Documented command
    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.
Source-based practical guide

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

  1. Run the command below.

    Documented command
    python train.py --data_dir dataset/tacred --vocab_dir dataset/vocab --id 00 --info "Position-aware attention model"
  2. Run the command below to evaluate the default best model.

    Documented command
    python eval.py saved_models/00 --dataset test
  3. Optionally add --out saved_models/out/test1.pkl to 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 --model with a checkpoint filename.
Evidence and transparency

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