|
--- |
|
license: mit |
|
datasets: |
|
- squad_v2 |
|
- squad |
|
language: |
|
- en |
|
library_name: transformers |
|
tags: |
|
- deberta |
|
- deberta-v3 |
|
- question-answering |
|
- squad |
|
- squad_v2 |
|
model-index: |
|
- name: sjrhuschlee/deberta-v3-large-squad2 |
|
results: |
|
- task: |
|
type: question-answering |
|
name: Question Answering |
|
dataset: |
|
name: squad_v2 |
|
type: squad_v2 |
|
config: squad_v2 |
|
split: validation |
|
metrics: |
|
- type: exact_match |
|
value: 87.956 |
|
name: Exact Match |
|
- type: f1 |
|
value: 90.776 |
|
name: F1 |
|
- task: |
|
type: question-answering |
|
name: Question Answering |
|
dataset: |
|
name: squad |
|
type: squad |
|
config: plain_text |
|
split: validation |
|
metrics: |
|
- type: exact_match |
|
value: 89.290 |
|
name: Exact Match |
|
- type: f1 |
|
value: 94.985 |
|
name: F1 |
|
--- |
|
|
|
# deberta-v3-large for Extractive QA |
|
|
|
This is the [deberta-v3-large](https://huggingface.co/microsoft/deberta-v3-large) model, fine-tuned using the [SQuAD2.0](https://huggingface.co/datasets/squad_v2) dataset. It's been trained on question-answer pairs, including unanswerable questions, for the task of Extractive Question Answering. |
|
|
|
This model was trained using LoRA available through the [PEFT library](https://github.com/huggingface/peft). |
|
|
|
## Overview |
|
**Language model:** deberta-v3-large |
|
**Language:** English |
|
**Downstream-task:** Extractive QA |
|
**Training data:** SQuAD 2.0 |
|
**Eval data:** SQuAD 2.0 |
|
**Infrastructure**: 1x NVIDIA 3070 |
|
|
|
## Model Usage |
|
|
|
### Using Transformers |
|
This uses the merged weights (base model weights + LoRA weights) to allow for simple use in Transformers pipelines. It has the same performance as using the weights separately when using the PEFT library. |
|
```python |
|
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline |
|
model_name = "sjrhuschlee/deberta-v3-large-squad2" |
|
|
|
# a) Using pipelines |
|
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name) |
|
qa_input = { |
|
'question': 'Where do I live?', |
|
'context': 'My name is Sarah and I live in London' |
|
} |
|
res = nlp(qa_input) |
|
|
|
# b) Load model & tokenizer |
|
model = AutoModelForQuestionAnswering.from_pretrained(model_name) |
|
tokenizer = AutoTokenizer.from_pretrained(model_name) |
|
``` |
|
|
|
### Using with Peft |
|
**NOTE**: This requires code in the PR https://github.com/huggingface/peft/pull/473 for the PEFT library. |
|
```python |
|
#!pip install peft |
|
|
|
from peft import LoraConfig, PeftModelForQuestionAnswering |
|
from transformers import AutoModelForQuestionAnswering, AutoTokenizer |
|
model_name = "sjrhuschlee/deberta-v3-large-squad2" |
|
``` |