← all repositories
thunlp/OpenNRE

Relation extraction for the impatient knowledge builder

OpenNRE provides a unified framework to extract structured entity relations from plain text with CNNs or BERT, handling both supervised and distant-supervised settings.

4.5k stars Python ML FrameworksDomain Apps
OpenNRE
Not currently ranked — collecting fresh signals.
star history

What it does OpenNRE is a toolkit for neural relation extraction. Given a sentence and the positions of two entities, it predicts the relation between them—turning Bill Gates founded Microsoft into a structured triple. It supports both sentence-level supervised learning and bag-level distant supervision, aggregating multiple sentences that mention the same entity pair.

The interesting bit The toolkit abstracts away model-specific plumbing, offering a single interface for both CNN-based models (with attention) and BERT. It also ships with several pretrained checkpoints trained on Wiki80 and TACRED, so you can load a model and call infer() immediately without training from scratch.

Key highlights

  • Supports both CNN-based encoders (including CNN-ATT) and pretrained language models like BERT under one interface
  • Handles both supervised sentence-level and distantly supervised bag-level relation extraction
  • Ships with ready-to-use pretrained models for Wiki80 and TACRED datasets
  • Evaluation on NYT10 shows its CNN-ATT implementation slightly outperforms the original paper (AUC 0.333 vs. 0.318)
  • Modular design aimed at researchers who want to swap model components with minimal code changes

Caveats

  • Still source-only; no PyPI package is available yet
  • Datasets and pretrained weights are not bundled and must be fetched separately via provided scripts
  • Requires manual matching of PyTorch and CUDA versions

Verdict Worth exploring if you are building knowledge graphs or need a modular research sandbox for relation extraction. If you want a polished, pip-installable library with bundled weights, look elsewhere for now.

Frequently asked

What is thunlp/OpenNRE?
OpenNRE provides a unified framework to extract structured entity relations from plain text with CNNs or BERT, handling both supervised and distant-supervised settings.
Is OpenNRE open source?
Yes — thunlp/OpenNRE is open source, released under the MIT license.
What language is OpenNRE written in?
thunlp/OpenNRE is primarily written in Python.
How popular is OpenNRE?
thunlp/OpenNRE has 4.5k stars on GitHub.
Where can I find OpenNRE?
thunlp/OpenNRE is on GitHub at https://github.com/thunlp/OpenNRE.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.