Downloads · 30 days
8
7% of all-time downloads
renhehuang/fair-resume-job-matcher-lora
fair-resume-job-matcher-lora is a machine learning model from renhehuang. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
Fairness-aware LoRA adapter for resume–job matching built on top of BAAI/bge-large-en-v1.5.
Downloads · 30 days
8
7% of all-time downloads
All-time downloads
112
Public
Repo size
28.5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors28.5 MB · 100%
From the Hugging Face model README
Fairness-aware LoRA adapter for resume–job matching built on top of BAAI/bge-large-en-v1.5.
This adapter was trained with adversarial debiasing and multi-task objectives to reduce group disparities while maintaining utility.
from transformers import AutoTokenizer, AutoModel
from peft import PeftModel
BASE = "BAAI/bge-large-en-v1.5"
ADAPTER = "fairness_lora"
tokenizer = AutoTokenizer.from_pretrained(BASE)
base_model = AutoModel.from_pretrained(BASE)
model = PeftModel.from_pretrained(base_model, ADAPTER)
model.eval()
# Encode two texts and compute cosine
import torch
import torch.nn.functional as F
def encode(text):
enc = tokenizer(text, return_tensors='pt', truncation=True, padding=True, max_length=256)
with torch.no_grad():
out = model(**enc)
hidden = out.last_hidden_state
emb = F.normalize(hidden.mean(dim=1), p=2, dim=1)
return emb
r = "Software engineer with Python experience."
j = "Hiring backend Python developer."
cos = (encode(r) * encode(j)).sum(dim=1).item()
prob = torch.sigmoid(torch.tensor(cos)).item()
print({"cosine": cos, "prob": prob})
BAAI/bge-large-en-v1.5BAAI/bge-large-en-v1.5 allows derivative adapters.