Update README.md
Browse files
README.md
CHANGED
|
@@ -5,4 +5,30 @@ language:
|
|
| 5 |
- en
|
| 6 |
library_name: transformers
|
| 7 |
pipeline_tag: question-answering
|
| 8 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
- en
|
| 6 |
library_name: transformers
|
| 7 |
pipeline_tag: question-answering
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Mobile-Bert fine-tuned on Squad V2 dataset
|
| 11 |
+
|
| 12 |
+
This is based on mobile bert architecture suitable for handy devices or device with low resources.
|
| 13 |
+
|
| 14 |
+
## usage
|
| 15 |
+
|
| 16 |
+
using transformers library first load model and Tokenizer
|
| 17 |
+
```
|
| 18 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 19 |
+
|
| 20 |
+
model_name = "aware-ai/mobilebert-squadv2"
|
| 21 |
+
|
| 22 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 23 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 24 |
+
```
|
| 25 |
+
use question answering pipeline
|
| 26 |
+
|
| 27 |
+
```
|
| 28 |
+
qa_engine = pipeline('question-answering', model=model, tokenizer=tokenizer)
|
| 29 |
+
QA_input = {
|
| 30 |
+
'question': 'your question?',
|
| 31 |
+
'context': '. your context ................ '
|
| 32 |
+
}
|
| 33 |
+
res = qa_engine (QA_input)
|
| 34 |
+
```
|