julianrisch commited on
Commit
3e350aa
·
verified ·
1 Parent(s): fe064ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -7
README.md CHANGED
@@ -8,7 +8,7 @@ tags:
8
  - exbert
9
  ---
10
 
11
- ![bert_image](https://thumb.tildacdn.com/tild3433-3637-4830-a533-353833613061/-/resize/720x/-/format/webp/germanquad.jpg)
12
 
13
  ## Overview
14
  **Language model:** gelectra-base-germanquad
@@ -16,6 +16,7 @@ tags:
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
 
21
  ## Details
@@ -34,6 +35,51 @@ 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,6 +94,7 @@ The human baseline was computed for the 3-way test set by taking one answer as p
48
  **Malte Pietsch:** [email protected]
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://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
@@ -57,13 +104,12 @@ The human baseline was computed for the 3-way test set by taking one answer as p
57
  </div>
58
  </div>
59
 
60
- [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.
61
-
62
 
63
  Some of our other work:
64
- - [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")]([https://huggingface.co/deepset/tinyroberta-squad2)
65
- - [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
66
- - [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
67
 
68
  ## Get in touch and join the Haystack community
69
 
@@ -71,6 +117,6 @@ Some of our other work:
71
 
72
  We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
73
 
74
- [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)
75
 
76
  By the way: [we're hiring!](http://www.deepset.ai/jobs)
 
8
  - exbert
9
  ---
10
 
11
+ # gelectra-base for Extractive QA
12
 
13
  ## Overview
14
  **Language model:** gelectra-base-germanquad
 
16
  **Training data:** GermanQuAD train set (~ 12MB)
17
  **Eval data:** GermanQuAD test set (~ 5MB)
18
  **Infrastructure**: 1x V100 GPU
19
+ **Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
20
  **Published**: Apr 21st, 2021
21
 
22
  ## Details
 
35
  lr_schedule = LinearWarmup
36
  embeds_dropout_prob = 0.1
37
  ```
38
+
39
+ ## Usage
40
+
41
+ ### In Haystack
42
+ 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.
43
+ To load and run the model with [Haystack](https://github.com/deepset-ai/haystack/):
44
+ ```python
45
+ # After running pip install haystack-ai "transformers[torch,sentencepiece]"
46
+
47
+ from haystack import Document
48
+ from haystack.components.readers import ExtractiveReader
49
+
50
+ docs = [
51
+ Document(content="Python is a popular programming language"),
52
+ Document(content="python ist eine beliebte Programmiersprache"),
53
+ ]
54
+
55
+ reader = ExtractiveReader(model="deepset/roberta-base-squad2")
56
+ reader.warm_up()
57
+
58
+ question = "What is a popular programming language?"
59
+ result = reader.run(query=question, documents=docs)
60
+ # {'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),...)]}
61
+ ```
62
+ 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).
63
+
64
+ ### In Transformers
65
+ ```python
66
+ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
67
+
68
+ model_name = "deepset/roberta-base-squad2"
69
+
70
+ # a) Get predictions
71
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
72
+ QA_input = {
73
+ 'question': 'Why is model conversion important?',
74
+ 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
75
+ }
76
+ res = nlp(QA_input)
77
+
78
+ # b) Load model & tokenizer
79
+ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
80
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
81
+ ```
82
+
83
  ## Performance
84
  We evaluated the extractive question answering performance on our GermanQuAD test set.
85
  Model types and training data are included in the model name.
 
94
  **Malte Pietsch:** [email protected]
95
 
96
  ## About us
97
+
98
  <div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
99
  <div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
100
  <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
 
104
  </div>
105
  </div>
106
 
107
+ [deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
 
108
 
109
  Some of our other work:
110
+ - [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
111
+ - [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)
112
+ - [deepset Cloud](https://www.deepset.ai/deepset-cloud-product), [deepset Studio](https://www.deepset.ai/deepset-studio)
113
 
114
  ## Get in touch and join the Haystack community
115
 
 
117
 
118
  We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
119
 
120
+ [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)
121
 
122
  By the way: [we're hiring!](http://www.deepset.ai/jobs)