
# all-MiniLM-L12-v2-qa-all
This model is an extractive qa model.
It's a fine-tuned version of [all-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L12-v2) on the following datasets: [squad_v2](https://huggingface.co/datasets/squad_v2), [LLukas22/nq-simplified](https://huggingface.co/datasets/LLukas22/nq-simplified), [newsqa](https://huggingface.co/datasets/newsqa), [LLukas22/NLQuAD](https://huggingface.co/datasets/LLukas22/NLQuAD), [deepset/germanquad](https://huggingface.co/datasets/deepset/germanquad).



## Usage

You can use the model like this:

```python
from transformers import pipeline

#Make predictions
model_name = "LLukas22/all-MiniLM-L12-v2-qa-all"
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)

QA_input = {
    "question": "What's my name?",
    "context": "My name is Clara and I live in Berkeley."
}

result = nlp(QA_input)
print(result)
```
Alternatively you can load the model and tokenizer on their own:
```python
from transformers import AutoModelForQuestionAnswering, AutoTokenizer

#Make predictions
model_name = "LLukas22/all-MiniLM-L12-v2-qa-all"
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
```

## Training hyperparameters
The following hyperparameters were used during training:

- learning_rate: 2E-05
- per device batch size: 60
- effective batch size: 180
- seed: 42
- optimizer: AdamW with betas (0.9,0.999) and eps 1E-08
- weight decay: 1E-02
- D-Adaptation: False
- Warmup: True
- number of epochs: 15
- mixed_precision_training: bf16

## Training results
| Epoch | Train Loss | Validation Loss |
| ----- | ---------- | --------------- |
| 0 | 3.76 | 3.02 |
| 1 | 2.57 | 2.23 |
| 2 | 2.2 | 2.08 |
| 3 | 2.07 | 2.03 |
| 4 | 1.96 | 1.97 |
| 5 | 1.87 | 1.93 |
| 6 | 1.81 | 1.91 |
| 7 | 1.77 | 1.89 |
| 8 | 1.73 | 1.89 |
| 9 | 1.7 | 1.9 |
| 10 | 1.68 | 1.9 |
| 11 | 1.67 | 1.9 |

## Evaluation results
| Epoch | f1 | exact_match |
| ----- | ----- | ----- |
| 0 | 0.29 | 0.228 |
| 1 | 0.371 | 0.329 |
| 2 | 0.413 | 0.369 |
| 3 | 0.437 | 0.376 |
| 4 | 0.454 | 0.388 |
| 5 | 0.468 | 0.4 |
| 6 | 0.479 | 0.408 |
| 7 | 0.487 | 0.415 |
| 8 | 0.495 | 0.421 |
| 9 | 0.501 | 0.416 |
| 10 | 0.506 | 0.42 |
| 11 | 0.51 | 0.421 |

## Framework versions
- Transformers: 4.25.1
- PyTorch: 2.0.0.dev20230210+cu118
- PyTorch Lightning: 1.8.6
- Datasets: 2.7.1
- Tokenizers: 0.13.1
- Sentence Transformers: 2.2.2

## Additional Information
This model was trained as part of my Master's Thesis **'Evaluation of transformer based language models for use in service information systems'**. The source code is available on [Github](https://github.com/LLukas22/Retrieval-Augmented-QA).
{"language": ["en", "de"], "license": "apache-2.0", "tags": ["question-answering", "transformers", "generated_from_trainer"], "datasets": ["squad_v2", "LLukas22/nq-simplified", "newsqa", "LLukas22/NLQuAD", "deepset/germanquad"], "pipeline_tag": "question-answering"}
transformers pytorch tensorboard safetensors bert question-answering generated_from_trainer en de dataset:squad_v2 dataset:LLukas22/nq-simplified dataset:newsqa dataset:LLukas22/NLQuAD dataset:deepset/germanquad license:apache-2.0 endpoints_compatible region:us
TAGS
#transformers #pytorch #tensorboard #safetensors #bert #question-answering #generated_from_trainer #en #de #dataset-squad_v2 #dataset-LLukas22/nq-simplified #dataset-newsqa #dataset-LLukas22/NLQuAD #dataset-deepset/germanquad #license-apache-2.0 #endpoints_compatible #region-us 

all-MiniLM-L12-v2-qa-all
========================


This model is an extractive qa model.
It's a fine-tuned version of all-MiniLM-L12-v2 on the following datasets: squad\_v2, LLukas22/nq-simplified, newsqa, LLukas22/NLQuAD, deepset/germanquad.


Usage
-----


You can use the model like this:


Alternatively you can load the model and tokenizer on their own:


Training hyperparameters
------------------------


The following hyperparameters were used during training:


* learning\_rate: 2E-05
* per device batch size: 60
* effective batch size: 180
* seed: 42
* optimizer: AdamW with betas (0.9,0.999) and eps 1E-08
* weight decay: 1E-02
* D-Adaptation: False
* Warmup: True
* number of epochs: 15
* mixed\_precision\_training: bf16


Training results
----------------


Epoch: 0, Train Loss: 3.76, Validation Loss: 3.02
Epoch: 1, Train Loss: 2.57, Validation Loss: 2.23
Epoch: 2, Train Loss: 2.2, Validation Loss: 2.08
Epoch: 3, Train Loss: 2.07, Validation Loss: 2.03
Epoch: 4, Train Loss: 1.96, Validation Loss: 1.97
Epoch: 5, Train Loss: 1.87, Validation Loss: 1.93
Epoch: 6, Train Loss: 1.81, Validation Loss: 1.91
Epoch: 7, Train Loss: 1.77, Validation Loss: 1.89
Epoch: 8, Train Loss: 1.73, Validation Loss: 1.89
Epoch: 9, Train Loss: 1.7, Validation Loss: 1.9
Epoch: 10, Train Loss: 1.68, Validation Loss: 1.9
Epoch: 11, Train Loss: 1.67, Validation Loss: 1.9


Evaluation results
------------------


Epoch: 0, f1: 0.29, exact\_match: 0.228
Epoch: 1, f1: 0.371, exact\_match: 0.329
Epoch: 2, f1: 0.413, exact\_match: 0.369
Epoch: 3, f1: 0.437, exact\_match: 0.376
Epoch: 4, f1: 0.454, exact\_match: 0.388
Epoch: 5, f1: 0.468, exact\_match: 0.4
Epoch: 6, f1: 0.479, exact\_match: 0.408
Epoch: 7, f1: 0.487, exact\_match: 0.415
Epoch: 8, f1: 0.495, exact\_match: 0.421
Epoch: 9, f1: 0.501, exact\_match: 0.416
Epoch: 10, f1: 0.506, exact\_match: 0.42
Epoch: 11, f1: 0.51, exact\_match: 0.421


Framework versions
------------------


* Transformers: 4.25.1
* PyTorch: 2.0.0.dev20230210+cu118
* PyTorch Lightning: 1.8.6
* Datasets: 2.7.1
* Tokenizers: 0.13.1
* Sentence Transformers: 2.2.2


Additional Information
----------------------


This model was trained as part of my Master's Thesis 'Evaluation of transformer based language models for use in service information systems'. The source code is available on Github.



TAGS
#transformers #pytorch #tensorboard #safetensors #bert #question-answering #generated_from_trainer #en #de #dataset-squad_v2 #dataset-LLukas22/nq-simplified #dataset-newsqa #dataset-LLukas22/NLQuAD #dataset-deepset/germanquad #license-apache-2.0 #endpoints_compatible #region-us 

TAGS
#transformers #pytorch #tensorboard #safetensors #bert #question-answering #generated_from_trainer #en #de #dataset-squad_v2 #dataset-LLukas22/nq-simplified #dataset-newsqa #dataset-LLukas22/NLQuAD #dataset-deepset/germanquad #license-apache-2.0 #endpoints_compatible #region-us 
