--- 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](https://www.SBERT.net) model finetuned from [google/embeddinggemma-300m](https://huggingface.co/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](https://huggingface.co/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](https://sbert.net) - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers) - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) ### 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]]) ``` ## Training Details ### Training Dataset #### Unnamed Dataset * Size: 3,396 training samples * Columns: premise, hypothesis, and label * Approximate statistics based on the first 100 samples: | | premise | hypothesis | label | |:---------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | modality | text | text | | | details | | | | * Samples: | premise | hypothesis | label | |:-----------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------|:---------------| | CC[C@H](C)C(=O)O[C@H]1C[C@H](C[C@@H]2C=C[C@H](C)[C@H](CC[C@@H]3C[C@@H](O)CC(=O)O3)[C@@H]12)\C=C\Cc1ccccc1 | Cc1cc(-c2ccc(Cl)cc2)c(\C=C\[C@@H]2C[C@@H](O)CC(=O)O2)c(C)n1 | 2 | | CC(C)n1c(CC[C@@H](O)C[C@@H](O)CC([O-])=O)c(c(c1C(=O)Nc1ccccc1)-c1ccccc1)-c1ccc(F)cc1 | CC(C)n1c(CC[C@@H](O)C[C@@H](O)CC([O-])=O)c(c(c1C(=O)NCc1ccccn1)-c1ccccc1)-c1ccc(F)cc1 | 0 | | CC(C)n1c(CC[C@@H](O)C[C@@H](O)CC([O-])=O)c(c(c1C(=O)N(C)C)-c1ccccc1)-c1ccc(F)cc1 | COc1ccc2ccccc2c1-c1ccc(C(C)C)n1CC[C@@H]1C[C@@H](O)CC(=O)O1 | 2 | * Loss: [SoftmaxLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss) 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: premise, hypothesis, and label * Approximate statistics based on the first 100 samples: | | premise | hypothesis | label | |:---------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | modality | text | text | | | details | | | | * Samples: | premise | hypothesis | label | |:--------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------|:---------------| | CNc1cccc(c1)-c1nc(C(C)C)n(\C=C\[C@@H](O)C[C@@H](O)CC([O-])=O)c1-c1ccc(F)cc1 | CC(C)c1c(CC[C@@H](O)C[C@@H](O)CC([O-])=O)c(cn1-c1ccccc1)-c1ccc(F)cc1 | 0 | | CC(C)c1nc(nc(-c2ccc(F)cc2)c1\C=C\[C@@H]1C[C@@H](O)CC(OCC(Cl)(Cl)Cl)O1)N(C)S(C)(=O)=O | CC(C)c1nn(-c2nc3ccccc3s2)c(c1\C=C\[C@@H](O)C[C@@H](O)CC([O-])=O)-c1ccc(F)cc1 | 2 | | Cc1c(\C=C\[C@H](O)C[C@@H](O)CC([O-])=O)c(cn1-c1ccccc1)-c1ccc(F)cc1 | C[C@H](CC\C=C(/C)C(O)=O)[C@H]1CC(=O)[C@@]2(C)C3=C(C(=O)C[C@]12C)[C@@]1(C)CCC(=O)[C@@](C)(COC(=O)C[C@@](C)(O)CC(O)=O)[C@@H]1CC3=O | 2 | * Loss: [SoftmaxLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss) 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
Click to expand - `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`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': 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`: {}
### 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 ```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", } ```