Run this model with HF Jobs

Run Jsevisal/CrossEncoder-ModernBERT-base-qnli on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Jsevisal/CrossEncoder-ModernBERT-base-qnli. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Jsevisal/CrossEncoder-ModernBERT-base-qnli on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Model Card for Model ID

ModernBert version of CrossEncoders QNLI models. Used to determine if a passage contains the answer to a question. In this case the model has been train on GLUE.

Model Details

Model Description

This model is a fine-tuned version of answerdotai/ModernBERT-base on GLUE QNLI dataset.

It achieves the following results on the evaluation set:

  • Accuracy Score: 0.9319
  • F1 Score: 0.9322

Usage

Pre-trained models can be used like this:

from sentence_transformers import CrossEncoder
model = CrossEncoder('Jsevisal/CrossEncoder-ModernBERT-base-qnli')
scores = model.predict([('Query1', 'Paragraph1'), ('Query2', 'Paragraph2')])

#e.g.
scores = model.predict([('How many people live in Berlin?', 'Berlin had a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.'), ('What is the size of New York?', 'New York City is famous for the Metropolitan Museum of Art.')])

Usage with Transformers AutoModel

You can use the model also directly with Transformers library (without SentenceTransformers library):

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model = AutoModelForSequenceClassification.from_pretrained('Jsevisal/CrossEncoder-ModernBERT-base-qnli')
tokenizer = AutoTokenizer.from_pretrained('Jsevisal/CrossEncoder-ModernBERT-base-qnli')

features = tokenizer(['How many people live in Berlin?', 'What is the size of New York?'], ['Berlin had a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'],  padding=True, truncation=True, return_tensors="pt")

model.eval()
with torch.no_grad():
    scores = torch.nn.functional.sigmoid(model(**features).logits)
    print(scores)

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 8e-05
  • train_batch_size: 32
  • eval_batch_size: 32
  • seed: 42
  • optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.98) and epsilon=1e-06 and optimizer_args=No additional optimizer arguments
  • lr_scheduler_type: linear
  • num_epochs: 2

Framework versions

  • Transformers 4.49.0.dev0
  • Pytorch 2.5.1+cu124
  • Datasets 3.2.0
  • Tokenizers 0.21.0
Downloads last month
15
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Jsevisal/CrossEncoder-ModernBERT-base-qnli

Finetuned
(1,652)
this model

Dataset used to train Jsevisal/CrossEncoder-ModernBERT-base-qnli

Paper for Jsevisal/CrossEncoder-ModernBERT-base-qnli