julianrisch
commited on
Commit
•
c16378c
1
Parent(s):
232be0e
Update README.md
Browse files
README.md
CHANGED
@@ -8,13 +8,15 @@ tags:
|
|
8 |
- exbert
|
9 |
---
|
10 |
|
11 |
-
|
|
|
12 |
|
13 |
## Overview
|
14 |
**Language model:** gelectra-large-germanquad
|
15 |
**Language:** German
|
16 |
**Training data:** GermanQuAD train set (~ 12MB)
|
17 |
**Eval data:** GermanQuAD test set (~ 5MB)
|
|
|
18 |
**Infrastructure**: 1x V100 GPU
|
19 |
**Published**: Apr 21st, 2021
|
20 |
|
@@ -34,6 +36,52 @@ learning_rate = 3e-5
|
|
34 |
lr_schedule = LinearWarmup
|
35 |
embeds_dropout_prob = 0.1
|
36 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
## Performance
|
38 |
We evaluated the extractive question answering performance on our GermanQuAD test set.
|
39 |
Model types and training data are included in the model name.
|
@@ -48,29 +96,29 @@ The human baseline was computed for the 3-way test set by taking one answer as p
|
|
48 |
**Malte Pietsch:** malte.pietsch@deepset.ai
|
49 |
|
50 |
## About us
|
|
|
51 |
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
52 |
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
53 |
-
<img alt="" src="https://
|
54 |
</div>
|
55 |
-
|
56 |
-
<img alt="" src="https://
|
57 |
</div>
|
58 |
</div>
|
59 |
|
60 |
-
[deepset](http://deepset.ai/) is the company behind the open-source
|
61 |
-
|
62 |
|
63 |
Some of our other work:
|
64 |
-
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](
|
65 |
-
- [German BERT
|
66 |
-
- [
|
67 |
|
68 |
## Get in touch and join the Haystack community
|
69 |
|
70 |
-
<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://haystack.deepset.ai">Documentation</a></strong>.
|
71 |
|
72 |
-
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community
|
73 |
|
74 |
-
[Twitter](https://twitter.com/
|
75 |
|
76 |
-
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|
|
|
8 |
- exbert
|
9 |
---
|
10 |
|
11 |
+
# gelectra-large for Extractive QA
|
12 |
+
|
13 |
|
14 |
## Overview
|
15 |
**Language model:** gelectra-large-germanquad
|
16 |
**Language:** German
|
17 |
**Training data:** GermanQuAD train set (~ 12MB)
|
18 |
**Eval data:** GermanQuAD test set (~ 5MB)
|
19 |
+
**Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
|
20 |
**Infrastructure**: 1x V100 GPU
|
21 |
**Published**: Apr 21st, 2021
|
22 |
|
|
|
36 |
lr_schedule = LinearWarmup
|
37 |
embeds_dropout_prob = 0.1
|
38 |
```
|
39 |
+
|
40 |
+
|
41 |
+
## Usage
|
42 |
+
|
43 |
+
### In Haystack
|
44 |
+
Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents.
|
45 |
+
To load and run the model with [Haystack](https://github.com/deepset-ai/haystack/):
|
46 |
+
```python
|
47 |
+
# After running pip install haystack-ai "transformers[torch,sentencepiece]"
|
48 |
+
|
49 |
+
from haystack import Document
|
50 |
+
from haystack.components.readers import ExtractiveReader
|
51 |
+
|
52 |
+
docs = [
|
53 |
+
Document(content="Python is a popular programming language"),
|
54 |
+
Document(content="python ist eine beliebte Programmiersprache"),
|
55 |
+
]
|
56 |
+
|
57 |
+
reader = ExtractiveReader(model="deepset/gelectra-large-germanquad")
|
58 |
+
reader.warm_up()
|
59 |
+
|
60 |
+
question = "What is a popular programming language?"
|
61 |
+
result = reader.run(query=question, documents=docs)
|
62 |
+
# {'answers': [ExtractedAnswer(query='What is a popular programming language?', score=0.5740374326705933, data='python', document=Document(id=..., content: '...'), context=None, document_offset=ExtractedAnswer.Span(start=0, end=6),...)]}
|
63 |
+
```
|
64 |
+
For a complete example with an extractive question answering pipeline that scales over many documents, check out the [corresponding Haystack tutorial](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline).
|
65 |
+
|
66 |
+
### In Transformers
|
67 |
+
```python
|
68 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
69 |
+
|
70 |
+
model_name = "deepset/gelectra-large-germanquad"
|
71 |
+
|
72 |
+
# a) Get predictions
|
73 |
+
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
74 |
+
QA_input = {
|
75 |
+
'question': 'Why is model conversion important?',
|
76 |
+
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
77 |
+
}
|
78 |
+
res = nlp(QA_input)
|
79 |
+
|
80 |
+
# b) Load model & tokenizer
|
81 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
82 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
83 |
+
```
|
84 |
+
|
85 |
## Performance
|
86 |
We evaluated the extractive question answering performance on our GermanQuAD test set.
|
87 |
Model types and training data are included in the model name.
|
|
|
96 |
**Malte Pietsch:** malte.pietsch@deepset.ai
|
97 |
|
98 |
## About us
|
99 |
+
|
100 |
<div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
|
101 |
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
102 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
|
103 |
</div>
|
104 |
+
<div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
|
105 |
+
<img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored.png" class="w-40"/>
|
106 |
</div>
|
107 |
</div>
|
108 |
|
109 |
+
[deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
|
|
|
110 |
|
111 |
Some of our other work:
|
112 |
+
- [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
|
113 |
+
- [German BERT](https://deepset.ai/german-bert), [GermanQuAD and GermanDPR](https://deepset.ai/germanquad), [German embedding model](https://huggingface.co/mixedbread-ai/deepset-mxbai-embed-de-large-v1)
|
114 |
+
- [deepset Cloud](https://www.deepset.ai/deepset-cloud-product), [deepset Studio](https://www.deepset.ai/deepset-studio)
|
115 |
|
116 |
## Get in touch and join the Haystack community
|
117 |
|
118 |
+
<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>.
|
119 |
|
120 |
+
We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
|
121 |
|
122 |
+
[Twitter](https://twitter.com/Haystack_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://haystack.deepset.ai/) | [YouTube](https://www.youtube.com/@deepset_ai)
|
123 |
|
124 |
+
By the way: [we're hiring!](http://www.deepset.ai/jobs)
|