File size: 2,592 Bytes
3fee74c 1dd77b7 0b94b31 a778101 0b94b31 1dd77b7 3fee74c db9d06f 3fee74c ccc0fd3 3fee74c 0b94b31 16be28e 3fee74c d49ebb9 0b94b31 3fee74c 0b94b31 3fee74c 0b94b31 3fee74c 0b94b31 3fee74c 0b94b31 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
---
base_model:
- answerdotai/ModernBERT-base
datasets:
- nyu-mll/glue
language:
- en
library_name: transformers
metrics:
- accuracy
- f1
pipeline_tag: text-classification
tags:
- cross-encoder
---
# 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](https://huggingface.co/answerdotai/ModernBERT-base) on [GLUE QNLI](https://arxiv.org/abs/1804.07461) 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:
```python
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):
```python
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 |