CoolFace
Modelpublic

cassador/indobert-base-p2-nli-v2

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

SentenceTransformer based on indobenchmark/indobert-base-p2

This is a sentence-transformers model finetuned from indobenchmark/indobert-base-p2 on the afaji/indonli dataset. It maps sentences & paragraphs to a 768-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: indobenchmark/indobert-base-p2 <!-- at revision 94b4e0a82081fa57f227fcc2024d1ea89b57ac1f -->
  • —Maximum Sequence Length: 512 tokens
  • —Output Dimensionality: 768 tokens
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —afaji/indonli
  • —Language: id <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 768, '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("cassador/indobert-base-p2-nli-v2")
# Run inference
sentences = [
    'Set album musik pengiring seri film Harry Potter akan dirilis dalam versi baru.',
    'Seri film Harry Potter memiliki set album musik pengiring.',
    'Laga dan kolosal adalah genre film.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# 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.3021
spearman_cosine0.303
pearson_manhattan0.2768
spearman_manhattan0.2726
pearson_euclidean0.3072
spearman_euclidean0.3045
pearson_dot0.3039
spearman_dot0.3047
pearson_max0.3072
spearman_max0.3047
Semantic Similarity
MetricValue
pearson_cosine0.1038
spearman_cosine0.0969
pearson_manhattan0.0749
spearman_manhattan0.0782
pearson_euclidean0.0942
spearman_euclidean0.099
pearson_dot0.107
spearman_dot0.0998
pearson_max0.107
spearman_max0.0998

<!--

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 Dataset

afaji/indonli
  • —Dataset: afaji/indonli
  • —Size: 10,000 training samples
  • —Columns: <code>premise</code>, <code>hypothesis</code>, and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | premise | hypothesis | label | |:--------|:------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 12 tokens</li><li>mean: 29.73 tokens</li><li>max: 179 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 11.93 tokens</li><li>max: 35 tokens</li></ul> | <ul><li>0: ~68.60%</li><li>1: ~31.40%</li></ul> |
  • —Samples: | premise | hypothesis | label | |:-----------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------|:---------------| | <code>Presiden Joko Widodo (Jokowi) menyampaikan prediksi bahwa wabah virus Corona (COVID-19) di Indonesia akan selesai akhir tahun ini.</code> | <code>Prediksi akhir wabah tidak disampaikan Jokowi.</code> | <code>0</code> | | <code>Meski biasanya hanya digunakan di fasilitas kesehatan, saat ini masker dan sarung tangan sekali pakai banyak dipakai di tingkat rumah tangga.</code> | <code>Masker sekali pakai banyak dipakai di tingkat rumah tangga.</code> | <code>1</code> | | <code>Data dari Nielsen Music mencatat, "Joanne" telah terjual 201 ribu kopi di akhir minggu ini, seperti dilansir aceshowbiz.com.</code> | <code>Nielsen Music mencatat pada akhir minggu ini.</code> | <code>0</code> |
  • —Loss: <code>SoftmaxLoss</code>

Evaluation Dataset

afaji/indonli
  • —Dataset: afaji/indonli
  • —Size: 2,000 evaluation samples
  • —Columns: <code>premise</code>, <code>hypothesis</code>, and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | premise | hypothesis | label | |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 9 tokens</li><li>mean: 28.09 tokens</li><li>max: 179 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 12.01 tokens</li><li>max: 24 tokens</li></ul> | <ul><li>0: ~63.00%</li><li>1: ~37.00%</li></ul> |
  • —Samples: | premise | hypothesis | label | |:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------|:---------------| | <code>Manuskrip tersebut berisi tiga catatan yang menceritakan bagaimana peristiwa jatuhnya meteorit serta laporan kematian akibat kejadian tersebut seperti dilansir dari Science Alert, Sabtu (25/4/2020).</code> | <code>Manuskrip tersebut tidak mencatat laporan kematian.</code> | <code>0</code> | | <code>Dilansir dari Business Insider, menurut observasi dari Mauna Loa Observatory di Hawaii pada karbon dioksida (CO2) di level mencapai 410 ppm tidak langsung memberikan efek pada pernapasan, karena tubuh manusia juga masih membutuhkan CO2 dalam kadar tertentu.</code> | <code>Tidak ada observasi yang pernah dilansir oleh Business Insider.</code> | <code>0</code> | | <code>Perekonomian Jakarta terutama ditunjang oleh sektor perdagangan, jasa, properti, industri kreatif, dan keuangan.</code> | <code>Sektor jasa memberi pengaruh lebih besar daripada industri kreatif dalam perekonomian Jakarta.</code> | <code>0</code> |
  • —Loss: <code>SoftmaxLoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: epoch
  • —learning_rate: 1e-05
  • —num_train_epochs: 10
  • —warmup_ratio: 0.001
  • —fp16: True
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: epoch
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 8
  • —per_device_eval_batch_size: 8
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 1
  • —eval_accumulation_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: 10
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.001
  • —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: batch_sampler
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

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

EpochStepTraining Losslosssts-dev_spearman_cosinests-test_spearman_cosine
00--0.1928-
0.041001.1407---
0.082000.7456---
0.123000.6991---
0.164000.6653---
0.25000.6317---
0.246000.5975---
0.287000.5955---
0.328000.6168---
0.369000.5851---
0.410000.591---
0.4411000.6063---
0.4812000.6122---
0.5213000.5881---
0.5614000.59---
0.615000.5715---
0.6416000.5725---
0.6817000.5771---
0.7218000.5935---
0.7619000.584---
0.820000.5829---
0.8421000.5507---
0.8822000.5447---
0.9223000.6059---
0.9624000.5389---
1.025000.6390.54320.4007-
1.0426000.463---
1.0827000.4936---
1.1228000.4966---
1.1629000.4588---
1.230000.5148---
1.2431000.5043---
1.2832000.5048---
1.3233000.4803---
1.360034000.465---
1.435000.5133---
1.4436000.5505---
1.4837000.4498---
1.5238000.5418---
1.5639000.5268---
1.640000.4546---
1.640041000.5279---
1.680042000.5309---
1.7243000.487---
1.7644000.5371---
1.845000.5097---
1.840046000.5242---
1.8847000.4583---
1.9248000.4923---
1.9649000.5028---
2.050000.51390.62740.4335-
2.0451000.322---
2.0852000.389---
2.1253000.3633---
2.1654000.3868---
2.255000.3798---
2.2456000.4385---
2.280057000.3965---
2.3258000.3895---
2.3659000.4484---
2.460000.3452---
2.4461000.3905---
2.4862000.376---
2.5263000.4986---
2.5664000.3732---
2.665000.3632---
2.6466000.3915---
2.6867000.4394---
2.720068000.3852---
2.7669000.3984---
2.870000.426---
2.8471000.3274---
2.8872000.4673---
2.9273000.4599---
2.9674000.4304---
3.075000.41510.89670.4007-
3.0476000.2345---
3.0877000.1807---
3.1278000.2984---
3.1679000.2357---
3.280000.4506---
3.2481000.2178---
3.280082000.2654---
3.3283000.2863---
3.3684000.2626---
3.485000.3281---
3.4486000.2555---
3.4887000.4245---
3.5288000.2368---
3.5689000.3288---
3.690000.3417---
3.6491000.3249---
3.6892000.3378---
3.720093000.233---
3.7694000.3215---
3.895000.251---
3.8496000.3138---
3.8897000.3081---
3.9298000.3875---
3.9699000.3231---
4.0100000.21191.49830.4129-
4.04101000.1323---
4.08102000.2222---
4.12103000.2005---
4.16104000.127---
4.2105000.1052---
4.24106000.1657---
4.28107000.2305---
4.32108000.1048---
4.36109000.2081---
4.4110000.201---
4.44111000.1515---
4.48112000.2112---
4.52113000.1936---
4.5600114000.1578---
4.6115000.2551---
4.64116000.2888---
4.68117000.128---
4.72118000.2172---
4.76119000.114---
4.8120000.2135---
4.84121000.2421---
4.88122000.2392---
4.92123000.1478---
4.96124000.1901---
5.0125000.22191.95820.3469-
5.04126000.1586---
5.08127000.1587---
5.12128000.0663---
5.16129000.0703---
5.2130000.0783---
5.24131000.1143---
5.28132000.1155---
5.32133000.0661---
5.36134000.0935---
5.4135000.1344---
5.44136000.1031---
5.48137000.1294---
5.52138000.103---
5.5600139000.0739---
5.6140000.1477---
5.64141000.1171---
5.68142000.1504---
5.72143000.1122---
5.76144000.1279---
5.8145000.0813---
5.84146000.1372---
5.88147000.1615---
5.92148000.1944---
5.96149000.0436---
6.0150000.11952.22200.3559-
0.081000.0844---
0.162000.1357---
0.243000.1382---
0.324000.2091---
0.45000.2351---
0.486000.2976---
0.567000.3408---
0.648000.2656---
0.729000.3183---
0.810000.2513---
0.8811000.2293---
0.9612000.3241---
1.01250-1.18130.3495-
0.31951000.6132---
0.63902000.1554---
0.95853000.1366---
1.0313-1.28670.3839-
0.081000.2713---
0.162000.1273---
0.243000.0883---
0.324000.0749---
0.081000.0653---
0.162000.0311---
0.243000.0368---
0.324000.0259---
0.45000.059---
0.486000.046---
0.567000.1266---
0.648000.0661---
0.729000.0676---
0.810000.0759---
0.8811000.0527---
0.9612000.1038---
1.01250-2.24110.3892-
1.0413000.0456---
1.1214000.1363---
1.215000.1398---
1.2816000.1237---
1.360017000.123---
1.4418000.1893---
1.5219000.1192---
1.620000.1347---
1.680021000.0937---
1.7622000.1506---
1.840023000.1366---
1.9224000.1194---
2.025000.14852.13400.3245-
2.0826000.0485---
2.1627000.0579---
2.2428000.0932---
2.3229000.0743---
2.430000.0783---
2.4831000.0918---
2.5632000.0973---
2.6433000.0623---
2.720034000.1284---
2.835000.1247---
2.8836000.0648---
2.9637000.0921---
3.03750-2.43540.2824-
3.0438000.04---
3.1239000.0417---
3.240000.0414---
3.280041000.0485---
3.3642000.0255---
3.4443000.0688---
3.5244000.0574---
3.645000.0766---
3.6846000.0481---
3.7647000.06---
3.8448000.0528---
3.9249000.0426---
4.050000.0922.54270.3284-
4.0851000.0349---
4.1652000.0107---
4.2453000.0608---
4.3254000.0473---
4.455000.0452---
4.4856000.0316---
4.560057000.0096---
4.6458000.0511---
4.7259000.0207---
4.860000.0061---
4.8861000.0381---
4.9662000.0378---
5.06250-2.60610.3061-
5.0463000.0326---
5.1264000.0349---
5.265000.0128---
5.2866000.0185---
5.3667000.0145---
5.4468000.0521---
5.5269000.0427---
5.670000.0215---
5.6871000.0195---
5.7672000.0426---
5.8473000.057---
5.9274000.0106---
6.075000.02842.83480.3291-
6.0876000.0286---
6.1677000.018---
6.2478000.0224---
6.3279000.0102---
6.480000.0287---
6.4881000.0078---
6.560082000.0237---
6.6483000.0148---
6.7284000.0271---
6.885000.015---
6.8886000.0278---
6.9687000.0237---
7.08750-2.87850.3188-
7.0488000.0203---
7.1289000.0089---
7.290000.0121---
7.2891000.0185---
7.3692000.0127---
7.4493000.017---
7.5294000.0117---
7.695000.006---
7.6896000.0061---
7.7697000.0141---
7.8498000.0091---
7.9299000.0164---
8.0100000.02442.80540.3040-
8.08101000.0001---
8.16102000.0187---
8.24103000.0098---
8.32104000.0114---
8.4105000.004---
8.48106000.0017---
8.56107000.0018---
8.64108000.009---
8.72109000.0047---
8.8110000.0014---
8.88111000.0049---
8.96112000.006---
9.011250-2.94600.2967-
9.04113000.0057---
9.12114000.0051---
9.2115000.0067---
9.28116000.0009---
9.36117000.0046---
9.44118000.0138---
9.52119000.0067---
9.6120000.0043---
9.68121000.001---
9.76122000.0004---
9.84123000.0044---
9.92124000.003---
10.0125000.00552.97140.30300.0969

</details>

Framework Versions

  • —Python: 3.10.12
  • —Sentence Transformers: 3.0.1
  • —Transformers: 4.41.2
  • —PyTorch: 2.3.0+cu121
  • —Accelerate: 0.31.0
  • —Datasets: 2.20.0
  • —Tokenizers: 0.19.1

Citation

BibTeX

Sentence Transformers and SoftmaxLoss
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",
}

<!--

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