Update README
Browse files
README.md
CHANGED
@@ -17,12 +17,13 @@ The model is used for extractive question answering. You can download the model
|
|
17 |
You can use the model directly with a pipeline for extractive question answering:
|
18 |
|
19 |
```python
|
20 |
-
>>> from transformers import pipeline
|
21 |
-
>>>
|
22 |
-
>>>
|
23 |
-
>>>
|
24 |
-
>>>
|
25 |
-
|
|
|
26 |
```
|
27 |
|
28 |
## Training data
|
|
|
17 |
You can use the model directly with a pipeline for extractive question answering:
|
18 |
|
19 |
```python
|
20 |
+
>>> from transformers import AutoModelForQuestionAnswering,AutoTokenizer,pipeline
|
21 |
+
>>> model = AutoModelForQuestionAnswering.from_pretrained('uer/roberta-base-chinese-extractive-qa')
|
22 |
+
>>> tokenizer = AutoTokenizer.from_pretrained('uer/roberta-base-chinese-extractive-qa')
|
23 |
+
>>> QA = pipeline('question-answering', model=model, tokenizer=tokenizer)
|
24 |
+
>>> QA_input = {'question': "著名诗歌《假如生活欺骗了你》的作者是",'context': "普希金从那里学习人民的语言,吸取了许多有益的养料,这一切对普希金后来的创作产生了很大的影响。这两年里,普希金创作了不少优秀的作品,如《囚徒》、《致大海》、《致凯恩》和《假如生活欺骗了你》等几十首抒情诗,叙事诗《努林伯爵》,历史剧《鲍里斯·戈都诺夫》,以及《叶甫盖尼·奥涅金》前六章。"}
|
25 |
+
>>> QA(QA_input)
|
26 |
+
{'score': 0.9766426682472229, 'start': 0, 'end': 3, 'answer': '普希金'}
|
27 |
```
|
28 |
|
29 |
## Training data
|