Skip to content

lucascassiano/mobileBERT-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MobileBERT-Demo

Based on this MobileBERT repo

What is BERT?

BERT (Bidirectional Encoder Representations from Transformers) is a NLP model from Google AI, published in 2018. BERT can do many things, including what is demoed here: Questions and Answers-> pass any text and ask questions about it.

This demo runs on top of the mobile (lightweight TensorflowLite-based) version. On the demo I just copied the Gameplay info about KSP from wikipedia.

Demo

demo_gif

Running the demo locally

install requirements

  • requires python3.
  • install dependencies:
pip3 install -r requirements.txt

download the Model

Download starter model and vocab and copy it to

./demo/mobilebert/
    + vocab.txt
    + mobilebert_float_20191023.tflite

and you are all set 😉

run server

cd ./demo
python3 main.py
  • Open http://localhost:5000
  • obs:
    • There is a limitation of 384 characters per content string.
    • It's really fast, but not case-sensitive

The OG code

the Original code from gemde001 is extremely simple to use, take a look at it:

  from mobilebert import MobileBERT
  m = MobileBERT()
  answer = m.run(
    "Is KSP a good game?",
    "Kerbal Space Program (KSP) is a sandbox game to build spaceships, it is a good game"
    )

  print(answer)

About

simple BERT demo application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published