Downloads · 30 days
16
10% of all-time downloads
minoosh/bert-reg-biencoder-mse
bert-reg-biencoder-mse is a machine learning model from minoosh. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is a BiEncoder architecture that outputs similarity scores between text pairs.
Downloads · 30 days
16
10% of all-time downloads
All-time downloads
160
Public
Parameters
109M
3.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin438 MB · 50%
From the Hugging Face model README
This model is a BiEncoder architecture that outputs similarity scores between text pairs.
from transformers import AutoTokenizer, AutoModel
from modeling import BiEncoderModelRegression
# Load model components
tokenizer = AutoTokenizer.from_pretrained("minoosh/bert-reg-biencoder-mse")
base_model = AutoModel.from_pretrained("bert-base-uncased")
model = BiEncoderModelRegression(base_model, loss_fn="mse")
# Load weights
state_dict = torch.load("pytorch_model.bin")
model.load_state_dict(state_dict)
# Prepare inputs
texts1 = ["first text"]
texts2 = ["second text"]
inputs = tokenizer(
texts1, texts2,
padding=True,
truncation=True,
return_tensors="pt"
)
# Get similarity scores
outputs = model(**inputs)
similarity_scores = outputs["logits"]
The model was trained using mse loss and evaluated using: