The Challenge: If you have two sentences, there are three ways they could be related: one could entail the other, one could contradict the other, or they could be unrelated. Natural Language Inference (NLI) is a popular NLP problem that involves determining how pairs of sentences (consisting of a premise and a hypothesis) are related.
The task is to create an NLI model that assigns labels of 0, 1, or 2 (corresponding to entailment, neutral, and contradiction) to pairs of premises and hypotheses. To make things more interesting, the train and test set include text in fifteen different languages!
For more details: https://www.kaggle.com/competitions/contradictory-my-dear-watson/overview
Create virtual environment with conda
conda create -n nli python=3.8
conda activate nli
And then
pip install -r requirements.txt
bash download_pretrained_model.sh
python bert/feature_engineering.py
python bert/train.py
python bert/inference.py --premise "My own little corner of the world, policy working, is an example." --hypothesis "An example is policy working.,en,English"
or simple with
python bert/inference.py
Train:
python roberta/roberta_train.py
python roberta/roberta_inference.py --premise "<premise>" --hypothesis "<hypothesis>"
python roberta/roberta_inference.py --premise "My own little corner of the world, policy working, is an example." --hypothesis "An example is policy working.,en,English"
or simple with
python roberta/roberta_inference.py
Run app Flask
python app/views.py
Open UI of app: http://127.0.0.1:5000/
Build and run
docker build -t nli:v1 .
docker run -it -p 5000:5000 nli:v1
- Create EC2 instance
- Pull Docker image from docker hub
vnk8071/nli-end-to-end:v1
docker pull vnk8071/nli-end-to-end
docker run -itd -p 80:80 vnk8071/nli-end-to-end:v1
With IPv4 public: http:// With localhost: http://localhost:80