Uses

Direct Use

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]
Downloads last month
4
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for MohamedShakhsak/bert-qa-squad2_V2

Adapter
(90)
this model