Giter Site home page Giter Site logo

emotion-detection-bert's Introduction

LICENSE

Emotion Detection using BERT

This is fine-tuning of Google BERT model [paper] in Pytorch-lightning. With emotion detection task based on Emotion HuggingFace Dataset , an available onnx version and docker image for the model contains flask application as a demo for the model.

BERT 2018 BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding Paper URL : https://arxiv.org/abs/1810.04805

Installation

  • Programming language

    • Python 3.6
  • Operating system

    • Ubuntu 20.04.4 LTS (64 bit)
  • Install Required packages

    • pip install -r requirements.txt
      

Inference

Download checkpoints

  • Available Checkpoints are trained on Emotion Dataset.
Name gdrive id Size
best-checkpoint.ckpt 1l5zGZyldWU-rPaWRFvdtc7Yurw7cEDZo 1.2GB
model.onnx 1BnOF_ZYDq7XmY_haBfddPo7Fc46dcm0f 413.3MB
  • You can download the model that you need by running this command
gdown --id <gdrive id>

Pytorch inference

To run inference download best-checkpoint.ckpt in models directory and run this command.

python3 inference.py --sentence <Your sentence here>

Onnx inference

To run inference in onnx download model.onnx in models directory and run this command.

python3 onnx_inference.py --sentence <Your sentence here>

Or you can generate model.onnx from best-checpoint.ckpt by run:

python3 to_onnx.py

Demo

You can run the demo app by build the docker image by

    sudo docker build -t emotion-detection-bert .

and then run the image to initiate the app

    sudo docker run -p 5000:5000 emotion-detection-bert:latest

Training

After installing the requirements, in order to train the model update model configuration to meet your needs and simply run:

!python train.py

Citation

@article{devlin2018bert,
  title={BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding},
  author={Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina},
  journal={arXiv preprint arXiv:1810.04805},
  year={2018}
}

emotion-detection-bert's People

Contributors

muhammedashraf2020 avatar

Stargazers

Aya Elfeky  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.