Edit model card
YAML Metadata Warning: The pipeline tag "text-similarity" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, text2text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, any-to-any, other

BiEncoder Regression Model

This model is a BiEncoder architecture that outputs similarity scores between text pairs.

Model Details

  • Base Model: bert-base-uncased
  • Task: Regression
  • Architecture: BiEncoder with cosine similarity
  • Loss Function: mse

Usage

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"]

Metrics

The model was trained using mse loss and evaluated using:

  • Mean Squared Error (MSE)
  • Mean Absolute Error (MAE)
  • Pearson Correlation
  • Spearman Correlation
  • Cosine Similarity
Downloads last month
2
Safetensors
Model size
109M params
Tensor type
F32
·
Inference API
Unable to determine this model's library. Check the docs .