Team Ai
Modelpublic

LakoreAI/mmbert-base-vn-sts-001

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes46downloads
Model Card

SentenceTransformer based on jhu-clsp/mmBERT-base

This is a sentence-transformers model finetuned from jhu-clsp/mmBERT-base. 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: jhu-clsp/mmBERT-base <!-- at revision c5955035435e2bf121cde7f3c8863ef52ff35d82 -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 768 dimensions
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
  (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("8Opt/mmbert-base-vn-sts-001")
# Run inference
sentences = [
    'Một người đàn ông đang ngồi gần một chiếc xe đạp và đang viết một ghi chú',
    'Một người đàn ông mặc quần áo được phủ sơn và đang ngồi bên ngoài trong một khu vực đông đúc để viết một cái gì đó',
    'Các vận động viên khuyết tật chuẩn bị sẵn sàng, làm dấy lên những câu hỏi về hậu cần và sự công bằng.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.8503, 0.7796],
#         [0.8503, 1.0000, 0.7599],
#         [0.7796, 0.7599, 1.0000]])

<!--

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
Metric8Opt-sts-dev-00018Opt-sts-test-0002
pearson_cosine0.71130.7113
spearman_cosine0.73180.7318

<!--

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

Unnamed Dataset
  • —Size: 28,990 training samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | score | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 6 tokens</li><li>mean: 18.02 tokens</li><li>max: 74 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 17.77 tokens</li><li>max: 81 tokens</li></ul> | <ul><li>min: 0.04</li><li>mean: 2.6</li><li>max: 5.0</li></ul> |
  • —Samples: | sentence1 | sentence2 | score | |:------------------------------------------------------------|:-------------------------------------------------------------------------------|:-----------------| | <code>Một con chó đen đang chạy trong tuyết.</code> | <code>Một con chó đen đang chạy trên bãi biển.</code> | <code>1.8</code> | | <code>bóng đèn a tạo ra một khoảng trống</code> | <code>nếu bóng đèn a cháy ra, cả b và c đều không ở trong một đường kín</code> | <code>1.8</code> | | <code>Sự phát triển an ninh tại Iraq, ngày 1 tháng 2</code> | <code>Sự phát triển an ninh tại Pakistan, ngày 13 tháng 3</code> | <code>1.6</code> |
  • —Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 4,141 evaluation samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | score | |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 3 tokens</li><li>mean: 18.71 tokens</li><li>max: 107 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 17.54 tokens</li><li>max: 91 tokens</li></ul> | <ul><li>min: 0.04</li><li>mean: 2.56</li><li>max: 5.0</li></ul> |
  • —Samples: | sentence1 | sentence2 | score | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------|:-----------------| | <code>một đơn vị đáp ứng các điều kiện tiên quyết để tham gia vào một sự kiện. một mức độ sửa đổi có thể được bao gồm để chỉ ra bao nhiêu đơn vị vượt quá hoặc không đạt được các yêu cầu tối thiểu.</code> | <code>(thường theo sau là `to ') có phương tiện cần thiết hoặc kỹ năng hoặc bí quyết hoặc thẩm quyền để làm một cái gì đó;</code> | <code>0.4</code> | | <code>Tôi sẽ không đưa nó vào hồ sơ của mình.</code> | <code>Tôi sẽ không đưa công việc này vào hồ sơ của mình.</code> | <code>4.0</code> | | <code>Một cậu bé trẻ với một chiếc áo khoác chứa tim đang nâng tay lên khi anh ta trượt</code> | <code>Một đứa trẻ tóc vàng đang đi xuống một slide và ném lên tay của mình</code> | <code>3.7</code> |
  • —Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

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: 5
  • —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
  • —torch_empty_cache_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: 5
  • —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
  • —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}
  • —parallelism_config: None
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamwtorchfused
  • —optim_args: None
  • —adafactor: False
  • —group_by_length: False
  • —length_column_name: length
  • —project: huggingface
  • —trackio_space_id: trackio
  • —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
  • —hub_revision: None
  • —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
  • —include_tokens_per_second: False
  • —include_num_input_tokens_seen: no
  • —neftune_noise_alpha: None
  • —optim_target_modules: None
  • —batch_eval_metrics: False
  • —eval_on_start: False
  • —use_liger_kernel: False
  • —liger_kernel_config: None
  • —eval_use_gather_object: False
  • —average_tokens_across_devices: True
  • —prompts: None
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining LossValidation Loss8Opt-sts-dev-0001_spearman_cosine8Opt-sts-test-0002_spearman_cosine
0.11041006.22856.18940.4639-
0.22082006.09126.03580.5950-
0.33113006.05726.03730.6327-
0.44154005.98955.99310.6654-
0.55195005.98725.97710.6707-
0.66236005.95835.96190.6785-
0.77267005.95175.98310.6930-
0.88308005.98665.94330.6980-
0.99349005.95415.94600.6964-
1.103810005.86525.93860.7174-
1.214111005.85775.93610.7077-
1.324512005.85185.94120.7201-
1.434913005.86365.92550.7257-
1.545314005.83425.94300.7134-
1.655615005.83095.97650.7177-
1.766016005.8535.91250.7289-
1.876417005.83695.91120.7324-
1.986818005.85045.90320.7335-
2.097119005.70315.98220.7343-
2.207520005.69346.00050.7328-
2.317921005.65746.09130.7277-
2.428322005.66716.05130.7255-
2.538623005.66325.97860.7325-
2.649024005.67466.00000.7342-
2.759425005.69955.94920.7366-
2.869826005.68146.02960.7315-
2.980127005.66896.05080.7310-
3.090528005.48256.21920.7296-
3.200929005.46866.25240.7295-
3.311330005.46986.18610.7294-
3.421631005.49576.28150.7296-
3.532032005.49936.22040.7309-
3.642433005.51126.13720.7334-
3.752834005.52596.10050.7337-
3.863135005.51446.23050.7329-
3.973536005.47856.19300.7354-
4.083937005.3676.59860.7276-
4.194338005.29086.66950.7259-
4.304639005.31256.63570.7264-
4.415040005.29676.65880.7296-
4.525441005.30196.66310.7313-
4.635842005.29516.71490.7327-
4.746143005.26096.72350.7323-
4.856544005.29696.69870.7319-
4.966945005.29386.70050.7318-
-1-1---0.7318

Framework Versions

  • —Python: 3.12.12
  • —Sentence Transformers: 5.1.2
  • —Transformers: 4.57.1
  • —PyTorch: 2.8.0+cu126
  • —Accelerate: 1.11.0
  • —Datasets: 4.0.0
  • —Tokenizers: 0.22.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
@article{10531646,
    author={Huang, Xiang and Peng, Hao and Zou, Dongcheng and Liu, Zhiwei and Li, Jianxin and Liu, Kay and Wu, Jia and Su, Jianlin and Yu, Philip S.},
    journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing},
    title={CoSENT: Consistent Sentence Embedding via Similarity Ranking},
    year={2024},
    doi={10.1109/TASLP.2024.3402087}
}

<!--

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