Sentence Similarity
sentence-transformers
Safetensors
gemma3_text
feature-extraction
Generated from Trainer
dataset_size:3396
loss:SoftmaxLoss
text-embeddings-inference
Instructions to use cafierom/smiles_embedding_gemma_FT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use cafierom/smiles_embedding_gemma_FT with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("cafierom/smiles_embedding_gemma_FT") sentences = [ "C[C@H](CCCC(C)(C)O)[C@H]1CC[C@H]2[C@@H]3CC=C4C[C@@H](O)CC[C@]4(C)[C@H]3CC[C@]12C", "CC(C)n1c(CC[C@@H](O)C[C@@H](O)CC([O-])=O)c(c(c1C(=O)NCc1ccccn1)-c1ccccc1)-c1ccc(F)cc1", "Cc1cc(OCc2ccccc2)cc(C)c1\\C=C\\[C@@H]1C[C@@H](O)CC(=O)O1", "Cc1ccc(C2CC3CCC2C=C3)n1CC[C@@H]1C[C@@H](O)CC(=O)O1" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:3396
- loss:SoftmaxLoss
base_model: google/embeddinggemma-300m
widget:
- source_sentence: >-
C[C@H](CCCC(C)(C)O)[C@H]1CC[C@H]2[C@@H]3CC=C4C[C@@H](O)CC[C@]4(C)[C@H]3CC[C@]12C
sentences:
- >-
CC(C)n1c(CC[C@@H](O)C[C@@H](O)CC([O-])=O)c(c(c1C(=O)NCc1ccccn1)-c1ccccc1)-c1ccc(F)cc1
- Cc1cc(OCc2ccccc2)cc(C)c1\C=C\[C@@H]1C[C@@H](O)CC(=O)O1
- Cc1ccc(C2CC3CCC2C=C3)n1CC[C@@H]1C[C@@H](O)CC(=O)O1
- source_sentence: >-
CC[C@H](C)C(=O)O[C@H]1C[C@H](C)C=C2C=C[C@H](C)[C@H](CC[C@@H]3C[C@@H](O)CC(=O)O3)[C@@H]12
sentences:
- >-
CC(C)c1c(\C=C\[C@@H](O)C[C@@H](O)CC([O-])=O)c(c(C)n1-c1ccccc1)-c1ccc(F)cc1
- >-
CC(C)c1c(C(=O)Nc2ccccc2)c(c(-c2ccc(F)cc2)n1CC[C@@H](O)C[C@@H](O)CC(=O)NO)-c1ccccc1
- >-
CC(C)c1c(c(c(-c2ccc(F)cc2)n1CC[C@@H](O)C[C@@H](O)CC([O-])=O)-c1ccc(F)cc1)S(=O)(=O)Nc1ccccc1
- source_sentence: >-
CC[C@H](C)C(=O)O[C@H]1CCC=C2C=C[C@H](C)[C@H](CC[C@@H]3C[C@@H](O)CC(=O)O3)[C@@H]12
sentences:
- Cc1cc(C)c(OCC(O)C[C@@H](O)CC([O-])=O)c(c1)C(C1CCCCC1)c1ccc(F)cc1
- >-
CCC(CC)(c1ccccc1)c1ccc(\C=C\[C@@H](O)C[C@@H](O)CC([O-])=O)c(c1)-c1ccccc1F
- >-
CC(C)[C@H](NC(=O)[C@H](Cc1ccc(O)cc1)NC(=O)CNC(=O)[C@H](Cc1ccccc1)NC(=O)CN)C(=O)N[C@@H](C)C(=O)N[C@@H](CCC(O)=O)C(O)=O
- source_sentence: CC(C)c1nc(c(-c2ccc(F)cc2)n1\C=C\[C@H](O)C[C@@H](O)CC([O-])=O)-c1ccc(F)cc1
sentences:
- Cc1ccc(-c2cccc3ccccc23)n1CC[C@@H]1C[C@@H](O)CC(=O)O1
- CCCCC#CC#CCCCCCC(O)=O
- >-
CC(C)c1c(OC[C@@H](O)C[C@@H](O)CC(O)=O)n(nc1C(=O)NCc1ccccc1Cl)-c1ccc(F)cc1
- source_sentence: CCC(CC)(c1ccccc1)c1ccc(\C=C\[C@@H](O)C[C@@H](O)CC([O-])=O)c(c1)-c1ccccc1F
sentences:
- >-
CC(C)c1c(c(c(-c2ccc(F)cc2)n1CC[C@@H](O)C[C@@H](O)CC([O-])=O)-c1ccccc1)S(=O)(=O)N(C)C
- >-
O[C@H](CCn1c(nc(c1-c1ccc(F)cc1)-c1ccc(F)cc1)C(F)(F)F)C[C@@H](O)CC([O-])=O
- >-
Cc1ccc(C(=C(\C=C\[C@@H](O)C[C@@H](O)CC([O-])=O)c2nnnn2C)c2ccc(C)cc2C)c(C)c1
pipeline_tag: sentence-similarity
library_name: sentence-transformers
SentenceTransformer based on google/embeddinggemma-300m
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 retrieval.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: google/embeddinggemma-300m
- Maximum Sequence Length: 128 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'Gemma3TextModel'})
(1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Dense({'in_features': 768, 'out_features': 3072, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
(3): Dense({'in_features': 3072, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
(4): Normalize({})
)
Usage
Direct Usage (Sentence Transformers)
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("cafierom/smiles_embedding_gemma_FT")
# Run inference
queries = [
'CCC(CC)(c1ccccc1)c1ccc(\\C=C\\[C@@H](O)C[C@@H](O)CC([O-])=O)c(c1)-c1ccccc1F',
]
documents = [
'Cc1ccc(C(=C(\\C=C\\[C@@H](O)C[C@@H](O)CC([O-])=O)c2nnnn2C)c2ccc(C)cc2C)c(C)c1',
'O[C@H](CCn1c(nc(c1-c1ccc(F)cc1)-c1ccc(F)cc1)C(F)(F)F)C[C@@H](O)CC([O-])=O',
'CC(C)c1c(c(c(-c2ccc(F)cc2)n1CC[C@@H](O)C[C@@H](O)CC([O-])=O)-c1ccccc1)S(=O)(=O)N(C)C',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.9356, 0.9019, 0.5159]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 3,396 training samples
- Columns:
premise,hypothesis, andlabel - Approximate statistics based on the first 100 samples:
premise hypothesis label type string string int modality text text details - min: 18 tokens
- mean: 58.11 tokens
- max: 117 tokens
- min: 11 tokens
- mean: 54.91 tokens
- max: 119 tokens
- 0: ~55.77%
- 2: ~44.23%
- Samples:
premise hypothesis label CCC@HC(=O)O[C@H]1CC@H\C=C\Cc1ccccc1Cc1cc(-c2ccc(Cl)cc2)c(\C=C[C@@H]2CC@@HCC(=O)O2)c(C)n12CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c(c1C(=O)Nc1ccccc1)-c1ccccc1)-c1ccc(F)cc1CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c(c1C(=O)NCc1ccccn1)-c1ccccc1)-c1ccc(F)cc10CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c(c1C(=O)N(C)C)-c1ccccc1)-c1ccc(F)cc1COc1ccc2ccccc2c1-c1ccc(C(C)C)n1CC[C@@H]1CC@@HCC(=O)O12 - Loss:
SoftmaxLosswith these parameters:{ "num_labels": 3, "concatenation_sent_rep": true, "concatenation_sent_difference": true, "concatenation_sent_multiplication": false }
Evaluation Dataset
Unnamed Dataset
- Size: 600 evaluation samples
- Columns:
premise,hypothesis, andlabel - Approximate statistics based on the first 100 samples:
premise hypothesis label type string string int modality text text details - min: 11 tokens
- mean: 56.06 tokens
- max: 101 tokens
- min: 12 tokens
- mean: 55.85 tokens
- max: 119 tokens
- 0: ~41.35%
- 2: ~58.65%
- Samples:
premise hypothesis label CNc1cccc(c1)-c1nc(C(C)C)n(\C=C[C@@H](O)CC@@HCC([O-])=O)c1-c1ccc(F)cc1CC(C)c1c(CCC@@HCC@@HCC([O-])=O)c(cn1-c1ccccc1)-c1ccc(F)cc10CC(C)c1nc(nc(-c2ccc(F)cc2)c1\C=C[C@@H]1CC@@HCC(OCC(Cl)(Cl)Cl)O1)N(C)S(C)(=O)=OCC(C)c1nn(-c2nc3ccccc3s2)c(c1\C=C[C@@H](O)CC@@HCC([O-])=O)-c1ccc(F)cc12Cc1c(\C=C[C@H](O)CC@@HCC([O-])=O)c(cn1-c1ccccc1)-c1ccc(F)cc1CC@H[C@H]1CC(=O)[C@@]2(C)C3=C(C(=O)C[C@]12C)[C@@]1(C)CCC(=O)C@@(COC(=O)CC@@(O)CC(O)=O)[C@@H]1CC3=O2 - Loss:
SoftmaxLosswith these parameters:{ "num_labels": 3, "concatenation_sent_rep": true, "concatenation_sent_difference": true, "concatenation_sent_multiplication": false }
Training Hyperparameters
Non-Default Hyperparameters
warmup_steps: 10optim: adafactorweight_decay: 0.01bf16: Trueload_best_model_at_end: Truedataloader_pin_memory: False
All Hyperparameters
Click to expand
per_device_train_batch_size: 8num_train_epochs: 3max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 10optim: adafactoroptim_args: Noneweight_decay: 0.01adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Truefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 8prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Trueignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Falsedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0471 | 20 | 0.9762 | - |
| 0.0941 | 40 | 0.8931 | - |
| 0.1176 | 50 | - | 0.8680 |
| 0.1412 | 60 | 0.8805 | - |
| 0.1882 | 80 | 0.8463 | - |
| 0.2353 | 100 | 0.8186 | 0.8070 |
| 0.2824 | 120 | 0.8125 | - |
| 0.3294 | 140 | 0.7831 | - |
| 0.3529 | 150 | - | 0.7607 |
| 0.3765 | 160 | 0.7789 | - |
| 0.4235 | 180 | 0.7543 | - |
| 0.4706 | 200 | 0.7119 | 0.7341 |
| 0.5176 | 220 | 0.7230 | - |
| 0.5647 | 240 | 0.7006 | - |
| 0.5882 | 250 | - | 0.6976 |
| 0.6118 | 260 | 0.6999 | - |
| 0.6588 | 280 | 0.6649 | - |
| 0.7059 | 300 | 0.6693 | 0.6542 |
| 0.7529 | 320 | 0.6768 | - |
| 0.8 | 340 | 0.6203 | - |
| 0.8235 | 350 | - | 0.6334 |
| 0.8471 | 360 | 0.6820 | - |
| 0.8941 | 380 | 0.6402 | - |
| 0.9412 | 400 | 0.6327 | 0.6568 |
| 0.9882 | 420 | 0.5882 | - |
| 1.0353 | 440 | 0.6258 | - |
| 1.0588 | 450 | - | 0.6009 |
| 1.0824 | 460 | 0.5778 | - |
| 1.1294 | 480 | 0.6016 | - |
| 1.1765 | 500 | 0.5251 | 0.5823 |
| 1.2235 | 520 | 0.5810 | - |
| 1.2706 | 540 | 0.5700 | - |
| 1.2941 | 550 | - | 0.5618 |
| 1.3176 | 560 | 0.5384 | - |
| 1.3647 | 580 | 0.6171 | - |
| 1.4118 | 600 | 0.5861 | 0.5493 |
| 1.4588 | 620 | 0.5898 | - |
| 1.5059 | 640 | 0.5139 | - |
| 1.5294 | 650 | - | 0.5250 |
| 1.5529 | 660 | 0.5235 | - |
| 1.6 | 680 | 0.4972 | - |
| 1.6471 | 700 | 0.5056 | 0.5538 |
| 1.6941 | 720 | 0.5550 | - |
| 1.7412 | 740 | 0.5275 | - |
| 1.7647 | 750 | - | 0.5268 |
| 1.7882 | 760 | 0.5224 | - |
| 1.8353 | 780 | 0.4965 | - |
| 1.8824 | 800 | 0.4768 | 0.5072 |
| 1.9294 | 820 | 0.5545 | - |
| 1.9765 | 840 | 0.5012 | - |
| 2.0 | 850 | - | 0.5041 |
| 2.0235 | 860 | 0.5343 | - |
| 2.0706 | 880 | 0.4404 | - |
| 2.1176 | 900 | 0.4679 | 0.4866 |
| 2.1647 | 920 | 0.5153 | - |
| 2.2118 | 940 | 0.4592 | - |
| 2.2353 | 950 | - | 0.4959 |
| 2.2588 | 960 | 0.4473 | - |
| 2.3059 | 980 | 0.5223 | - |
| 2.3529 | 1000 | 0.4917 | 0.4882 |
| 2.4 | 1020 | 0.4113 | - |
| 2.4471 | 1040 | 0.5266 | - |
| 2.4706 | 1050 | - | 0.4844 |
| 2.4941 | 1060 | 0.4752 | - |
| 2.5412 | 1080 | 0.4672 | - |
| 2.5882 | 1100 | 0.5019 | 0.4730 |
| 2.6353 | 1120 | 0.4282 | - |
| 2.6824 | 1140 | 0.3954 | - |
| 2.7059 | 1150 | - | 0.4660 |
| 2.7294 | 1160 | 0.4608 | - |
| 2.7765 | 1180 | 0.4770 | - |
| 2.8235 | 1200 | 0.4747 | 0.4630 |
| 2.8706 | 1220 | 0.5013 | - |
| 2.9176 | 1240 | 0.3948 | - |
| 2.9412 | 1250 | - | 0.4606 |
| 2.9647 | 1260 | 0.4259 | - |
| 3.0 | 1275 | - | 0.4595 |
- The bold row denotes the saved checkpoint.
Training Time
- Training: 31.9 minutes
- Evaluation: 19.4 minutes
- Total: 51.3 minutes
Framework Versions
- Python: 3.12.13
- Sentence Transformers: 5.6.1
- Transformers: 5.14.1
- PyTorch: 2.13.0
- Accelerate: 1.14.0
- Datasets: 5.0.1
- Tokenizers: 0.22.2
Citation
BibTeX
Sentence Transformers and SoftmaxLoss
@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",
}