All Projects → wang-h → Bert Relation Classification

wang-h / Bert Relation Classification

A pytorch implementation of BERT-based relation classification

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Bert Relation Classification

Kaggle Competitions
There are plenty of courses and tutorials that can help you learn machine learning from scratch but here in GitHub, I want to solve some Kaggle competitions as a comprehensive workflow with python packages. After reading, you can use this workflow to solve other real problems and use it as a template.
Stars: ✭ 86 (-16.5%)
Mutual labels:  classification
Uer Py
Open Source Pre-training Model Framework in PyTorch & Pre-trained Model Zoo
Stars: ✭ 1,295 (+1157.28%)
Mutual labels:  classification
Universal Data Tool
Collaborate & label any type of data, images, text, or documents, in an easy web interface or desktop app.
Stars: ✭ 1,356 (+1216.5%)
Mutual labels:  classification
Ml
A high-level machine learning and deep learning library for the PHP language.
Stars: ✭ 1,270 (+1133.01%)
Mutual labels:  classification
Pytorch Sentiment Classification
LSTM and CNN sentiment analysis
Stars: ✭ 89 (-13.59%)
Mutual labels:  classification
Machine Learning Algorithms
A curated list of almost all machine learning algorithms and deep learning algorithms grouped by category.
Stars: ✭ 92 (-10.68%)
Mutual labels:  classification
Stringlifier
Stringlifier is on Opensource ML Library for detecting random strings in raw text. It can be used in sanitising logs, detecting accidentally exposed credentials and as a pre-processing step in unsupervised ML-based analysis of application text data.
Stars: ✭ 85 (-17.48%)
Mutual labels:  classification
Fastrtext
R wrapper for fastText
Stars: ✭ 103 (+0%)
Mutual labels:  classification
Lossfunctions.jl
Julia package of loss functions for machine learning.
Stars: ✭ 89 (-13.59%)
Mutual labels:  classification
Dataset
Crop/Weed Field Image Dataset
Stars: ✭ 98 (-4.85%)
Mutual labels:  classification
Malware Classification
Towards Building an Intelligent Anti-Malware System: A Deep Learning Approach using Support Vector Machine for Malware Classification
Stars: ✭ 88 (-14.56%)
Mutual labels:  classification
Nlp Journey
Documents, papers and codes related to Natural Language Processing, including Topic Model, Word Embedding, Named Entity Recognition, Text Classificatin, Text Generation, Text Similarity, Machine Translation),etc. All codes are implemented intensorflow 2.0.
Stars: ✭ 1,290 (+1152.43%)
Mutual labels:  classification
R2d2
[ICLR'19] Meta-learning with differentiable closed-form solvers
Stars: ✭ 96 (-6.8%)
Mutual labels:  classification
Pytorch Classification
Classification with PyTorch.
Stars: ✭ 1,268 (+1131.07%)
Mutual labels:  classification
Augmentedgaussianprocesses.jl
Gaussian Process package based on data augmentation, sparsity and natural gradients
Stars: ✭ 99 (-3.88%)
Mutual labels:  classification
Frostnet
FrostNet: Towards Quantization-Aware Network Architecture Search
Stars: ✭ 85 (-17.48%)
Mutual labels:  classification
Tabi
BGP Hijack Detection
Stars: ✭ 90 (-12.62%)
Mutual labels:  classification
Fine grained classification
Fined grained classification On Car dataset
Stars: ✭ 103 (+0%)
Mutual labels:  classification
Segmentation
Tensorflow implementation : U-net and FCN with global convolution
Stars: ✭ 101 (-1.94%)
Mutual labels:  classification
Happy Transformer
A package built on top of Hugging Face's transformer library that makes it easy to utilize state-of-the-art NLP models
Stars: ✭ 97 (-5.83%)
Mutual labels:  classification

A Pytorch Implementation of BERT-based Relation Classification

This is a stable pytorch implementation of Enriching Pre-trained Language Model with Entity Information for Relation Classification https://arxiv.org/abs/1905.08284.

Requirements:

Python version >= 3.6 (recommended)

Pytorch version >= 1.1 (recommended)

pytorch-transformers: https://github.com/huggingface/pytorch-transformers
!!! pytorch-transformers = 1.1

Tutorial of the code

  1. Download the project and prepare the data
> git clone https://github.com/wang-h/bert-relation-classification
> cd bert-relation-classification 
  1. Train the bert-based classification model
> python bert.py --config config.ini
...
09/11/2019 16:36:31 - INFO - pytorch_transformers.modeling_utils -   loading weights file /tmp/semeval/pytorch_model.bin
09/11/2019 16:36:33 - INFO - __main__ -   Loading features from cached file ./dataset/cached_dev_bert-large-uncased_128_semeval
09/11/2019 16:36:33 - INFO - __main__ -   Saving features into cached file ./dataset/cached_dev_bert-large-uncased_128_semeval
09/11/2019 16:36:34 - INFO - __main__ -   ***** Running evaluation  *****
09/11/2019 16:36:34 - INFO - __main__ -     Num examples = 2717
09/11/2019 16:36:34 - INFO - __main__ -     Batch size = 8
Evaluating: 100%|████████████████████████████████████████████████████| 340/340 [00:46<00:00,  7.24it/s]
09/11/2019 16:37:21 - INFO - __main__ -   ***** Eval results  *****  
10/07/2019 10:02:23 - INFO - __main__ -     acc = 0.8579315421420685
10/07/2019 10:02:23 - INFO - __main__ -     acc_and_f1 = 0.8579315421420685
10/07/2019 10:02:23 - INFO - __main__ -     f1 = 0.8579315421420685
  1. Evaluate using the official script for SemEval task-8
> cd eval
> bash test.sh
> cat res.txt
(the result reported in the paper, tensorflow) MACRO-averaged result (excluding Other, uncased-large-model): 89.25 
(this pytorch implementation) MACRO-averaged result (excluding Other, uncased-large-model): 89.25 (same)

I also have the source code written in tensorflow. Feel free to contact me if you need it.

We also appreciate if you could cite our recent paper with the best result (90.36).

Enhancing Relation Extraction Using Syntactic Indicators and Sentential Contexts

https://arxiv.org/abs/1912.01858

or

An Extensible Framework of Leveraging Syntactic Skeleton for Semantic Relation Classification, ACM TALLIP, September 2020

https://dl.acm.org/doi/10.1145/3402885

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].