SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-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: sentence-transformers/all-MiniLM-L6-v2
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 384 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 384, '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})
(2): Normalize()
)
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 = [
'CARERI, Maria, FÉRY-HUE, Françoise (éd.) (2001), Album de manuscrits français du XIIIe siècle : mise en page et mise en texte, Roma, Viella',
'F. FÉRY-HUE, M. CARERI, Album De Manuscrits Français Du Xiiie Siècle : Mise En Page Et Mise En Texte, (2001)',
'GORMAN, Michael Murray (1983), "A Carolingian Epitome of St. Augustine\'s De Genesi ad litteram", Revue des études augustiniennes, 29, n° 1-2, p. 137-144 (réimpr. dans GORMAN, Michael Murray, Biblical commentaries from the early Middle Ages, Firenze, SISMEL, p. 41-48)',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Evaluation
Metrics
Binary Classification
- Datasets:
eval
andtest
- Evaluated with
BinaryClassificationEvaluator
Metric | eval | test |
---|---|---|
cosine_accuracy | 1.0 | 0.99 |
cosine_accuracy_threshold | 0.5337 | 0.8199 |
cosine_f1 | 1.0 | 0.9912 |
cosine_f1_threshold | 0.5337 | 0.4524 |
cosine_precision | 1.0 | 0.9825 |
cosine_recall | 1.0 | 1.0 |
cosine_ap | 1.0 | 0.9997 |
cosine_mcc | 1.0 | 0.9799 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 10,750 training samples
- Columns:
text1
,text2
, andlabel
- Approximate statistics based on the first 1000 samples:
text1 text2 label type string string int details - min: 24 tokens
- mean: 71.15 tokens
- max: 173 tokens
- min: 9 tokens
- mean: 60.14 tokens
- max: 169 tokens
- 0: ~45.90%
- 1: ~54.10%
- Samples:
text1 text2 label TSUJI, Sahoko G. (1982), "Analyse iconographique de quelques miniatures des rouleaux d'Exultet dans leurs rapports avec le texte", Studia artium orientalis et occidentalis, 1, p. 15-28
Sahoko G. TSUJI, (2019), "Analyse iconographique de quelques miniatures des rouleaux d'Exultet dans leurs rapports avec le texte", Studia artium orientalis et occidentalis, 16, p. 207-225
0
Aesopi Fabulae, XIIIe s. ; ms. pris à San Daniele del Friuli (anc. cote : 147) ; LAFFITTE (Marie-Pierre), " La Bibliothèque nationale et les "conquêtes artistiques" de la Révolution et de l'Empire : Les manuscrits d'Italie (1796-1815) ", Bulletin du bibliophile, 1989, n° 2, p. 273-323. Mss.
LAFFITTE, Marie-Pierre (1989), "La Bibliothèque nationale et les "conquêtes artistiques" de la Révolution et de l'Empire : Les manuscrits d'Italie (1796-1815)", Bulletin du bibliophile, 2, p. 273-323
1
GARNIER, François (1997), "Le pèlerinage de la vie humaine de Guillaume de Digulleville", Art sacré : les Cahiers de Rencontre avec le patrimoine religieux, 8 (Sur les pas des pèlerins), p. 101-111
GARNIER, François (1997), "Les fresques de Lutz-en-Dunois", Art sacré : les Cahiers de Rencontre avec le patrimoine religieux, 6 (Les églises rurales), p. 155-164
0
- Loss:
CosineSimilarityLoss
with these parameters:{ "loss_fct": "torch.nn.modules.loss.MSELoss" }
Evaluation Dataset
Unnamed Dataset
- Size: 100 evaluation samples
- Columns:
text1
,text2
, andlabel
- Approximate statistics based on the first 100 samples:
text1 text2 label type string string int details - min: 26 tokens
- mean: 68.4 tokens
- max: 146 tokens
- min: 16 tokens
- mean: 57.67 tokens
- max: 154 tokens
- 0: ~46.00%
- 1: ~54.00%
- Samples:
text1 text2 label JACOB, Marie (2014), "Le recueil du 'Lyon d'or' de Châtellerault : un livre d'ingénieur inédit de la fin du XVe siècle (Solesmes, Abbaye Saint-Pierre, ms. 163)", dans RABEL, Claudia (éd.), Le manuscrit enluminé : études réunies en hommage à Patricia Stirnemann, Paris, Le Léopard d'or (Cahiers du Léopard d'or, 16), p. 101-121
RABEL, Claudia (éd.) (2014), Le manuscrit enluminé: études réunies en hommage à Patricia Stirnemann, Paris, Le Léopard d'or (Cahiers du Léopard d'or, 16)
0
RICHARDS, John (2007), "Fouquet and the Trecento", Zeitschrift für Kunstgeschichte, 70, n° 4, p. 449-472
LEBIGUE, Jean-Baptiste (2007), Initiation aux manuscrits liturgiques, Orléans, Institut de recherche et d'histoire des textes (Ædilis, Publications pédagogiques, 6)
0
BALBARINI, Chiara (2001-2002), "Liturgia e iconografia negli Antifonari di San Francesco a Pisa", dans ALIDORI BATTAGLIA, Laura (éd.), Cicli e immagini bibliche nella miniatura. Atti del VI Congresso di storia della Miniatura, Urbino, 3-6 ottobre 2002 (Rivista di storia della miniatura, 6-7), p. 181-190
WAGNER, Pierre-Édouard (2001-2002), "Un missel du XIVe siècle à l'usage du diocèse de Metz provenant du couvent des augustines de Saint-Jean de Bassel", Cahiers Élie Fleur, 21, p. 15-31
0
- Loss:
CosineSimilarityLoss
with these parameters:{ "loss_fct": "torch.nn.modules.loss.MSELoss" }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: epochper_device_train_batch_size
: 20per_device_eval_batch_size
: 20num_train_epochs
: 4
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: epochprediction_loss_only
: Trueper_device_train_batch_size
: 20per_device_eval_batch_size
: 20per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_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
: 4max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.0warmup_steps
: 0log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 42data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Falsefp16
: Falsefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 0ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Falsedataloader_num_workers
: 0dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Truelabel_names
: Noneload_best_model_at_end
: Falseignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Nonehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseinclude_for_metrics
: []eval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | Validation Loss | eval_cosine_ap | test_cosine_ap |
---|---|---|---|---|---|
-1 | -1 | - | - | 0.7004 | - |
0.9294 | 500 | 0.0843 | - | - | - |
1.0 | 538 | - | 0.0122 | 1.0000 | - |
1.8587 | 1000 | 0.0303 | - | - | - |
2.0 | 1076 | - | 0.0129 | 1.0000 | - |
2.7881 | 1500 | 0.0223 | - | - | - |
3.0 | 1614 | - | 0.0057 | 1.0000 | - |
3.7175 | 2000 | 0.0171 | - | - | - |
4.0 | 2152 | - | 0.0043 | 1.0000 | - |
-1 | -1 | - | - | - | 0.9997 |
Framework Versions
- Python: 3.12.2
- Sentence Transformers: 4.1.0
- Transformers: 4.49.0
- PyTorch: 2.6.0+cpu
- Accelerate: 1.3.0
- Datasets: 3.3.1
- 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
- 47
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for Albertdebeauvais/all-MiniLM-L6-v2_bibliographie
Base model
sentence-transformers/all-MiniLM-L6-v2Evaluation results
- Cosine Accuracy on evalself-reported1.000
- Cosine Accuracy Threshold on evalself-reported0.534
- Cosine F1 on evalself-reported1.000
- Cosine F1 Threshold on evalself-reported0.534
- Cosine Precision on evalself-reported1.000
- Cosine Recall on evalself-reported1.000
- Cosine Ap on evalself-reported1.000
- Cosine Mcc on evalself-reported1.000
- Cosine Accuracy on testself-reported0.990
- Cosine Accuracy Threshold on testself-reported0.820