CoolFace
Modelpublic

Saideepthi55/sentencetransformer_ftmodel_on_chemical_dataset

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes118downloads
Model Card

MPNet base trained on sxcmedllmchemicalgen

This is a sentence-transformers model finetuned from microsoft/mpnet-base on the sxc_med_llm_chemical_gen dataset. 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.

Model Details

Model Description

  • —Model Type: Sentence Transformer
  • —Base model: microsoft/mpnet-base <!-- at revision 6996ce1e91bd2a9c7d7f61daec37463394f73f09 -->
  • —Maximum Sequence Length: 512 tokens
  • —Output Dimensionality: 768 tokens
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —sxc_med_llm_chemical_gen
  • —Language: en
  • —License: apache-2.0

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: MPNetModel 
  (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})
)

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("Saideepthi55/sentencetransformer_ftmodel_on_chemical_dataset")
# Run inference
sentences = [
    'With a molecule represented by the SMILES string CNNNCC(=O)N[C@H](C)C[C@@H](C)NCc1ccc2c(c1)CCC2, propose adjustments that can increase its logP value while keeping the output molecule structurally related to the input molecule.',
    'Given a molecule expressed in SMILES string, help me optimize it according to my requirements.',
    'In line with your criteria, I\'ve optimized the molecule and present it as "C[C@H](C[C@@H](C)NC(=O)COC(C)(C)C)NCc1ccc2c(c1)CCC2".',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

<!--

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

Evaluation

Metrics

Triplet
MetricValue
cosine_accuracy0.9838
dot_accuracy0.0162
manhattan_accuracy0.9827
euclidean_accuracy0.9836
max_accuracy0.9838

<!--

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

sxcmedllmchemicalgen
  • —Dataset: sxc_med_llm_chemical_gen at ae28874
  • —Size: 117,502 training samples
  • —Columns: <code>input</code>, <code>instruction</code>, and <code>output</code>
  • —Approximate statistics based on the first 1000 samples: | | input | instruction | output | |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 2 tokens</li><li>mean: 50.03 tokens</li><li>max: 156 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 16.19 tokens</li><li>max: 69 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 67.94 tokens</li><li>max: 321 tokens</li></ul> |
  • —Samples: | input | instruction | output | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code></code> | <code>List the countries of the Middle East</code> | <code>Egypt, Israel, Iran, Iraq, Jordan, Kuwait, Lebanon, Qatar, Saudi Arabia, Syria, Turkey, The United Arab Emirates, Oman, and Yemen.</code> | | <code>Support me in refining the molecule CCC(C)=C(CC)c1ccc(Nc2nc3nonc3nc2N2CCC(Oc3ccc(Cl)cc3)CC2)cc1 to have a more drug-like nature, ensuring it remains close to the input molecule. Please inform me of the QED value of the optimized molecule.</code> | <code>Help me adapt a molecular structure denoted in SMILES string based on my preferences.</code> | <code>I've optimized the molecule according to your requirements, yielding the structure "COC(=O)c1ccc(Nc2nc3nonc3nc2N2CCC(Oc3ccc(Cl)cc3)CC2)cc1" and an estimated QED value of 0.4.</code> | | <code></code> | <code>Create a social media strategy to attract followers on Twitter.</code> | <code>The social media strategy for Twitter should involve Tweeting on a regular basis, with content that is engaging and relevant to the target audience. This can include retweetable quotes, links to videos and articles, sharing photos/images, polls, and so on. It is also beneficial for the information to include hashtags relevant to the content and any relevant topics of the industry. <br><br>It is also important to leverage Twitter influencers and accounts, as well as engaging with potential followers regularly and DM them when necessary. Additionally, running campaigns, contests and giveaways to gain more followers should also be part of the strategy. Finally, hashtag research should be conducted to increase the reach of the tweets.</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Evaluation Dataset

sxcmedllmchemicalgen
  • —Dataset: sxc_med_llm_chemical_gen at ae28874
  • —Size: 4,500 evaluation samples
  • —Columns: <code>input</code>, <code>instruction</code>, and <code>output</code>
  • —Approximate statistics based on the first 1000 samples: | | input | instruction | output | |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 2 tokens</li><li>mean: 68.49 tokens</li><li>max: 165 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 16.89 tokens</li><li>max: 36 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 69.16 tokens</li><li>max: 205 tokens</li></ul> |
  • —Samples: | input | instruction | output | |:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>With a molecule represented by the SMILES string COc1ccc(CN(C(=O)Nc2ccc(C@Hc3ccccc3)c(Cl)c2)C2CC2)cc1, propose adjustments that can decrease its blood-brain barrier permeability (BBBP) value by at least 0.1 compared to the pre-optimized value while keeping the output molecule structurally related to the input molecule. Please inform me of the BBBP value of the optimized molecule.</code> | <code>Help me adapt a molecular structure denoted in SMILES string based on my preferences.</code> | <code>I've optimized the molecule according to your requirements, yielding the structure "CC(C)c1cccc(Oc2ccc(CN(C(=O)Nc3ccc(C@Hc4ccccc4)c(Cl)c3)C3CC3)cc2)c1" and an estimated BBBP value of 0.34.</code> | | <code>Which modifications can be applied to the molecule Cc1nn(-c2cc3cc(F)ccc3s2)c2ncc(C(=O)N3CCCC3c3nnc4n3CCCCC4)cc12 to increase its water solubility value while ensuring it remains similar to the original molecule?</code> | <code>Aid me in refining a molecular structure written in SMILES notation based on my criteria.</code> | <code>I've optimized the molecule according to your requirements, resulting in the following structure: "Cc1nn(C)c2ncc(C(=O)N3CCCC3c3nnc4n3CCCCC4)cc12".</code> | | <code></code> | <code>Describe the benefits of having a mentor.</code> | <code>Having a mentor can provide tremendous benefits, including guidance, advice, support and connection to a network of contacts. Mentors can offer valuable feedback, help to create goals and strategies, and provide the accountability necessary to carry out the desired goals. They can also provide a fresh perspective which can help to create new ideas and solutions.</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —learning_rate: 2e-05
  • —num_train_epochs: 1
  • —warmup_ratio: 0.1
  • —fp16: True
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: steps
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 1
  • —eval_accumulation_steps: None
  • —torch_empty_cache_steps: None
  • —learning_rate: 2e-05
  • —weight_decay: 0.0
  • —adam_beta1: 0.9
  • —adam_beta2: 0.999
  • —adam_epsilon: 1e-08
  • —max_grad_norm: 1.0
  • —num_train_epochs: 1
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.1
  • —warmup_steps: 0
  • —log_level: passive
  • —log_level_replica: warning
  • —log_on_each_node: True
  • —logging_nan_inf_filter: True
  • —save_safetensors: True
  • —save_on_each_node: False
  • —save_only_model: False
  • —restore_callback_states_from_checkpoint: False
  • —no_cuda: False
  • —use_cpu: False
  • —use_mps_device: False
  • —seed: 42
  • —data_seed: None
  • —jit_mode_eval: False
  • —use_ipex: False
  • —bf16: False
  • —fp16: True
  • —fp16_opt_level: O1
  • —half_precision_backend: auto
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: None
  • —local_rank: 0
  • —ddp_backend: None
  • —tpu_num_cores: None
  • —tpu_metrics_debug: False
  • —debug: []
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_prefetch_factor: None
  • —past_index: -1
  • —disable_tqdm: False
  • —remove_unused_columns: True
  • —label_names: None
  • —load_best_model_at_end: False
  • —ignore_data_skip: False
  • —fsdp: []
  • —fsdp_min_num_params: 0
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamw_torch
  • —optim_args: None
  • —adafactor: False
  • —group_by_length: False
  • —length_column_name: length
  • —ddp_find_unused_parameters: None
  • —ddp_bucket_cap_mb: None
  • —ddp_broadcast_buffers: False
  • —dataloader_pin_memory: True
  • —dataloader_persistent_workers: False
  • —skip_memory_metrics: True
  • —use_legacy_prediction_loop: False
  • —push_to_hub: False
  • —resume_from_checkpoint: None
  • —hub_model_id: None
  • —hub_strategy: every_save
  • —hub_private_repo: False
  • —hub_always_push: False
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —include_inputs_for_metrics: False
  • —eval_do_concat_batches: True
  • —fp16_backend: auto
  • —push_to_hub_model_id: None
  • —push_to_hub_organization: None
  • —mp_parameters:
  • —auto_find_batch_size: False
  • —full_determinism: False
  • —torchdynamo: None
  • —ray_scope: last
  • —ddp_timeout: 1800
  • —torch_compile: False
  • —torch_compile_backend: None
  • —torch_compile_mode: None
  • —dispatch_batches: None
  • —split_batches: None
  • —include_tokens_per_second: False
  • —include_num_input_tokens_seen: False
  • —neftune_noise_alpha: None
  • —optim_target_modules: None
  • —batch_eval_metrics: False
  • —eval_on_start: False
  • —eval_use_gather_object: False
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining LossValidation Losssxc_med_llm_chemical_gen_max_accuracy
00--0.7076
0.01361004.17053.63140.7469
0.02722003.00882.47710.8191
0.04083002.38032.37650.8716
0.05454002.22812.31220.9316
0.06815002.16472.29970.9436
0.08176002.12892.26630.9511
0.09537002.06632.26010.9629
0.10898002.0652.25000.9687
0.12259002.03992.25950.9693
0.136210001.99392.23750.9707
0.149811001.98582.22200.9684
0.163412002.00692.22650.9758
0.177013001.95912.20730.9702
0.190614001.92882.20780.976
0.204215001.94662.20360.9758
0.217916001.91752.20860.9764
0.231517001.88352.23290.9796
0.245118001.91342.20030.9796
0.258719001.88092.20030.9811
0.272320001.92632.20390.9824
0.285921001.91012.20840.9804
0.299622001.88462.20520.9831
0.313223001.88422.19030.9818
0.326824001.89452.19840.9807
0.340425001.92172.18590.9829
0.354026001.87042.19950.982
0.367627001.8892.20380.9822
0.381328001.8752.20790.9829
0.394929001.87922.19750.9833
0.408530001.8822.18950.9796
0.422131001.88862.21150.9831
0.435732001.86292.20400.9838
0.449333001.86472.19730.9836
0.463034001.88882.19610.9838
0.476635001.86922.20270.9829
0.490236001.88462.19540.9838
0.503837001.84822.18880.9822
0.517438001.85272.18730.9824
0.531039001.83782.19400.9811
0.544740001.86792.20080.9833
0.558341001.84212.18450.9842
0.571942001.83252.19480.9847
0.585543001.86752.17500.9836
0.599144001.84832.18280.9831
0.612745001.8542.18860.9831
0.626446001.8272.18760.9824
0.640047001.88632.18490.9836
0.653648001.89192.18160.984
0.667249001.82112.18300.9847
0.680850001.83452.18470.9842
0.694451001.86852.18550.9853
0.708152001.852.18640.9844
0.721753001.82222.18750.9842
0.735354001.81792.19230.9844
0.748955001.79922.19090.9851
0.762556001.84952.18110.9847
0.776157001.8082.17630.9842
0.789858001.82932.18610.9849
0.803459001.81842.18450.9851
0.817060001.82562.19560.9849
0.830661001.79042.19160.9842
0.844262001.80282.19180.9847
0.857863001.83162.19170.9856
0.871564001.79512.19290.9851
0.885165001.81752.18660.9847
0.898766001.80712.18990.9853
0.912367001.86322.19050.9844
0.925968001.84412.18850.984
0.939569001.82432.18650.9836
0.953270001.80552.18520.9842
0.966871001.82272.18430.984
0.980472001.82872.18310.984
0.994073001.83792.18380.9838

Framework Versions

  • —Python: 3.10.12
  • —Sentence Transformers: 3.2.0
  • —Transformers: 4.44.2
  • —PyTorch: 2.4.1+cu121
  • —Accelerate: 0.34.2
  • —Datasets: 3.0.1
  • —Tokenizers: 0.19.1

Citation

BibTeX

Sentence Transformers
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",
}
MultipleNegativesRankingLoss
bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

<!--

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