Updating readme to reflect usage in Haystack
Browse files
README.md
CHANGED
@@ -33,7 +33,7 @@ model-index:
|
|
33 |
**Downstream-task:** Extractive QA
|
34 |
**Training data:** SQuAD 2.0
|
35 |
**Eval data:** SQuAD 2.0
|
36 |
-
**Code:** See [example
|
37 |
**Infrastructure**: 1x Tesla v100
|
38 |
|
39 |
## Hyperparameters
|
@@ -68,6 +68,14 @@ Evaluated on the SQuAD 2.0 dev set with the [official eval script](https://works
|
|
68 |
|
69 |
## Usage
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
### In Transformers
|
72 |
```python
|
73 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
@@ -87,34 +95,6 @@ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
|
87 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
88 |
```
|
89 |
|
90 |
-
### In FARM
|
91 |
-
|
92 |
-
```python
|
93 |
-
from farm.modeling.adaptive_model import AdaptiveModel
|
94 |
-
from farm.modeling.tokenization import Tokenizer
|
95 |
-
from farm.infer import Inferencer
|
96 |
-
|
97 |
-
model_name = "deepset/minilm-uncased-squad2"
|
98 |
-
|
99 |
-
# a) Get predictions
|
100 |
-
nlp = Inferencer.load(model_name, task_type="question_answering")
|
101 |
-
QA_input = [{"questions": ["Why is model conversion important?"],
|
102 |
-
"text": "The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks."}]
|
103 |
-
res = nlp.inference_from_dicts(dicts=QA_input)
|
104 |
-
|
105 |
-
# b) Load model & tokenizer
|
106 |
-
model = AdaptiveModel.convert_from_transformers(model_name, device="cpu", task_type="question_answering")
|
107 |
-
tokenizer = Tokenizer.load(model_name)
|
108 |
-
```
|
109 |
-
|
110 |
-
### In haystack
|
111 |
-
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/):
|
112 |
-
```python
|
113 |
-
reader = FARMReader(model_name_or_path="deepset/minilm-uncased-squad2")
|
114 |
-
# or
|
115 |
-
reader = TransformersReader(model="deepset/minilm-uncased-squad2",tokenizer="deepset/minilm-uncased-squad2")
|
116 |
-
```
|
117 |
-
|
118 |
|
119 |
## Authors
|
120 |
**Vaishali Pal:** [email protected]
|
@@ -124,17 +104,29 @@ reader = TransformersReader(model="deepset/minilm-uncased-squad2",tokenizer="dee
|
|
124 |
**Tanay Soni:** [email protected]
|
125 |
|
126 |
## About us
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
-
Some of our work:
|
|
|
132 |
- [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
|
133 |
- [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
|
134 |
-
- [FARM](https://github.com/deepset-ai/FARM)
|
135 |
-
- [Haystack](https://github.com/deepset-ai/haystack/)
|
136 |
|
137 |
-
Get in touch
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|
|
|
33 |
**Downstream-task:** Extractive QA
|
34 |
**Training data:** SQuAD 2.0
|
35 |
**Eval data:** SQuAD 2.0
|
36 |
+
**Code:** See an [example QA pipeline on Haystack](https://haystack.deepset.ai/tutorials/01_basic_qa_pipeline)
|
37 |
**Infrastructure**: 1x Tesla v100
|
38 |
|
39 |
## Hyperparameters
|
|
|
68 |
|
69 |
## Usage
|
70 |
|
71 |
+
### In Haystack
|
72 |
+
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/):
|
73 |
+
```python
|
74 |
+
reader = FARMReader(model_name_or_path="deepset/minilm-uncased-squad2")
|
75 |
+
# or
|
76 |
+
reader = TransformersReader(model="deepset/minilm-uncased-squad2",tokenizer="deepset/minilm-uncased-squad2")
|
77 |
+
```
|
78 |
+
|
79 |
### In Transformers
|
80 |
```python
|
81 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
|
|
95 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
96 |
```
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
## Authors
|
100 |
**Vaishali Pal:** [email protected]
|
|
|
104 |
**Tanay Soni:** [email protected]
|
105 |
|
106 |
## About us
|
107 |
+
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
108 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
109 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
|
110 |
+
</div>
|
111 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
112 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored.png" class="w-40"/>
|
113 |
+
</div>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
[deepset](http://deepset.ai/) is the company behind the open-source NLP framework [Haystack](https://haystack.deepset.ai/) which is designed to help you build production ready NLP systems that use: Question answering, summarization, ranking etc.
|
117 |
+
|
118 |
|
119 |
+
Some of our other work:
|
120 |
+
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")]([https://huggingface.co/deepset/tinyroberta-squad2)
|
121 |
- [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
|
122 |
- [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
|
|
|
|
|
123 |
|
124 |
+
## Get in touch and join the Haystack community
|
125 |
+
|
126 |
+
<p>For more info on Haystack, visit our <strong><a href="https://github.com/deepset-ai/haystack">GitHub</a></strong> repo and <strong><a href="https://docs.haystack.deepset.ai">Documentation</a></strong>.
|
127 |
+
|
128 |
+
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
|
129 |
+
|
130 |
+
[Twitter](https://twitter.com/deepset_ai) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Discord](https://haystack.deepset.ai/community) | [GitHub Discussions](https://github.com/deepset-ai/haystack/discussions) | [Website](https://deepset.ai)
|
131 |
|
132 |
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|