SentenceTransformer based on almanach/camembert-large

This is a sentence-transformers model finetuned from almanach/camembert-large. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: almanach/camembert-large
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 1024 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: CamembertModel 
  (1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)

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 SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
    'Le patient a été mis sous antibiothérapie adaptée (pénicilline A + aminoside).',
    'En octobre 2003, la patiente était en excellent état général.',
    "Les prélèvements de sang et d'urine sont effectués 10 heures plus tard.",
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Evaluation

Metrics

Semantic Similarity

Metric Value
pearson_cosine 0.8636
spearman_cosine 0.8677

Training Details

Training Dataset

Unnamed Dataset

  • Size: 600 training samples
  • Columns: sentence1, sentence2, and score
  • Approximate statistics based on the first 600 samples:
    sentence1 sentence2 score
    type string string float
    details
    • min: 8 tokens
    • mean: 23.23 tokens
    • max: 85 tokens
    • min: 8 tokens
    • mean: 23.08 tokens
    • max: 90 tokens
    • min: 0.0
    • mean: 0.45
    • max: 1.0
  • Samples:
    sentence1 sentence2 score
    L'UIV a objectivé un retard de sécrétion avec importante dilatation pyélo-calicielle et de l'uretère lombaire en amont d'un énorme calcul de l'uretère iliaque et pelvien droit (Figure 2). L'UIV a montré une importante dilatation urétéro-pyélo-calicielle en amont d'un énorme calcul de l'uretère gauche, le coté droit était sans anomalies (Figure 6). 0.6
    1 Diminution méthadone à 80 mg TID. 7 Diminution méthadone à 20 mg TID 0.6
    L’examen clinique à l’entrée trouvait au toucher rectal une grosse vésicule séminale droite. L'examen clinique trouvait au toucher rectal un plancher vésical fixé à gauche. 0.6
  • Loss: CosineSimilarityLoss with these parameters:
    {
        "loss_fct": "torch.nn.modules.loss.MSELoss"
    }
    

Evaluation Dataset

Unnamed Dataset

  • Size: 400 evaluation samples
  • Columns: sentence1, sentence2, and score
  • Approximate statistics based on the first 400 samples:
    sentence1 sentence2 score
    type string string float
    details
    • min: 8 tokens
    • mean: 23.05 tokens
    • max: 97 tokens
    • min: 7 tokens
    • mean: 22.45 tokens
    • max: 88 tokens
    • min: 0.0
    • mean: 0.45
    • max: 1.0
  • Samples:
    sentence1 sentence2 score
    L’examen clinique était sans particularité. La formule sanguine était sans particularité. 0.4
    Le bilan biologique était correct. Le geste était complet. 0.0
    La sérologie VIH était négative. La cytologie urinaire pyélique droite était négative. 0.2
  • Loss: CosineSimilarityLoss with these parameters:
    {
        "loss_fct": "torch.nn.modules.loss.MSELoss"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_eval_batch_size: 16
  • learning_rate: 1e-05
  • num_train_epochs: 5
  • lr_scheduler_type: cosine
  • warmup_ratio: 0.1
  • fp16: True
  • auto_find_batch_size: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 8
  • per_device_eval_batch_size: 16
  • 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: 1e-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: 5
  • max_steps: -1
  • lr_scheduler_type: cosine
  • lr_scheduler_kwargs: {}
  • 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
  • use_ipex: False
  • bf16: False
  • fp16: True
  • 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: False
  • 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}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • 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
  • 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: True
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss Validation Loss sts-dev_spearman_cosine
0.1333 10 - 0.3013 0.6711
0.2667 20 - 0.2010 0.6742
0.4 30 - 0.1114 0.7249
0.5333 40 - 0.0610 0.7684
0.6667 50 - 0.0537 0.7998
0.8 60 - 0.0498 0.8245
0.9333 70 - 0.0454 0.8473
1.0667 80 - 0.0423 0.8474
1.2 90 - 0.0494 0.8625
1.3333 100 0.1041 0.0425 0.8644
1.4667 110 - 0.0391 0.8588
1.6 120 - 0.0377 0.8598
1.7333 130 - 0.0396 0.8616
1.8667 140 - 0.0378 0.8616
2.0 150 - 0.0375 0.8605
2.1333 160 - 0.0389 0.8636
2.2667 170 - 0.0387 0.8633
2.4 180 - 0.0380 0.8640
2.5333 190 - 0.0387 0.8657
2.6667 200 0.0192 0.0391 0.8655
2.8 210 - 0.0396 0.8661
2.9333 220 - 0.0373 0.8658
3.0667 230 - 0.0361 0.8662
3.2 240 - 0.0368 0.8661
3.3333 250 - 0.0370 0.8670
3.4667 260 - 0.0375 0.8681
3.6 270 - 0.0378 0.8678
3.7333 280 - 0.0374 0.8667
3.8667 290 - 0.0373 0.8662
4.0 300 0.0094 0.0373 0.8667
4.1333 310 - 0.0374 0.8676
4.2667 320 - 0.0376 0.8679
4.4 330 - 0.0376 0.8681
4.5333 340 - 0.0375 0.8680
4.6667 350 - 0.0375 0.8678
4.8 360 - 0.0374 0.8677
4.9333 370 - 0.0374 0.8677

Framework Versions

  • Python: 3.12.8
  • Sentence Transformers: 3.4.1
  • Transformers: 4.47.1
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.4.0
  • Datasets: 3.2.0
  • Tokenizers: 0.21.0

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
24
Safetensors
Model size
337M params
Tensor type
F32
·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.

Model tree for mnaguib/camembert-large-finetuned-clister

Finetuned
(11)
this model

Evaluation results