Downloads · 30 days
70
16% of all-time downloads
song9/embeddinggemma-300m-KorSTS
embeddinggemma-300m-KorSTS is a sentence similarity model from song9. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as cc-by-sa-4.0.
This is a sentence-transformers model finetuned from google/embeddinggemma-300m. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search,…
Downloads · 30 days
70
16% of all-time downloads
All-time downloads
435
Public
Parameters
303M
1.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.2 GB · 97%
From the Hugging Face model README
This is a sentence-transformers model finetuned from google/embeddinggemma-300m. 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.
<span style="color:green;font-weight:bold">Training Code:</span> skier-song9/DL_study/codes/nlp/Finetune_Kor_STS.ipynb
Documentation: Sentence Transformers Documentation
Repository: Sentence Transformers on GitHub
Hugging Face: Sentence Transformers on Hugging Face
SentenceTransformer(
(0): Transformer({'max_seq_length': 2048, 'do_lower_case': False, 'architecture': 'Gemma3TextModel'})
(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})
(2): Dense({'in_features': 768, 'out_features': 3072, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
(3): Dense({'in_features': 3072, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
(4): Normalize()
)
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("song9/embeddinggemma-300m-KorSTS")
# Run inference
queries = [
"한 소녀가 머리를 스타일링하고 있다.",
]
sentences = [
'한 소녀가 머리를 빗고 있다.',
'한 무리의 소년들이 해변에서 축구를 하고 있다.',
'한 여자는 다른 여자의 발목을 측정한다.',
'한 남자가 키보드를 연주하고 있다.',
'한 남자가 하프를 연주하고 있다.',
]
query_embeddings = model.encode(queries)
sentences_embeddings = model.encode(sentences)
print(query_embeddings.shape, sentences_embeddings.shape)
# (1, 768) (5, 768)
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, sentences_embeddings)
print(similarities)
# tensor([[0.7389, 0.1011, 0.0921, 0.0836, 0.1487]])
<!--
### 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.*
-->
korsts-dev and korsts-test| Metric | korsts-dev | korsts-test |
|---|---|---|
| pearson_cosine | 0.8305 | 0.7765 |
| spearman_cosine | 0.8285 | 0.7633 |
korsts-test. After dropping NaN data in korsts-test, spearman_cosine increases.
| Metric | korsts-test (w/o NaN) |
|:--------------------|:------------|
| pearson_cosine | 0.7829 |
| spearman_cosine | 0.7689 |korsts-dev| Metric | Value |
|---|---|
| pearson_cosine | 0.7765 |
| spearman_cosine | 0.7633 |
| sentence1 | sentence2 | label | |
|---|---|---|---|
| type | string | string | float |
| details | <ul><li>min: 8 tokens</li><li>mean: 13.14 tokens</li><li>max: 35 tokens</li></ul> | <ul><li>min: 8 tokens</li><li>mean: 12.96 tokens</li><li>max: 30 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.45</li><li>max: 1.0</li></ul> |
| sentence1 | sentence2 | label |
|---|---|---|
| <code>비행기가 이륙하고 있다.</code> | <code>비행기가 이륙하고 있다.</code> | <code>1.0</code> |
| <code>한 남자가 큰 플루트를 연주하고 있다.</code> | <code>남자가 플루트를 연주하고 있다.</code> | <code>0.76</code> |
| <code>한 남자가 피자에 치즈를 뿌려놓고 있다.</code> | <code>한 남자가 구운 피자에 치즈 조각을 뿌려놓고 있다.</code> | <code>0.76</code> |
{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
| sentence1 | sentence2 | label | |
|---|---|---|---|
| type | string | string | float |
| details | <ul><li>min: 7 tokens</li><li>mean: 19.41 tokens</li><li>max: 159 tokens</li></ul> | <ul><li>min: 2 tokens</li><li>mean: 19.24 tokens</li><li>max: 51 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.42</li><li>max: 1.0</li></ul> |
| sentence1 | sentence2 | label |
|---|---|---|
| <code>안전모를 가진 한 남자가 춤을 추고 있다.</code> | <code>안전모를 쓴 한 남자가 춤을 추고 있다.</code> | <code>1.0</code> |
| <code>어린아이가 말을 타고 있다.</code> | <code>아이가 말을 타고 있다.</code> | <code>0.95</code> |
| <code>한 남자가 뱀에게 쥐를 먹이고 있다.</code> | <code>남자가 뱀에게 쥐를 먹이고 있다.</code> | <code>1.0</code> |
{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
eval_strategy: stepsgradient_accumulation_steps: 2torch_empty_cache_steps: 20learning_rate: 2e-06max_steps: 800lr_scheduler_type: cosinebf16: Truebf16_full_eval: Trueload_best_model_at_end: Truepush_to_hub: Truehub_model_id: song9/embeddinggemma-300m-KorSTShub_strategy: endauto_find_batch_size: Trueoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 8per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 2eval_accumulation_steps: Nonetorch_empty_cache_steps: 20learning_rate: 2e-06weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 3max_steps: 800lr_scheduler_type: cosinelr_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: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Truefp16_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: Trueignore_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: Trueresume_from_checkpoint: Nonehub_model_id: song9/embeddinggemma-300m-KorSTShub_strategy: endhub_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: Truefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: 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: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss | korsts-dev_spearman_cosine | korsts-test_spearman_cosine |
|---|---|---|---|---|---|
| 0.5618 | 100 | 0.0881 | 0.0300 | 0.8188 | - |
| 1.1236 | 200 | 0.0627 | 0.027 | 0.8362 | - |
| 1.6854 | 300 | 0.0382 | 0.0275 | 0.8334 | - |
| 2.2472 | 400 | 0.0277 | 0.0276 | 0.8340 | - |
| 2.8090 | 500 | 0.016 | 0.0277 | 0.8320 | - |
| 3.3708 | 600 | 0.0105 | 0.0280 | 0.8296 | - |
| 3.9326 | 700 | 0.0078 | 0.0281 | 0.8289 | - |
| 4.4944 | 800 | 0.0054 | 0.0282 | 0.8285 | - |
| -1 | -1 | - | - | 0.7633 | 0.7633 |
@article{ham2020kornli,
title={KorNLI and KorSTS: New Benchmark Datasets for Korean Natural Language Understanding},
author={Ham, Jiyeon and Choe, Yo Joong and Park, Kyubyong and Choi, Ilji and Soh, Hyungjoon},
journal={arXiv preprint arXiv:2004.03289},
year={2020}
}
@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.*
-->