-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New model: BERT-Squad #190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renaming onnx files bert.onnx to bertsquad.onnx
@kundanapillari ONNX needs more BERT related pre-trained models (e.g. other languages) This BERT-Squad works perfectly with Microsoft ML.NET |
@kundanapillari Can someone show how to get this work? PyTorch to ONNX For PyTorch, example of exporting ONNX model and inference using ONNX Runtime: This has been solved! thanks = 18th Nov. |
* Added bert-squad model and dependencies * Fixed README.md table * Added bert-squad notebook * Added bert-squad notebook * Delete BERT-Squad.ipynb * Added notebook * Updated README.md * Fixed file path * Updated input, output, and preprocessing sections * Added License information * Updated README.md * Updated README.md and added sample file * Updated README.md * Updated Readme.md * Changed Inference * Updated main README.md * Updated onnx version and opset * Made requested changes * Changed Metric * Reverted changes * Reverted changes * Added files * Fixed changes * Changed README.md * Changed onnx file names
BERT-Squad
Use-cases
This model answers questions based on the context of the given input paragraph.
Description
BERT (Bidirectional Encoder Representations from Transformers) applies Transformers, a popular attention model, to language modelling. This mechanism has an encoder to read the input text and a decoder that produces a prediction for the task. This model uses the technique of masking out some of the words in the input and then condition each word bidirectionally to predict the masked words. BERT also learns to model relationships between sentences, predicts if the sentences are connected or not.
Model
Dependencies
Inference
We used ONNX Runtime to perform the inference.
Input
The input is a paragraph and questions relating to that paragraph. The model uses WordPiece tokenisation method to split the input text into list of tokens that are available in the vocabulary (30,522 words).
Then converts these tokens into features
Preprocessing
Write an inputs.json file that includes the context paragraph and questions.
Get parameters and convert input examples into features
Output
For each question about the context paragraph, the model predicts a start and an end token from the paragraph that most likely answers the questions.
Postprocessing
Write the predictions (answers to the questions) in a file.
Dataset (Train and Validation)
The model is trained with SQuAD v1.1 dataset that contains 100,000+ question-answer pairs on 500+ articles.
Validation accuracy
Metric is Exact Matching (EM) of 80.7, computed over SQuAD v1.1 dev data, for this onnx model.
Training
Fine-tuned the model using SQuAD-1.1 dataset. Look at BertTutorial.ipynb for more information for converting the model from tensorflow to onnx and for fine-tuning.
References
BERT Model from the paper BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
BERTtutorial
Contributors
Kundana Pillari
License
Apache 2.0