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