cafierom/smiles_embedding_gemma_FT
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
- 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-transformersThen 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]])<!--
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:
{
"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:
{
"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
<details><summary>Click to expand</summary>
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: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: {}
</details>
Training Logs
- 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",
}<!--
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. -->
