CoolFace
Modelpublic

philipp-zettl/MiniLM-amazon_massive_intent-similarity

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes88downloads
Model Card

SentenceTransformer based on sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2

This is a sentence-transformers model finetuned from sentence-transformers/paraphrase-multilingual-MiniLM-L12-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/paraphrase-multilingual-MiniLM-L12-v2 <!-- at revision bf3bf13ab40c3157080a7ab344c831b9ad18b5eb -->
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 384 tokens
  • Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 128, '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})
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("philipp-zettl/MiniLM-amazon_massive_intent-similarity")
# Run inference
sentences = [
    'vertel my die huidige tyd in ottawa',
    'query cooking',
    'request definition',
]
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]

<!--

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. -->

Evaluation

Metrics

Semantic Similarity
MetricValue
pearson_cosine0.8464
spearman_cosine0.8129
pearson_manhattan0.8205
spearman_manhattan0.807
pearson_euclidean0.8208
spearman_euclidean0.8069
pearson_dot0.7928
spearman_dot0.8078
pearson_max0.8464
spearman_max0.8129
Semantic Similarity
MetricValue
pearson_cosine0.908
spearman_cosine0.8426
pearson_manhattan0.8854
spearman_manhattan0.8389
pearson_euclidean0.8858
spearman_euclidean0.8391
pearson_dot0.8619
spearman_dot0.839
pearson_max0.908
spearman_max0.8426

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Hyperparameters

Non-Default Hyperparameters
  • eval_strategy: steps
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • learning_rate: 2e-05
  • num_train_epochs: 1
  • warmup_ratio: 0.1
  • fp16: True
  • batch_sampler: no_duplicates
All Hyperparameters

<details><summary>Click to expand</summary>

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • 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
  • 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: 1
  • max_steps: -1
  • lr_scheduler_type: linear
  • 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: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: False
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • 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
  • 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
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional

</details>

Training Logs

<details><summary>Click to expand</summary>

EpochStepTraining LosslossMiniLM-dev_spearman_cosineMiniLM-test_spearman_cosine
0.00311007.4879---
0.00622006.4531---
0.00933006.4185---
0.01254004.5043---
0.01565005.1274---
0.01876006.0006---
0.02187004.8066---
0.02498003.9536---
0.02809004.7259---
0.031110003.75832.64400.6640-
0.034311003.9905---
0.037412004.8914---
0.040513003.895---
0.043614003.1582---
0.046715003.7172---
0.049816003.6785---
0.052917003.9632---
0.056118003.9643---
0.059219002.829---
0.062320002.59232.33440.7459-
0.065421003.1617---
0.068522002.6366---
0.071623004.3751---
0.074724003.4732---
0.077925002.5695---
0.081026002.7479---
0.084127002.5274---
0.087228002.4204---
0.090329004.1305---
0.093430004.0912.09510.7426-
0.096531003.7972---
0.099732002.6029---
0.102833003.2422---
0.105934003.3747---
0.109035003.3358---
0.112136002.8658---
0.115237002.6436---
0.118338002.2006---
0.121539002.0549---
0.124640002.46423.41080.7236-
0.127741002.9219---
0.130842002.6581---
0.133943002.2697---
0.137044002.7215---
0.140145002.6023---
0.143346001.8772---
0.146447002.6885---
0.149548002.6005---
0.152649001.4849---
0.155750002.48963.48600.7117-
0.158851002.6038---
0.161952002.0584---
0.165153001.9156---
0.168254001.467---
0.171355000.5799---
0.174456001.617---
0.177557001.3764---
0.180658003.067---
0.183759002.2463---
0.186960001.54662.53260.7721-
0.190061001.4097---
0.193162001.7852---
0.196263001.2715---
0.199364002.5585---
0.202465002.4665---
0.205566001.7246---
0.208767001.145---
0.211868001.614---
0.214969001.7206---
0.218070002.63492.68240.7652-
0.221171002.1896---
0.224272001.9106---
0.227473001.3783---
0.230574000.7119---
0.233675001.5037---
0.236776001.8365---
0.239877001.3817---
0.242978001.7101---
0.246079001.6716---
0.249280001.30133.58640.7401-
0.252381001.5131---
0.255482002.3699---
0.258583001.6179---
0.261684001.3---
0.264785001.5151---
0.267886002.8703---
0.271087002.5076---
0.274188001.9876---
0.277289001.5823---
0.280390001.08452.41970.7833-
0.283491001.2871---
0.286592001.3901---
0.289693001.1607---
0.292894002.1171---
0.295995001.4335---
0.299096000.801---
0.302197001.4567---
0.305298001.7046---
0.308399001.4378---
0.3114100002.31912.30630.7903-
0.3146101001.6518---
0.3177102000.9857---
0.3208103002.2052---
0.3239104002.0443---
0.3270105002.08---
0.3301106002.0009---
0.3332107001.3274---
0.3364108001.0298---
0.3395109001.7127---
0.3426110001.33714.06070.7211-
0.3457111002.7555---
0.3488112004.1792---
0.3519113002.0931---
0.3550114002.4591---
0.3582115003.4962---
0.3613116001.9228---
0.3644117002.7295---
0.3675118001.5425---
0.3706119001.1586---
0.3737120001.13362.29590.7890-
0.3768121001.572---
0.3800122001.2827---
0.3831123001.6352---
0.3862124001.4708---
0.3893125001.4719---
0.3924126001.4136---
0.3955127001.3969---
0.3986128001.7228---
0.4018129004.2842---
0.4049130003.58612.11130.7956-
0.4080131002.9718---
0.4111132003.1554---
0.4142133003.1357---
0.4173134002.8488---
0.4204135003.7433---
0.4236136002.4195---
0.4267137002.1384---
0.4298138002.7965---
0.4329139001.7869---
0.4360140003.03562.72340.7697-
0.4391141003.4984---
0.4422142002.4959---
0.4454143002.4615---
0.4485144002.6309---
0.4516145001.9831---
0.4547146003.25---
0.4578147003.3112---
0.4609148001.9912---
0.4640149001.9252---
0.4672150002.45452.07300.7972-
0.4703151001.6943---
0.4734152002.2851---
0.4765153002.4327---
0.4796154001.3503---
0.4827155001.1419---
0.4858156001.7906---
0.4890157001.6504---
0.4921158001.6908---
0.4952159003.0954---
0.4983160001.71512.00420.8044-
0.5014161001.5165---
0.5045162002.5573---
0.5076163001.3401---
0.5108164002.5464---
0.5139165002.4564---
0.5170166002.1667---
0.5201167001.2402---
0.5232168001.932---
0.5263169001.1811---
0.5294170002.20142.04750.8062-
0.5326171002.6535---
0.5357172001.8715---
0.5388173001.9385---
0.5419174002.0398---
0.5450175001.3436---
0.5481176002.0687---
0.5512177001.6224---
0.5544178001.0539---
0.5575179001.1162---
0.5606180001.63342.41200.7964-
0.5637181001.247---
0.5668182002.4652---
0.5699183001.8593---
0.5730184001.1875---
0.5762185002.1173---
0.5793186001.7473---
0.5824187002.1865---
0.5855188001.683---
0.5886189001.6522---
0.5917190001.05262.07430.8033-
0.5948191001.5001---
0.5980192001.2606---
0.6011193001.0597---
0.6042194001.8603---
0.6073195001.4883---
0.6104196000.6594---
0.6135197000.9557---
0.6166198000.8651---
0.6198199001.0326---
0.6229200001.27852.08680.8075-
0.6260201001.2881---
0.6291202000.5919---
0.6322203001.69---
0.6353204001.0285---
0.6385205000.8843---
0.6416206001.3756---
0.6447207000.9646---
0.6478208000.8052---
0.6509209000.8996---
0.6540210001.22072.28810.8029-
0.6571211001.3225---
0.6603212001.8101---
0.6634213000.8756---
0.6665214000.9877---
0.6696215001.7329---
0.6727216001.6885---
0.6758217001.2132---
0.6789218001.4888---
0.6821219001.403---
0.6852220000.59952.19520.8036-
0.6883221000.9658---
0.6914222001.1485---
0.6945223001.089---
0.6976224001.2719---
0.7007225000.9611---
0.7039226000.9398---
0.7070227000.7931---
0.7101228001.1224---
0.7132229002.032---
0.7163230001.36642.10430.8075-
0.7194231000.7777---
0.7225232000.9427---
0.7257233000.8846---
0.7288234001.0039---
0.7319235000.9344---
0.7350236001.3712---
0.7381237000.8039---
0.7412238001.0735---
0.7443239000.9851---
0.7475240001.86732.15470.8066-
0.7506241005.5805---
0.7537242004.1286---
0.7568243002.2206---
0.7599244003.6468---
0.7630245002.9307---
0.7661246003.8745---
0.7693247002.2125---
0.7724248002.3844---
0.7755249001.5081---
0.7786250001.59821.84910.8145-
0.7817251002.1563---
0.7848252001.8558---
0.7879253002.2087---
0.7911254002.3953---
0.7942255001.4072---
0.7973256001.4637---
0.8004257002.2037---
0.8035258001.6241---
0.8066259001.4882---
0.8097260000.91081.92920.8115-
0.8129261000.9198---
0.8160262001.2981---
0.8191263001.0513---
0.8222264001.389---
0.8253265005.8539---
0.8284266003.547---
0.8315267002.3285---
0.8347268002.8112---
0.8378269003.3717---
0.8409270002.59211.94300.8108-
0.8440271001.5048---
0.8471272001.5---
0.8502273000.778---
0.8533274000.9557---
0.8565275001.347---
0.8596276001.5882---
0.8627277001.7333---
0.8658278001.5683---
0.8689279000.7698---
0.8720280001.27581.97040.8127-
0.8751281001.3248---
0.8783282001.041---
0.8814283001.6066---
0.8845284001.9033---
0.8876285000.8781---
0.8907286000.9345---
0.8938287000.9209---
0.8969288001.1443---
0.9001289000.9522---
0.9032290001.42952.05720.8111-
0.9063291000.9005---
0.9094292001.0024---
0.9125293001.3573---
0.9156294001.0805---
0.9187295001.3308---
0.9219296001.4853---
0.9250297002.0785---
0.9281298000.9283---
0.9312299000.8081---
0.9343300000.42232.04040.8115-
0.9374301000.8565---
0.9405302000.6674---
0.9437303000.5499---
0.9468304000.3212---
0.9499305000.166---
0.9530306000.1096---
0.9561307000.0382---
0.9592308000.2927---
0.9623309000.4097---
0.9655310000.55542.00680.8130-
0.9686311000.5783---
0.9717312000.376---
0.9748313000.3469---
0.9779314000.3043---
0.9810315000.4023---
0.9841316000.1876---
0.9873317000.4473---
0.9904318000.3256---
0.9935319000.4875---
0.9966320000.18072.01220.8129-
0.9997321000.3249---
1.032109---0.8426

</details>

Framework Versions

  • Python: 3.10.14
  • Sentence Transformers: 3.0.1
  • Transformers: 4.41.2
  • PyTorch: 2.3.1+cu121
  • Accelerate: 0.33.0
  • Datasets: 2.21.0
  • Tokenizers: 0.19.1

Citation

BibTeX

Sentence Transformers
bibtex
@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",
}
CoSENTLoss
bibtex
@online{kexuefm-8847,
    title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
    author={Su Jianlin},
    year={2022},
    month={Jan},
    url={https://kexue.fm/archives/8847},
}

<!--

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. -->