julianrisch commited on
Commit
de4f1b1
1 Parent(s): 964609e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -12
README.md CHANGED
@@ -27,7 +27,7 @@ model-index:
27
  verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZWRkZWVjMDU2YTcxYWVkZTU1YmUzY2FkNWI5NDJkM2YwMjFmMmE0Njc3MjI5N2Q0NDdhZDNkZWNjMWE5YTRmZiIsInZlcnNpb24iOjF9.ol0Zacd9ZryXazXjgVssGFYG4s5FzbhGGaj1ZEDLVN2ziyzx23bo4GH9PSuGTFxRK2BO5_dxvDupLRqJOF59Bg
28
  ---
29
 
30
- # bert-base-uncased for QA
31
 
32
  ## Overview
33
  **Language model:** bert-base-uncased
@@ -35,6 +35,7 @@ model-index:
35
  **Downstream-task:** Extractive QA
36
  **Training data:** SQuAD 2.0
37
  **Eval data:** SQuAD 2.0
 
38
  **Infrastructure**: 1x Tesla v100
39
 
40
  ## Hyperparameters
@@ -51,6 +52,50 @@ doc_stride=128
51
  max_query_length=64
52
  ```
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  ## Performance
55
  ```
56
  "exact": 73.67977764676156
@@ -62,18 +107,33 @@ max_query_length=64
62
  - Julian Risch: `julian.risch [at] deepset.ai`
63
  - Malte Pietsch: `malte.pietsch [at] deepset.ai`
64
  - Michel Bartels: `michel.bartels [at] deepset.ai`
 
65
  ## About us
66
- ![deepset logo](https://workablehr.s3.amazonaws.com/uploads/account/logo/476306/logo)
67
- We bring NLP to the industry via open source!
68
- Our focus: Industry specific language models & large scale QA systems.
 
 
 
 
 
 
 
 
 
69
 
70
- Some of our work:
71
- - [German BERT (aka "bert-base-german-cased")](https://deepset.ai/german-bert)
72
- - [GermanQuAD and GermanDPR datasets and models (aka "gelectra-base-germanquad", "gbert-base-germandpr")](https://deepset.ai/germanquad)
73
- - [FARM](https://github.com/deepset-ai/FARM)
74
- - [Haystack](https://github.com/deepset-ai/haystack/)
75
-
76
- Get in touch:
77
- [Twitter](https://twitter.com/deepset_ai) | [LinkedIn](https://www.linkedin.com/company/deepset-ai/) | [Discord](https://haystack.deepset.ai/community/join) | [GitHub Discussions](https://github.com/deepset-ai/haystack/discussions) | [Website](https://deepset.ai)
 
 
 
 
 
78
 
79
  By the way: [we're hiring!](http://www.deepset.ai/jobs)
 
27
  verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZWRkZWVjMDU2YTcxYWVkZTU1YmUzY2FkNWI5NDJkM2YwMjFmMmE0Njc3MjI5N2Q0NDdhZDNkZWNjMWE5YTRmZiIsInZlcnNpb24iOjF9.ol0Zacd9ZryXazXjgVssGFYG4s5FzbhGGaj1ZEDLVN2ziyzx23bo4GH9PSuGTFxRK2BO5_dxvDupLRqJOF59Bg
28
  ---
29
 
30
+ # bert-base-uncased for Extractive QA
31
 
32
  ## Overview
33
  **Language model:** bert-base-uncased
 
35
  **Downstream-task:** Extractive QA
36
  **Training data:** SQuAD 2.0
37
  **Eval data:** SQuAD 2.0
38
+ **Code:** See [an example extractive QA pipeline built with Haystack](https://haystack.deepset.ai/tutorials/34_extractive_qa_pipeline)
39
  **Infrastructure**: 1x Tesla v100
40
 
41
  ## Hyperparameters
 
52
  max_query_length=64
53
  ```
54
 
55
+ ## Usage
56
+
57
+ ### In Haystack
58
+ 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.
59
+ To load and run the model with [Haystack](https://github.com/deepset-ai/haystack/):
60
+ ```python
61
+ # After running pip install haystack-ai "transformers[torch,sentencepiece]"
62
+
63
+ from haystack import Document
64
+ from haystack.components.readers import ExtractiveReader
65
+
66
+ docs = [
67
+ Document(content="Python is a popular programming language"),
68
+ Document(content="python ist eine beliebte Programmiersprache"),
69
+ ]
70
+
71
+ reader = ExtractiveReader(model="deepset/bert-base-uncased-squad2")
72
+ reader.warm_up()
73
+
74
+ question = "What is a popular programming language?"
75
+ result = reader.run(query=question, documents=docs)
76
+ # {'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),...)]}
77
+ ```
78
+ 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).
79
+
80
+ ### In Transformers
81
+ ```python
82
+ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
83
+
84
+ model_name = "deepset/bert-base-uncased-squad2"
85
+
86
+ # a) Get predictions
87
+ nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
88
+ QA_input = {
89
+ 'question': 'Why is model conversion important?',
90
+ 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
91
+ }
92
+ res = nlp(QA_input)
93
+
94
+ # b) Load model & tokenizer
95
+ model = AutoModelForQuestionAnswering.from_pretrained(model_name)
96
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
97
+ ```
98
+
99
  ## Performance
100
  ```
101
  "exact": 73.67977764676156
 
107
  - Julian Risch: `julian.risch [at] deepset.ai`
108
  - Malte Pietsch: `malte.pietsch [at] deepset.ai`
109
  - Michel Bartels: `michel.bartels [at] deepset.ai`
110
+
111
  ## About us
112
+
113
+ <div class="grid lg:grid-cols-2 gap-x-4 gap-y-3">
114
+ <div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
115
+ <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" class="w-40"/>
116
+ </div>
117
+ <div class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center">
118
+ <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored.png" class="w-40"/>
119
+ </div>
120
+ </div>
121
+
122
+ [deepset](http://deepset.ai/) is the company behind the production-ready open-source AI framework [Haystack](https://haystack.deepset.ai/).
123
+
124
 
125
+ Some of our other work:
126
+ - [Distilled roberta-base-squad2 (aka "tinyroberta-squad2")](https://huggingface.co/deepset/tinyroberta-squad2)
127
+ - [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)
128
+ - [deepset Cloud](https://www.deepset.ai/deepset-cloud-product)
129
+ - [deepset Studio](https://www.deepset.ai/deepset-studio)
130
+
131
+ ## Get in touch and join the Haystack community
132
+
133
+ <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>.
134
+
135
+ We also have a <strong><a class="h-7" href="https://haystack.deepset.ai/community">Discord community open to everyone!</a></strong></p>
136
+
137
+ [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)
138
 
139
  By the way: [we're hiring!](http://www.deepset.ai/jobs)