Skip to content

Finetuning BERT to classify textual entailment on the Stanford NLI corpus.

Notifications You must be signed in to change notification settings

ElianBelot/natural_language_inference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Natural Language Inference with PyTorch

Finetuning BERT to classify textual entailment on the Stanford NLI corpus.


About

This project is a PyTorch and HuggingFace-based toolkit for the Natural Language Inference (NLI) task. The Stanford NLI corpus is used, featuring 570k human-written English sentence pairs each labeled as 'entailment', 'contradiction', or 'neutral'.


Models

The main model is a BERT transformer finetuned on the task. Other models are also available for experimentation:

  • Pooled Logistic Regression
  • Shallow Neural Network
  • Deep Neural Network

Each model is fine-tuned to work with token embeddings and gives classification scores for the three NLI labels.


Usage

Run the main script with various command-line arguments to specify the model, number of epochs, and other settings.

python main.py --model=shallow --epochs=5 --device=cuda --batch_size=64 --embedding_dim=128

Built with...

About

Finetuning BERT to classify textual entailment on the Stanford NLI corpus.

Topics

Resources

Stars

Watchers

Forks

Languages