How to use from the
Use from the
sentence-transformers library
# Gated model: Login with a HF token with gated access permission
hf auth login
from sentence_transformers import CrossEncoder

model = CrossEncoder("Fallovski/CrossencoderPharma")

query = "Which planet is known as the Red Planet?"
passages = [
	"Venus is often called Earth's twin because of its similar size and proximity.",
	"Mars, known for its reddish appearance, is often referred to as the Red Planet.",
	"Jupiter, the largest planet in our solar system, has a prominent red spot.",
	"Saturn, famous for its rings, is sometimes mistaken for the Red Planet."
]

scores = model.predict([(query, passage) for passage in passages])
print(scores)

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

CrossEncoder based on doctolib-lab/doctobert-fr-base

This is a Cross Encoder model finetuned from doctolib-lab/doctobert-fr-base using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.

Model Details

Model Description

  • Model Type: Cross Encoder
  • Base model: doctolib-lab/doctobert-fr-base
  • Maximum Sequence Length: 64 tokens
  • Number of Output Labels: 1 label
  • Supported Modality: Text

Model Sources

Full Model Architecture

CrossEncoder(
  (0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'RobertaForSequenceClassification'})
)

Usage

Direct Usage (Sentence Transformers)

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("Fallovski/CrossencoderPharma")
# Get scores for pairs of inputs
pairs = [
    ['KLIPAL CODEINE 300/25 MG CP /16', 'ANTHELIOS 30+ ULT YX SENS 50ML'],
    ['BIOTIC PLUS 100MG ENF 60ML', 'BIOTIC PLUS 500MG SACH B/14'],
    ['FALCIART 80/480 MG COMP B/6', 'FALCIART CPR 80/480MG BT6'],
    ['KLACIN CPR 625MG BT15', 'Klacin Cpr 625Mg Bt15'],
    ['INDOCOLLYRE 0.1% ETO F/5ML B/1', 'Indocollyre 0.1% Eto F/5Ml B/1'],
]
scores = model.predict(pairs)
print(scores)
# [9.7995e-04 1.1121e-03 9.9875e-01 9.9884e-01 9.9885e-01]

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    'KLIPAL CODEINE 300/25 MG CP /16',
    [
        'ANTHELIOS 30+ ULT YX SENS 50ML',
        'BIOTIC PLUS 500MG SACH B/14',
        'FALCIART CPR 80/480MG BT6',
        'Klacin Cpr 625Mg Bt15',
        'Indocollyre 0.1% Eto F/5Ml B/1',
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Evaluation

Metrics

Cross Encoder Classification

Metric Value
accuracy 0.9871
accuracy_threshold 0.5495
f1 0.9869
f1_threshold 0.5495
precision 0.9849
recall 0.9889
average_precision 0.9981

Training Details

Training Dataset

Unnamed Dataset

  • Size: 11,426 training samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 100 samples:
    sentence1 sentence2 label
    type string string float
    modality text text
    details
    • min: 6 tokens
    • mean: 16.49 tokens
    • max: 27 tokens
    • min: 5 tokens
    • mean: 16.99 tokens
    • max: 28 tokens
    • min: 0.0
    • mean: 0.51
    • max: 1.0
  • Samples:
    sentence1 sentence2 label
    SÉROLOGIE ARBOVIRUS SÉROLOGIE WRIGHT 0.0
    SOND FOL H 15ML AA14 16CH /1 SOND FOL H 15ML AA14 16CH 1 1.0
    FARLINE CAPRI D +1.5 MARON BLANC HOM FARLINE MONZA CAREY +3.0 MARON/NOIR 0.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Evaluation Dataset

Unnamed Dataset

  • Size: 2,016 evaluation samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 100 samples:
    sentence1 sentence2 label
    type string string float
    modality text text
    details
    • min: 5 tokens
    • mean: 16.54 tokens
    • max: 35 tokens
    • min: 5 tokens
    • mean: 16.98 tokens
    • max: 33 tokens
    • min: 0.0
    • mean: 0.51
    • max: 1.0
  • Samples:
    sentence1 sentence2 label
    KLIPAL CODEINE 300/25 MG CP /16 ANTHELIOS 30+ ULT YX SENS 50ML 0.0
    BIOTIC PLUS 100MG ENF 60ML BIOTIC PLUS 500MG SACH B/14 0.0
    FALCIART 80/480 MG COMP B/6 FALCIART CPR 80/480MG BT6 1.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • learning_rate: 2e-05
  • num_train_epochs: 6
  • warmup_ratio: 0.1
  • load_best_model_at_end: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 6
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • bf16: False
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch_fused
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • project: huggingface
  • trackio_space_id: trackio
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • hub_revision: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: no
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: True
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss Validation Loss validation_average_precision
0.1397 50 0.6869 - -
0.2793 100 0.3572 - -
0.4190 150 0.1483 - -
0.5587 200 0.13 - -
0.6983 250 0.1394 - -
0.8380 300 0.106 - -
0.9777 350 0.0999 - -
1.0 358 - 0.1673 0.9963
1.1173 400 0.084 - -
1.2570 450 0.0731 - -
1.3966 500 0.0716 - -
1.5363 550 0.0699 - -
1.6760 600 0.0647 - -
1.8156 650 0.0691 - -
1.9553 700 0.0942 - -
2.0 716 - 0.0571 0.9981
2.0950 750 0.0399 - -
2.2346 800 0.0503 - -
2.3743 850 0.0219 - -
2.5140 900 0.0456 - -
2.6536 950 0.0536 - -
2.7933 1000 0.0349 - -
2.9330 1050 0.052 - -
3.0 1074 - 0.0602 0.9983
3.0726 1100 0.0398 - -
3.2123 1150 0.0128 - -
3.3520 1200 0.022 - -
3.4916 1250 0.0122 - -
3.6313 1300 0.0265 - -
3.7709 1350 0.04 - -
3.9106 1400 0.0242 - -
4.0 1432 - 0.0684 0.9987
4.0503 1450 0.0186 - -
4.1899 1500 0.0185 - -
4.3296 1550 0.0129 - -
4.4693 1600 0.0113 - -
4.6089 1650 0.0103 - -
4.7486 1700 0.003 - -
4.8883 1750 0.0207 - -
5.0 1790 - 0.0744 0.9987
5.0279 1800 0.0181 - -
5.1676 1850 0.0158 - -
5.3073 1900 0.0156 - -
5.4469 1950 0.0123 - -
5.5866 2000 0.0094 - -
5.7263 2050 0.0159 - -
5.8659 2100 0.0033 - -
6.0 2148 - 0.0649 0.9988
-1 -1 - - 0.9981
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 10.8 minutes
  • Evaluation: 1.1 minutes
  • Total: 11.9 minutes

Framework Versions

  • Python: 3.13.11
  • Sentence Transformers: 5.6.1
  • Transformers: 4.57.6
  • PyTorch: 2.13.0+cu130
  • Accelerate: 1.14.0
  • Datasets: 5.0.1
  • Tokenizers: 0.22.2

Additional Resources

Citation

BibTeX

Sentence Transformers

@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",
}
Downloads last month
36
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 Fallovski/CrossencoderPharma

Finetuned
(2)
this model

Paper for Fallovski/CrossencoderPharma

Evaluation results