Downloads · 30 days
9
26% of all-time downloads
kwondw/reranker-distilroberta-base-nli
reranker-distilroberta-base-nli is a text classification model from kwondw. Use it when you need a label for a piece of text. It is set up for sentence-transformers.
This is a Cross Encoder model finetuned from distilbert/distilroberta-base on the all-nli dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text pair classif…
Downloads · 30 days
9
26% of all-time downloads
All-time downloads
35
Public
Parameters
82.1M
328 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors328 MB · 99%
From the Hugging Face model README
This is a Cross Encoder model finetuned from distilbert/distilroberta-base on the all-nli dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text pair classification.
CrossEncoder(
(0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'RobertaForSequenceClassification'})
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("kwondw/reranker-distilroberta-base-nli")
# Get scores for pairs of inputs
pairs = [
['Two women are embracing while holding to go packages.', 'The sisters are hugging goodbye while holding to go packages after just eating lunch.'],
['Two women are embracing while holding to go packages.', 'Two woman are holding packages.'],
['Two women are embracing while holding to go packages.', 'The men are fighting outside a deli.'],
['Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.', 'Two kids in numbered jerseys wash their hands.'],
['Two young children in blue jerseys, one with the number 9 and one with the number 2 are standing on wooden steps in a bathroom and washing their hands in a sink.', 'Two kids at a ballgame wash their hands.'],
]
scores = model.predict(pairs)
print(scores)
# [[-2.6387 3.0625 -1.0605]
# [ 3.3965 -0.6968 -1.874 ]
# [-3.2012 -0.9272 3.6855]
# [ 2.3809 -1.0547 -0.6987]
# [-2.1973 1.748 0.0408]]
<!--
### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>
-->
<!--
### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
ALLNLI-dev and AllNLI-test| Metric | ALLNLI-dev | AllNLI-test |
|---|---|---|
| f1_macro | 0.8226 | 0.7575 |
| f1_micro | 0.824 | 0.7576 |
| f1_weighted | 0.8226 | 0.7583 |
| premise | hypothesis | label | |
|---|---|---|---|
| type | string | string | int |
| modality | text | text | |
| details | <ul><li>min: 8 tokens</li><li>mean: 23.12 tokens</li><li>max: 45 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 11.24 tokens</li><li>max: 25 tokens</li></ul> | <ul><li>0: ~32.69%</li><li>1: ~34.62%</li><li>2: ~32.69%</li></ul> |
| premise | hypothesis | label |
|---|---|---|
| <code>A person on a horse jumps over a broken down airplane.</code> | <code>A person is training his horse for a competition.</code> | <code>1</code> |
| <code>A person on a horse jumps over a broken down airplane.</code> | <code>A person is at a diner, ordering an omelette.</code> | <code>2</code> |
| <code>A person on a horse jumps over a broken down airplane.</code> | <code>A person is outdoors, on a horse.</code> | <code>0</code> |
| premise | hypothesis | label | |
|---|---|---|---|
| type | string | string | int |
| modality | text | text | |
| details | <ul><li>min: 9 tokens</li><li>mean: 19.64 tokens</li><li>max: 36 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 10.2 tokens</li><li>max: 24 tokens</li></ul> | <ul><li>0: ~32.69%</li><li>1: ~30.77%</li><li>2: ~36.54%</li></ul> |
| premise | hypothesis | label |
|---|---|---|
| <code>Two women are embracing while holding to go packages.</code> | <code>The sisters are hugging goodbye while holding to go packages after just eating lunch.</code> | <code>1</code> |
| <code>Two women are embracing while holding to go packages.</code> | <code>Two woman are holding packages.</code> | <code>0</code> |
| <code>Two women are embracing while holding to go packages.</code> | <code>The men are fighting outside a deli.</code> | <code>2</code> |
per_device_train_batch_size: 64per_device_eval_batch_size: 64num_train_epochs: 1warmup_steps: 0.1fp16: Trueddp_find_unused_parameters: Falsedo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 64per_device_eval_batch_size: 64gradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: Nonewarmup_steps: 0.1log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Falsefp16: Truebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Truedataloader_num_workers: 0dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Nonegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Falseddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Truepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueuse_cache: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss | ALLNLI-dev_f1_macro | AllNLI-test_f1_macro |
|---|---|---|---|---|---|
| -1 | -1 | - | - | 0.1658 | - |
| 0.1280 | 100 | 0.9521 | - | - | - |
| 0.2561 | 200 | 0.6069 | - | - | - |
| 0.3841 | 300 | 0.5517 | - | - | - |
| 0.5122 | 400 | 0.5313 | - | - | - |
| 0.6402 | 500 | 0.5126 | 0.3908 | 0.8226 | - |
| 0.7682 | 600 | 0.4918 | - | - | - |
| 0.8963 | 700 | 0.4655 | - | - | - |
| -1 | -1 | - | - | - | 0.7575 |
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->