CoolFace
Modelpublic

cafierom/smiles_embedding_gemma_FT

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes21downloads
Model Card

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 <!-- at revision 57c266a740f537b4dc058e1b0cda161fd15afa75 -->
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

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:

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("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]])

<!--

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

<!--

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: 3,396 training samples
  • Columns: <code>premise</code>, <code>hypothesis</code>, and <code>label</code>
  • Approximate statistics based on the first 100 samples: | | premise | hypothesis | label | |:---------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | modality | text | text | | | details | <ul><li>min: 18 tokens</li><li>mean: 58.11 tokens</li><li>max: 117 tokens</li></ul> | <ul><li>min: 11 tokens</li><li>mean: 54.91 tokens</li><li>max: 119 tokens</li></ul> | <ul><li>0: ~55.77%</li><li>2: ~44.23%</li></ul> |
  • Samples: | premise | hypothesis | label | |:-----------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------|:---------------| | <code>CCC@HC(=O)O[C@H]1CC@HC@HCC(=O)O3)[C@@H]12)\C=C\Cc1ccccc1</code> | <code>Cc1cc(-c2ccc(Cl)cc2)c(\C=C\[C@@H]2CC@@HCC(=O)O2)c(C)n1</code> | <code>2</code> | | <code>CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c(c1C(=O)Nc1ccccc1)-c1ccccc1)-c1ccc(F)cc1</code> | <code>CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c(c1C(=O)NCc1ccccn1)-c1ccccc1)-c1ccc(F)cc1</code> | <code>0</code> | | <code>CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c(c1C(=O)N(C)C)-c1ccccc1)-c1ccc(F)cc1</code> | <code>COc1ccc2ccccc2c1-c1ccc(C(C)C)n1CC[C@@H]1CC@@HCC(=O)O1</code> | <code>2</code> |
  • Loss: <code>SoftmaxLoss</code> with these parameters:
json
  {
      "num_labels": 3,
      "concatenation_sent_rep": true,
      "concatenation_sent_difference": true,
      "concatenation_sent_multiplication": false
  }

Evaluation Dataset

Unnamed Dataset
  • Size: 600 evaluation samples
  • Columns: <code>premise</code>, <code>hypothesis</code>, and <code>label</code>
  • Approximate statistics based on the first 100 samples: | | premise | hypothesis | label | |:---------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | modality | text | text | | | details | <ul><li>min: 11 tokens</li><li>mean: 56.06 tokens</li><li>max: 101 tokens</li></ul> | <ul><li>min: 12 tokens</li><li>mean: 55.85 tokens</li><li>max: 119 tokens</li></ul> | <ul><li>0: ~41.35%</li><li>2: ~58.65%</li></ul> |
  • Samples: | premise | hypothesis | label | |:--------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------|:---------------| | <code>CNc1cccc(c1)-c1nc(C(C)C)n(\C=C\C@@HCC@@HCC([O-])=O)c1-c1ccc(F)cc1</code> | <code>CC(C)c1c(CCC@@HCC@@HCC([O-])=O)c(cn1-c1ccccc1)-c1ccc(F)cc1</code> | <code>0</code> | | <code>CC(C)c1nc(nc(-c2ccc(F)cc2)c1\C=C\[C@@H]1CC@@HCC(OCC(Cl)(Cl)Cl)O1)N(C)S(C)(=O)=O</code> | <code>CC(C)c1nn(-c2nc3ccccc3s2)c(c1\C=C\C@@HCC@@HCC([O-])=O)-c1ccc(F)cc1</code> | <code>2</code> | | <code>Cc1c(\C=C\C@HCC@@HCC([O-])=O)c(cn1-c1ccccc1)-c1ccc(F)cc1</code> | <code>CC@HC(O)=O)[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=O</code> | <code>2</code> |
  • Loss: <code>SoftmaxLoss</code> with these parameters:
json
  {
      "num_labels": 3,
      "concatenation_sent_rep": true,
      "concatenation_sent_difference": true,
      "concatenation_sent_multiplication": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • warmup_steps: 10
  • optim: adafactor
  • weight_decay: 0.01
  • bf16: True
  • load_best_model_at_end: True
  • dataloader_pin_memory: False
All Hyperparameters

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

  • per_device_train_batch_size: 8
  • num_train_epochs: 3
  • max_steps: -1
  • learning_rate: 5e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 10
  • optim: adafactor
  • optim_args: None
  • weight_decay: 0.01
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 1
  • average_tokens_across_devices: True
  • max_grad_norm: 1.0
  • label_smoothing_factor: 0.0
  • bf16: True
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: False
  • project: huggingface
  • trackio_space_id: None
  • trackio_bucket_id: None
  • trackio_static_space_id: None
  • per_device_eval_batch_size: 8
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: False
  • hub_private_repo: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 42
  • data_seed: None
  • use_cpu: False
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • parallelism_config: None
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_pin_memory: False
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_static_graph: None
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: None
  • fsdp_config: None
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • warmup_ratio: None
  • local_rank: -1
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining LossValidation Loss
0.0471200.9762-
0.0941400.8931-
0.117650-0.8680
0.1412600.8805-
0.1882800.8463-
0.23531000.81860.8070
0.28241200.8125-
0.32941400.7831-
0.3529150-0.7607
0.37651600.7789-
0.42351800.7543-
0.47062000.71190.7341
0.51762200.7230-
0.56472400.7006-
0.5882250-0.6976
0.61182600.6999-
0.65882800.6649-
0.70593000.66930.6542
0.75293200.6768-
0.83400.6203-
0.8235350-0.6334
0.84713600.6820-
0.89413800.6402-
0.94124000.63270.6568
0.98824200.5882-
1.03534400.6258-
1.0588450-0.6009
1.08244600.5778-
1.12944800.6016-
1.17655000.52510.5823
1.22355200.5810-
1.27065400.5700-
1.2941550-0.5618
1.31765600.5384-
1.36475800.6171-
1.41186000.58610.5493
1.45886200.5898-
1.50596400.5139-
1.5294650-0.5250
1.55296600.5235-
1.66800.4972-
1.64717000.50560.5538
1.69417200.5550-
1.74127400.5275-
1.7647750-0.5268
1.78827600.5224-
1.83537800.4965-
1.88248000.47680.5072
1.92948200.5545-
1.97658400.5012-
2.0850-0.5041
2.02358600.5343-
2.07068800.4404-
2.11769000.46790.4866
2.16479200.5153-
2.21189400.4592-
2.2353950-0.4959
2.25889600.4473-
2.30599800.5223-
2.352910000.49170.4882
2.410200.4113-
2.447110400.5266-
2.47061050-0.4844
2.494110600.4752-
2.541210800.4672-
2.588211000.50190.4730
2.635311200.4282-
2.682411400.3954-
2.70591150-0.4660
2.729411600.4608-
2.776511800.4770-
2.823512000.47470.4630
2.870612200.5013-
2.917612400.3948-
2.94121250-0.4606
2.964712600.4259-
3.01275-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
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. -->