Tuana commited on
Commit
551211e
1 Parent(s): 4896bcd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -29
README.md CHANGED
@@ -82,6 +82,14 @@ Evaluated on German [XQuAD: xquad.de.json](https://github.com/deepmind/xquad)
82
 
83
  ## Usage
84
 
 
 
 
 
 
 
 
 
85
  ### In Transformers
86
  ```python
87
  from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
@@ -101,35 +109,6 @@ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
101
  tokenizer = AutoTokenizer.from_pretrained(model_name)
102
  ```
103
 
104
- ### In FARM
105
-
106
- ```python
107
- from farm.modeling.adaptive_model import AdaptiveModel
108
- from farm.modeling.tokenization import Tokenizer
109
- from farm.infer import QAInferencer
110
-
111
- model_name = "deepset/xlm-roberta-large-squad2"
112
-
113
- # a) Get predictions
114
- nlp = QAInferencer.load(model_name)
115
- QA_input = [{"questions": ["Why is model conversion important?"],
116
- "text": "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."}]
117
- res = nlp.inference_from_dicts(dicts=QA_input, rest_api_schema=True)
118
-
119
- # b) Load model & tokenizer
120
- model = AdaptiveModel.convert_from_transformers(model_name, device="cpu", task_type="question_answering")
121
- tokenizer = Tokenizer.load(model_name)
122
- ```
123
-
124
- ### In haystack
125
- For doing QA at scale (i.e. many docs instead of single paragraph), you can load the model also in [haystack](https://github.com/deepset-ai/haystack/):
126
- ```python
127
- reader = FARMReader(model_name_or_path="deepset/xlm-roberta-large-squad2")
128
- # or
129
- reader = TransformersReader(model="deepset/xlm-roberta-large-squad2",tokenizer="deepset/xlm-roberta-large-squad2")
130
- ```
131
-
132
-
133
  ## Authors
134
  **Branden Chan:** [email protected]
135
  **Timo Möller:** [email protected]
 
82
 
83
  ## Usage
84
 
85
+ ### In Haystack
86
+ For doing QA at scale (i.e. many docs instead of single paragraph), you can load the model also in [haystack](https://github.com/deepset-ai/haystack/):
87
+ ```python
88
+ reader = FARMReader(model_name_or_path="deepset/xlm-roberta-large-squad2")
89
+ # or
90
+ reader = TransformersReader(model="deepset/xlm-roberta-large-squad2",tokenizer="deepset/xlm-roberta-large-squad2")
91
+ ```
92
+
93
  ### In Transformers
94
  ```python
95
  from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
 
109
  tokenizer = AutoTokenizer.from_pretrained(model_name)
110
  ```
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  ## Authors
113
  **Branden Chan:** [email protected]
114
  **Timo Möller:** [email protected]