Downloads · 30 days
0
mia-project-2025/bert-base-uncased-LoRA-quora-question-pairs
bert-base-uncased-LoRA-quora-question-pairs is a machine learning model from mia-project-2025. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This model applies LoRA (Low-Rank Adaptation) fine-tuning on tomaarsen/bert-base-nq-prompts for the Quora Question Pairs dataset.
Downloads · 30 days
0
Access
Public
Updated Aug 22, 2025
Repo size
35.2 MB
Likes
0
Public
Click a slice to open those files.
.pt23.5 MB · 56%
From the Hugging Face model README
This model applies LoRA (Low-Rank Adaptation) fine-tuning on tomaarsen/bert-base-nq-prompts for the Quora Question Pairs dataset.
It classifies whether two questions are duplicates.
tomaarsen/bert-base-nq-promptsr=8, alpha=64, dropout=0.1query, key, value, dense| Metric | Score |
|---|---|
| Train Loss | 0.447 |
| Eval Loss | 0.257 |
| Accuracy | 89.98% |
| Precision | 83.41% |
| Recall | 90.80% |
| F1 Score | 86.95% |
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
# Load base model and tokenizer
model_name = "tomaarsen/bert-base-nq-prompts"
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Load LoRA fine-tuned model
base_model = AutoModelForSequenceClassification.from_pretrained(model_name, num_labels=2)
model = PeftModel.from_pretrained(base_model, "mia-project-2025/bert-base-uncased-LoRA-quora-question-pairs")
model.eval()
def predict_duplicate(q1, q2):
inputs = tokenizer(q1, q2, return_tensors="pt", truncation=True, padding=True, max_length=128)
with torch.no_grad():
logits = model(**inputs).logits
pred = torch.argmax(logits, dim=1).item()
return "Duplicate" if pred == 1 else "Not Duplicate"
# Example
print(predict_duplicate("How can I learn Python?", "What are the best ways to learn Python programming?"))