Update README.md
Browse files
README.md
CHANGED
@@ -46,11 +46,20 @@ on relevant data.
|
|
46 |
## Use in transformers:
|
47 |
|
48 |
```python
|
49 |
-
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
|
50 |
|
51 |
tokenizer = AutoTokenizer.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
|
52 |
|
53 |
model = AutoModelForQuestionAnswering.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
```
|
55 |
|
56 |
## Citation
|
|
|
46 |
## Use in transformers:
|
47 |
|
48 |
```python
|
49 |
+
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline
|
50 |
|
51 |
tokenizer = AutoTokenizer.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
|
52 |
|
53 |
model = AutoModelForQuestionAnswering.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
|
54 |
+
|
55 |
+
qa_pipeline = pipeline('question-answering', model=model, tokenizer=tokenizer)
|
56 |
+
|
57 |
+
qa_input = {
|
58 |
+
'context': 'Yes. No. I want a cheap flight to Boston.',
|
59 |
+
'question': 'What is the destination?'
|
60 |
+
}
|
61 |
+
|
62 |
+
answer = qa_pipeline(qa_input)
|
63 |
```
|
64 |
|
65 |
## Citation
|