allstats-v1-2 / README.md
yahyaabd's picture
Add new SentenceTransformer model
e221e1e verified
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:79621
- loss:CosineSimilarityLoss
base_model: sentence-transformers/paraphrase-multilingual-mpnet-base-v2
widget:
- source_sentence: Data demografi Indonesia 2021 perempuan dan lakilaki
sentences:
- Buletin Statistik Perdagangan Luar Negeri Ekspor Menurut Komoditi HS, Februari
2015
- Statistik Potensi Desa Provinsi Jawa Barat 2014
- Pengeluaran untuk Konsumsi Penduduk Indonesia, September 2017
- source_sentence: Data analisis tematik kependudukan Indonesia migrasi dan ketenagakerjaan
sentences:
- Direktori Perusahaan Industri Penggilingan Padi Tahun 2012 Provinsi Bengkulu
- Buletin Statistik Perdagangan Luar Negeri Ekspor Menurut HS, Juni 2023
- Luas Panen dan Produksi Padi 2022
- source_sentence: Daftar perusahaan penggilingan padi Kalimantan
sentences:
- Ringkasan Neraca Arus Dana, Triwulan II, 2011*), (Miliar Rupiah)
- Klasifikasi Baku Komoditas Indonesia 2012 Buku 1
- Statistik Penduduk Lanjut Usia Provinsi Nusa Tenggara Barat 2010-Hasil Sensus
Penduduk 2010
- source_sentence: Perdagangan luar negeri impor Januari 2010
sentences:
- Buletin Statistik Perdagangan Luar Negeri Impor Januari 2010
- Statistik Tanaman Sayuran dan Buah-buahan Semusim Indonesia 2012
- Klasifikasi Baku Komoditas Indonesia (KBKI) 2012 Buku 4
- source_sentence: Biaya hidup kelompok perumahan Indonesia 2017
sentences:
- Indeks Harga Perdagangan Besar 2007
- Statistik Upah 2013
- Survei Biaya Hidup (SBH) 2018 Bulukumba, Watampone, Makassar, Pare-Pare, dan Palopo
datasets:
- yahyaabd/allstats-search-pairs-dataset
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- pearson_cosine
- spearman_cosine
model-index:
- name: SentenceTransformer based on sentence-transformers/paraphrase-multilingual-mpnet-base-v2
results:
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: allstats semantic mpnet eval
type: allstats-semantic-mpnet-eval
metrics:
- type: pearson_cosine
value: 0.9832363617810226
name: Pearson Cosine
- type: spearman_cosine
value: 0.858203940325394
name: Spearman Cosine
- task:
type: semantic-similarity
name: Semantic Similarity
dataset:
name: allstats semantic mpnet test
type: allstats-semantic-mpnet-test
metrics:
- type: pearson_cosine
value: 0.9839788057910102
name: Pearson Cosine
- type: spearman_cosine
value: 0.8555371006656465
name: Spearman Cosine
---
# SentenceTransformer based on sentence-transformers/paraphrase-multilingual-mpnet-base-v2
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/paraphrase-multilingual-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2) on the [allstats-search-pairs-dataset](https://huggingface.co/datasets/yahyaabd/allstats-search-pairs-dataset) 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:** [sentence-transformers/paraphrase-multilingual-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2) <!-- at revision 75c57757a97f90ad739aca51fa8bfea0e485a7f2 -->
- **Maximum Sequence Length:** 128 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
- [allstats-search-pairs-dataset](https://huggingface.co/datasets/yahyaabd/allstats-search-pairs-dataset)
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(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("yahyaabd/allstats-v1-2")
# Run inference
sentences = [
'Biaya hidup kelompok perumahan Indonesia 2017',
'Statistik Upah 2013',
'Survei Biaya Hidup (SBH) 2018 Bulukumba, Watampone, Makassar, Pare-Pare, dan Palopo',
]
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
* Datasets: `allstats-semantic-mpnet-eval` and `allstats-semantic-mpnet-test`
* Evaluated with [<code>EmbeddingSimilarityEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator)
| Metric | allstats-semantic-mpnet-eval | allstats-semantic-mpnet-test |
|:--------------------|:-----------------------------|:-----------------------------|
| pearson_cosine | 0.9832 | 0.984 |
| **spearman_cosine** | **0.8582** | **0.8555** |
<!--
## 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
#### allstats-search-pairs-dataset
* Dataset: [allstats-search-pairs-dataset](https://huggingface.co/datasets/yahyaabd/allstats-search-pairs-dataset) at [6712cb1](https://huggingface.co/datasets/yahyaabd/allstats-search-pairs-dataset/tree/6712cb14bbd89da6f87890ac082b09e0adb7a02e)
* Size: 79,621 training samples
* Columns: <code>query</code>, <code>doc</code>, and <code>label</code>
* Approximate statistics based on the first 1000 samples:
| | query | doc | label |
|:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------|
| type | string | string | float |
| details | <ul><li>min: 5 tokens</li><li>mean: 10.78 tokens</li><li>max: 39 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 13.73 tokens</li><li>max: 58 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.44</li><li>max: 0.99</li></ul> |
* Samples:
| query | doc | label |
|:--------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------|:------------------|
| <code>Produksi jagung di Indonesia tahun 2009</code> | <code>Indeks Unit Value Ekspor Menurut Kode SITC Bulan Februari 2024</code> | <code>0.1</code> |
| <code>Data produksi industri manufaktur 2021</code> | <code>Perkembangan Indeks Produksi Industri Manufaktur 2021</code> | <code>0.96</code> |
| <code>direktori perusahaan industri penggilingan padi tahun 2012 provinsi sulawesi utara dan gorontalo</code> | <code>Neraca Pemerintahan Umum Indonesia 2007-2012</code> | <code>0.03</code> |
* Loss: [<code>CosineSimilarityLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
```json
{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
```
### Evaluation Dataset
#### allstats-search-pairs-dataset
* Dataset: [allstats-search-pairs-dataset](https://huggingface.co/datasets/yahyaabd/allstats-search-pairs-dataset) at [6712cb1](https://huggingface.co/datasets/yahyaabd/allstats-search-pairs-dataset/tree/6712cb14bbd89da6f87890ac082b09e0adb7a02e)
* Size: 9,952 evaluation samples
* Columns: <code>query</code>, <code>doc</code>, and <code>label</code>
* Approximate statistics based on the first 1000 samples:
| | query | doc | label |
|:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------|
| type | string | string | float |
| details | <ul><li>min: 5 tokens</li><li>mean: 10.75 tokens</li><li>max: 40 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 14.09 tokens</li><li>max: 49 tokens</li></ul> | <ul><li>min: 0.01</li><li>mean: 0.48</li><li>max: 0.99</li></ul> |
* Samples:
| query | doc | label |
|:--------------------------------------------------------------------|:-----------------------------------------------------------------|:------------------|
| <code>Daftar perusahaan industri pengolahan skala kecil 2006</code> | <code>Statistik Migrasi Nusa Tenggara Barat Hasil SP 2010</code> | <code>0.05</code> |
| <code>Populasi Indonesia per provinsi 2000-2010</code> | <code>Indikator Ekonomi Desember 2023</code> | <code>0.08</code> |
| <code>Data harga barang desa non-pangan tahun 2022</code> | <code>Statistik Kunjungan Tamu Asing 2004</code> | <code>0.1</code> |
* Loss: [<code>CosineSimilarityLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cosinesimilarityloss) with these parameters:
```json
{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 64
- `per_device_eval_batch_size`: 64
- `num_train_epochs`: 16
- `warmup_ratio`: 0.1
- `fp16`: True
- `dataloader_num_workers`: 4
- `load_best_model_at_end`: True
- `label_smoothing_factor`: 0.01
- `eval_on_start`: True
#### 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`: 64
- `per_device_eval_batch_size`: 64
- `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`: 5e-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`: 16
- `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`: 4
- `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}
- `deepspeed`: None
- `label_smoothing_factor`: 0.01
- `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`: 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
- `eval_on_start`: True
- `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
</details>
### Training Logs
| Epoch | Step | Training Loss | Validation Loss | allstats-semantic-mpnet-eval_spearman_cosine | allstats-semantic-mpnet-test_spearman_cosine |
|:-----------:|:---------:|:-------------:|:---------------:|:--------------------------------------------:|:--------------------------------------------:|
| 0 | 0 | - | 0.0958 | 0.6404 | - |
| 0.2008 | 250 | 0.0493 | 0.0262 | 0.7681 | - |
| 0.4016 | 500 | 0.0232 | 0.0187 | 0.7719 | - |
| 0.6024 | 750 | 0.0182 | 0.0157 | 0.7784 | - |
| 0.8032 | 1000 | 0.0163 | 0.0142 | 0.7805 | - |
| 1.0040 | 1250 | 0.0141 | 0.0137 | 0.7782 | - |
| 1.2048 | 1500 | 0.0114 | 0.0121 | 0.7815 | - |
| 1.4056 | 1750 | 0.0108 | 0.0115 | 0.7848 | - |
| 1.6064 | 2000 | 0.0109 | 0.0111 | 0.7873 | - |
| 1.8072 | 2250 | 0.0101 | 0.0103 | 0.7923 | - |
| 2.0080 | 2500 | 0.0096 | 0.0103 | 0.7931 | - |
| 2.2088 | 2750 | 0.0074 | 0.0092 | 0.7941 | - |
| 2.4096 | 3000 | 0.0067 | 0.0089 | 0.7985 | - |
| 2.6104 | 3250 | 0.0065 | 0.0086 | 0.8016 | - |
| 2.8112 | 3500 | 0.0064 | 0.0083 | 0.8017 | - |
| 3.0120 | 3750 | 0.0064 | 0.0084 | 0.8049 | - |
| 3.2129 | 4000 | 0.0045 | 0.0078 | 0.8090 | - |
| 3.4137 | 4250 | 0.0046 | 0.0078 | 0.8078 | - |
| 3.6145 | 4500 | 0.0043 | 0.0075 | 0.8111 | - |
| 3.8153 | 4750 | 0.0047 | 0.0074 | 0.8103 | - |
| 4.0161 | 5000 | 0.0047 | 0.0077 | 0.8084 | - |
| 4.2169 | 5250 | 0.0036 | 0.0072 | 0.8161 | - |
| 4.4177 | 5500 | 0.0034 | 0.0070 | 0.8187 | - |
| 4.6185 | 5750 | 0.0033 | 0.0068 | 0.8186 | - |
| 4.8193 | 6000 | 0.0035 | 0.0068 | 0.8220 | - |
| 5.0201 | 6250 | 0.0033 | 0.0071 | 0.8193 | - |
| 5.2209 | 6500 | 0.0027 | 0.0067 | 0.8239 | - |
| 5.4217 | 6750 | 0.0026 | 0.0069 | 0.8269 | - |
| 5.6225 | 7000 | 0.0027 | 0.0064 | 0.8275 | - |
| 5.8233 | 7250 | 0.0026 | 0.0066 | 0.8278 | - |
| 6.0241 | 7500 | 0.0026 | 0.0064 | 0.8293 | - |
| 6.2249 | 7750 | 0.0019 | 0.0064 | 0.8298 | - |
| 6.4257 | 8000 | 0.0019 | 0.0062 | 0.8319 | - |
| 6.6265 | 8250 | 0.0021 | 0.0064 | 0.8300 | - |
| 6.8273 | 8500 | 0.0022 | 0.0061 | 0.8338 | - |
| 7.0281 | 8750 | 0.0021 | 0.0063 | 0.8330 | - |
| 7.2289 | 9000 | 0.0016 | 0.0061 | 0.8374 | - |
| 7.4297 | 9250 | 0.0016 | 0.0059 | 0.8394 | - |
| 7.6305 | 9500 | 0.0016 | 0.0060 | 0.8379 | - |
| 7.8313 | 9750 | 0.0017 | 0.0062 | 0.8371 | - |
| 8.0321 | 10000 | 0.0017 | 0.0061 | 0.8392 | - |
| 8.2329 | 10250 | 0.0013 | 0.0061 | 0.8407 | - |
| 8.4337 | 10500 | 0.0013 | 0.0059 | 0.8418 | - |
| 8.6345 | 10750 | 0.0014 | 0.0060 | 0.8400 | - |
| 8.8353 | 11000 | 0.0014 | 0.0064 | 0.8415 | - |
| 9.0361 | 11250 | 0.0013 | 0.0060 | 0.8428 | - |
| 9.2369 | 11500 | 0.001 | 0.0058 | 0.8435 | - |
| 9.4378 | 11750 | 0.0011 | 0.0058 | 0.8458 | - |
| 9.6386 | 12000 | 0.0011 | 0.0060 | 0.8460 | - |
| 9.8394 | 12250 | 0.0011 | 0.0060 | 0.8468 | - |
| 10.0402 | 12500 | 0.0011 | 0.0060 | 0.8448 | - |
| 10.2410 | 12750 | 0.0009 | 0.0060 | 0.8476 | - |
| 10.4418 | 13000 | 0.0008 | 0.0059 | 0.8489 | - |
| 10.6426 | 13250 | 0.0009 | 0.0058 | 0.8485 | - |
| 10.8434 | 13500 | 0.0009 | 0.0059 | 0.8496 | - |
| 11.0442 | 13750 | 0.0008 | 0.0059 | 0.8492 | - |
| 11.2450 | 14000 | 0.0007 | 0.0058 | 0.8489 | - |
| 11.4458 | 14250 | 0.0007 | 0.0058 | 0.8507 | - |
| 11.6466 | 14500 | 0.0007 | 0.0057 | 0.8515 | - |
| 11.8474 | 14750 | 0.0007 | 0.0058 | 0.8505 | - |
| 12.0482 | 15000 | 0.0007 | 0.0058 | 0.8515 | - |
| 12.2490 | 15250 | 0.0006 | 0.0058 | 0.8523 | - |
| 12.4498 | 15500 | 0.0006 | 0.0057 | 0.8525 | - |
| 12.6506 | 15750 | 0.0006 | 0.0056 | 0.8542 | - |
| 12.8514 | 16000 | 0.0006 | 0.0056 | 0.8545 | - |
| 13.0522 | 16250 | 0.0006 | 0.0056 | 0.8550 | - |
| 13.2530 | 16500 | 0.0005 | 0.0056 | 0.8550 | - |
| 13.4538 | 16750 | 0.0005 | 0.0056 | 0.8553 | - |
| 13.6546 | 17000 | 0.0005 | 0.0055 | 0.8556 | - |
| 13.8554 | 17250 | 0.0005 | 0.0056 | 0.8559 | - |
| 14.0562 | 17500 | 0.0005 | 0.0056 | 0.8561 | - |
| 14.2570 | 17750 | 0.0004 | 0.0055 | 0.8570 | - |
| 14.4578 | 18000 | 0.0004 | 0.0055 | 0.8567 | - |
| 14.6586 | 18250 | 0.0004 | 0.0055 | 0.8575 | - |
| 14.8594 | 18500 | 0.0004 | 0.0055 | 0.8575 | - |
| **15.0602** | **18750** | **0.0004** | **0.0055** | **0.858** | **-** |
| 15.2610 | 19000 | 0.0004 | 0.0055 | 0.8583 | - |
| 15.4618 | 19250 | 0.0003 | 0.0055 | 0.8583 | - |
| 15.6627 | 19500 | 0.0004 | 0.0055 | 0.8581 | - |
| 15.8635 | 19750 | 0.0004 | 0.0055 | 0.8582 | - |
| 16.0 | 19920 | - | - | - | 0.8555 |
* The bold row denotes the saved checkpoint.
### Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.3.1
- Transformers: 4.47.0
- PyTorch: 2.5.1+cu121
- Accelerate: 1.2.1
- Datasets: 3.2.0
- Tokenizers: 0.21.0
## 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",
}
```
<!--
## 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.*
-->