File size: 1,675 Bytes
6cc6ccf
 
 
83c19fe
 
 
 
 
 
6cc6ccf
 
 
 
83c19fe
 
 
6cc6ccf
83c19fe
 
 
 
6cc6ccf
83c19fe
 
6cc6ccf
83c19fe
 
 
6cc6ccf
83c19fe
 
3cd60cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
base_model: bert-base-uncased
library_name: peft
license: apache-2.0
tags:
- question-answering
- squad2
- peft
- lora
---
## Uses

### Direct Use
```python
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline
from peft import PeftModel, PeftConfig

# Load adapter and base model
config = PeftConfig.from_pretrained("MohamedShakhsak/bert-qa-squad2_V2")
base_model = AutoModelForQuestionAnswering.from_pretrained(config.base_model_name_or_path)
lora_model = PeftModel.from_pretrained(base_model, "MohamedShakhsak/bert-qa-squad2_V2")

# Merge for standalone use (optional)
merged_model = lora_model.merge_and_unload()

# Inference
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
qa_pipeline = pipeline("question-answering", model=merged_model, tokenizer=tokenizer)

context = "Hugging Face is based in New York City."
question = "Where is Hugging Face located?"
result = qa_pipeline(question=question, context=context)  # Output: {'answer': 'New York City', ...}

```
# BERT-QA-SQuAD2 LoRA Adapter

A **Parameter-Efficient (LoRA)** adapter for `bert-base-uncased`, fine-tuned on **SQuAD 2.0** for extractive question answering. Optimized for low-rank adaptation (LoRA) to reduce memory usage while preserving performance.

## Model Details

### Model Description
- **Developed by:** [Your Name/Organization]
- **Model type:** PEFT (LoRA) adapter for BERT
- **Language(s):** English
- **License:** Apache 2.0
- **Finetuned from:** `bert-base-uncased`
- **Adapter Size:** ~3MB (vs. ~440MB for full BERT)

### Model Sources
- **Repository:** [GitHub link if applicable]
- **Demo:** [Hugging Face Spaces link if available]