Downloads · 30 days
8
40% of all-time downloads
MohamedShakshak/bert-qa-squad2_V2
bert-qa-squad2_V2 is a question answering model from MohamedShakshak. Use it when the input is a question plus a passage. It is set up for peft. The card lists the license as apache-2.0.
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.
Downloads · 30 days
8
40% of all-time downloads
All-time downloads
20
Public
Repo size
10.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors10.6 MB · 92%
From the Hugging Face model README
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', ...}
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.
bert-base-uncased