sentence-transformers safetensors roberta sentence-similarity feature-extraction generated_from_trainer dataset_size:35520 loss:MultipleNegativesRankingLoss arxiv:1908.10084 arxiv:1705.00652 base_model:DeepChem/ChemBERTa-77M-MLM base_model:finetune:DeepChem/ChemBERTa-77M-MLM model-index autotrain_compatible text-embeddings-inference endpoints_compatible region:us
---
base_model: DeepChem/ChemBERTa-77M-MLM
library_name: sentence-transformers
metrics:
- cosine_accuracy
pipeline_tag: sentence-similarity
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:35520
- loss:MultipleNegativesRankingLoss
widget:
- source_sentence: C[NH+]1CCC(CN2c3ccccc3Sc3ccccc32)C1
  sentences:
  - CC(C)CN(CC(O)C(Cc1ccccc1)NC(=O)OC1COC2OCCC12)S(=O)(=O)c1ccc(N)cc1
  - COC(=O)NC(C(=O)NC(Cc1ccccc1)C(O)CN(Cc1ccc(-c2ccccn2)cc1)NC(=O)C(NC(=O)OC)C(C)(C)C)C(C)(C)C
  - C=C1c2cccc([O-])c2C(=O)C2=C([O-])C3(O)C(=O)C(C(N)=O)=C([O-])C([NH+](C)C)C3C(O)C12
- source_sentence: CC(C)(C)[NH2+]CC(O)COc1ccccc1C1CCCC1
  sentences:
  - C[NH2+]C1C(OC2C(OC3C(O)C(O)C(NC(N)=[NH2+])C(O)C3NC(N)=[NH2+])OC(C)C2(O)C=O)OC(CO)C(O)C1O
  - CC(C)CNCc1ccc(-c2ccccc2S(=O)(=O)N2CCCC2)cc1
  - CC1C[NH+](CC(Cc2ccccc2)C(=O)NCC(=O)[O-])CCC1(C)c1cccc(O)c1
- source_sentence: CC1CC2C3CCC4=CC(=O)C=CC4(C)C3(F)C(O)CC2(C)C1(OC(=O)c1ccccc1)C(=O)CO
  sentences:
  - CC1CC=CC=CC=CC=CC(OC2OC(C)C(O)C([NH3+])C2O)CC2OC(O)(CC(O)CC3OC3C=CC(=O)O1)CC(O)C2C(=O)[O-]
  - C=CC1(C)CC(OC(=O)CSC2CC3CCC(C2)[NH+]3C)C2(C)C(C)CCC3(CCC(=O)C32)C(C)C1O
  - CC(C)C(CN1CCC(C)(c2cccc(O)c2)C(C)C1)NC(=O)C1Cc2ccc(O)cc2CN1
- source_sentence: CC(C)[NH2+]CC1CCc2cc(CO)c([N+](=O)[O-])cc2N1
  sentences:
  - CC(Cc1cc2c(c(C(N)=O)c1)N(CCCO)CC2)[NH2+]CCOc1ccccc1OCC(F)(F)F
  - COC(=O)NC(C(=O)NC(Cc1ccccc1)C(O)CN(Cc1ccc(-c2ccccn2)cc1)NC(=O)C(NC(=O)OC)C(C)(C)C)C(C)(C)C
  - COc1ccccc1Oc1c([N-]S(=O)(=O)c2ccc(C(C)(C)C)cc2)nc(-c2ncccn2)nc1OCCO
- source_sentence: COc1ccc(C(=O)CC(=O)c2ccc(C(C)(C)C)cc2)cc1
  sentences:
  - C[N+]1(C)CCC(=C(c2ccccc2)c2ccccc2)CC1
  - CC#CCC(C)C(O)C=CC1C(O)CC2CC(=CCCCC(=O)[O-])CC21
  - C=C1CC2CCC34CC5OC6C(OC7CCC(CC(=O)CC8C(CC9OC(CCC1O2)CC(C)C9=C)OC(CC(O)CN)C8OC)OC7C6O3)C5O4
model-index:
- name: SentenceTransformer based on DeepChem/ChemBERTa-77M-MLM
  results:
  - task:
      type: triplet
      name: Triplet
    dataset:
      name: all dev
      type: all-dev
    metrics:
    - type: cosine_accuracy
      value: 0.7844594594594595
      name: Cosine Accuracy
---

# SentenceTransformer based on DeepChem/ChemBERTa-77M-MLM

This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [DeepChem/ChemBERTa-77M-MLM](https://huggingface.co/DeepChem/ChemBERTa-77M-MLM). It maps sentences & paragraphs to a 384-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:** [DeepChem/ChemBERTa-77M-MLM](https://huggingface.co/DeepChem/ChemBERTa-77M-MLM) <!-- at revision ed8a5374f2024ec8da53760af91a33fb8f6a15ff -->
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 384 dimensions
- **Similarity Function:** Cosine Similarity
<!-- - **Training Dataset:** Unknown -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)

### Full Model Architecture

```
SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel 
  (1): Pooling({'word_embedding_dimension': 384, '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("HassanCS/chemBERTa-tuned-on-ClinTox-4")
# Run inference
sentences = [
    'COc1ccc(C(=O)CC(=O)c2ccc(C(C)(C)C)cc2)cc1',
    'C[N+]1(C)CCC(=C(c2ccccc2)c2ccccc2)CC1',
    'C=C1CC2CCC34CC5OC6C(OC7CCC(CC(=O)CC8C(CC9OC(CCC1O2)CC(C)C9=C)OC(CC(O)CN)C8OC)OC7C6O3)C5O4',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# 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

* Dataset: `all-dev`
* Evaluated with [<code>TripletEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.TripletEvaluator)

| Metric              | Value      |
|:--------------------|:-----------|
| **cosine_accuracy** | **0.7845** |

<!--
## 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: 35,520 training samples
* Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
* Approximate statistics based on the first 1000 samples:
  |         | anchor                                                                             | positive                                                                           | negative                                                                           |
  |:--------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
  | type    | string                                                                             | string                                                                             | string                                                                             |
  | details | <ul><li>min: 14 tokens</li><li>mean: 29.75 tokens</li><li>max: 68 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 47.08 tokens</li><li>max: 221 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 53.95 tokens</li><li>max: 189 tokens</li></ul> |
* Samples:
  | anchor                                                 | positive                                                                                     | negative                                             |
  |:-------------------------------------------------------|:---------------------------------------------------------------------------------------------|:-----------------------------------------------------|
  | <code>CC(C)CC(NC(=O)CNC(=O)c1cc(Cl)ccc1Cl)B(O)O</code> | <code>CC(=O)OC1CCC2(C)C(=CCC3C2CCC2(C)C(c4cccnc4)=CCC32)C1</code>                            | <code>CCOC(=O)c1ncn2c1CN(C)C(=O)c1cc(F)ccc1-2</code> |
  | <code>CC(C)CC(NC(=O)CNC(=O)c1cc(Cl)ccc1Cl)B(O)O</code> | <code>COc1ccc(C(CN(C)C)C2(O)CCCCC2)cc1</code>                                                | <code>C[NH2+]C1(C)C2CCC(C2)C1(C)C</code>             |
  | <code>CC(C)CC(NC(=O)CNC(=O)c1cc(Cl)ccc1Cl)B(O)O</code> | <code>CNC(=O)c1cc(Oc2ccc(NC(=O)Nc3ccc(Cl)c(C(F)(F)F)c3)cc2)ccn1.Cc1ccc(S(=O)(=O)O)cc1</code> | <code>Nc1ncnc2c1ncn2C1OC(CO)C(O)C1O</code>           |
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
  ```json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }
  ```

### Evaluation Dataset

#### Unnamed Dataset


* Size: 1,480 evaluation samples
* Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
* Approximate statistics based on the first 1000 samples:
  |         | anchor                                                                              | positive                                                                            | negative                                                                            |
  |:--------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|
  | type    | string                                                                              | string                                                                              | string                                                                              |
  | details | <ul><li>min: 18 tokens</li><li>mean: 54.07 tokens</li><li>max: 169 tokens</li></ul> | <ul><li>min: 18 tokens</li><li>mean: 58.71 tokens</li><li>max: 244 tokens</li></ul> | <ul><li>min: 23 tokens</li><li>mean: 71.06 tokens</li><li>max: 209 tokens</li></ul> |
* Samples:
  | anchor                                                                  | positive                                                                             | negative                                                                                                |
  |:------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------|
  | <code>CC(C)OC(=O)CCCC=CCC1C(O)CC(O)C1C=CC(O)COc1cccc(C(F)(F)F)c1</code> | <code>C#CC1(O)CCC2C3CCC4=C(CCC(=O)C4)C3CCC21C</code>                                 | <code>CC(C)CC(NC(=O)C(CCc1ccccc1)NC(=O)CN1CCOCC1)C(=O)NC(Cc1ccccc1)C(=O)NC(CC(C)C)C(=O)C1(C)CO1</code>  |
  | <code>CC(C)OC(=O)CCCC=CCC1C(O)CC(O)C1C=CC(O)COc1cccc(C(F)(F)F)c1</code> | <code>C=CC1(C)CC(OC(=O)CSC2CC3CCC(C2)[NH+]3C)C2(C)C(C)CCC3(CCC(=O)C32)C(C)C1O</code> | <code>COC(=O)NC(C(=O)NC(Cc1ccccc1)C(O)CN(Cc1ccc(-c2ccccn2)cc1)NC(=O)C(NC(=O)OC)C(C)(C)C)C(C)(C)C</code> |
  | <code>CC(C)OC(=O)CCCC=CCC1C(O)CC(O)C1C=CC(O)COc1cccc(C(F)(F)F)c1</code> | <code>CC(Cc1cc2c(c(C(N)=O)c1)N(CCCO)CC2)[NH2+]CCOc1ccccc1OCC(F)(F)F</code>           | <code>CC(C)C1(C(=O)NC2CC(=O)OC2(O)CF)CC(c2nccc3ccccc23)=NO1</code>                                      |
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) 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`: 10
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates

#### 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`: 10
- `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`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `fsdp_transformer_layer_cls_to_wrap`: None
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': 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`: None
- `hub_always_push`: False
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `include_inputs_for_metrics`: False
- `include_for_metrics`: []
- `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
- `use_liger_kernel`: False
- `eval_use_gather_object`: False
- `average_tokens_across_devices`: False
- `prompts`: None
- `batch_sampler`: no_duplicates
- `multi_dataset_batch_sampler`: proportional

</details>

### Training Logs
| Epoch  | Step  | Training Loss | Validation Loss | all-dev_cosine_accuracy |
|:------:|:-----:|:-------------:|:---------------:|:-----------------------:|
| 0.2252 | 500   | 4.2712        | 3.3651          | 0.45                    |
| 0.4505 | 1000  | 3.5714        | 2.5580          | 0.6223                  |
| 0.6757 | 1500  | 3.3655        | 2.5956          | 0.6169                  |
| 0.9009 | 2000  | 3.2218        | 2.6932          | 0.6493                  |
| 1.1257 | 2500  | 3.0911        | 2.7852          | 0.6736                  |
| 1.3509 | 3000  | 3.0007        | 2.7838          | 0.6703                  |
| 1.5761 | 3500  | 3.0536        | 2.5324          | 0.7311                  |
| 1.8014 | 4000  | 3.0286        | 2.6623          | 0.6892                  |
| 2.0261 | 4500  | 2.9539        | 2.6397          | 0.7088                  |
| 2.2514 | 5000  | 2.9252        | 2.5550          | 0.7419                  |
| 2.4766 | 5500  | 2.944         | 2.5391          | 0.7419                  |
| 2.7018 | 6000  | 3.028         | 2.6421          | 0.6919                  |
| 2.9270 | 6500  | 2.9389        | 2.5931          | 0.7209                  |
| 3.1518 | 7000  | 2.9006        | 2.6597          | 0.7365                  |
| 3.3770 | 7500  | 2.9107        | 2.4841          | 0.7709                  |
| 3.6023 | 8000  | 2.9802        | 2.5128          | 0.7493                  |
| 3.8275 | 8500  | 2.9498        | 2.5716          | 0.7439                  |
| 4.0523 | 9000  | 2.9004        | 2.4889          | 0.7669                  |
| 4.2775 | 9500  | 2.89          | 2.5824          | 0.7453                  |
| 4.5027 | 10000 | 2.9343        | 2.4388          | 0.7757                  |
| 4.7279 | 10500 | 2.9666        | 2.4759          | 0.7520                  |
| 4.9532 | 11000 | 2.9153        | 2.6096          | 0.7399                  |
| 5.1779 | 11500 | 2.873         | 2.5489          | 0.7520                  |
| 5.4032 | 12000 | 2.8978        | 2.5579          | 0.7527                  |
| 5.6284 | 12500 | 2.9576        | 2.5336          | 0.7581                  |
| 5.8536 | 13000 | 2.93          | 2.4656          | 0.7730                  |
| 6.0784 | 13500 | 2.8825        | 2.4987          | 0.7730                  |
| 6.3036 | 14000 | 2.8863        | 2.4866          | 0.7818                  |
| 6.5288 | 14500 | 2.9221        | 2.4416          | 0.7818                  |
| 6.7541 | 15000 | 2.9544        | 2.4705          | 0.7622                  |
| 6.9793 | 15500 | 2.8929        | 2.4991          | 0.7669                  |
| 7.2041 | 16000 | 2.8656        | 2.5163          | 0.7689                  |
| 7.4293 | 16500 | 2.8866        | 2.5390          | 0.7689                  |
| 7.6545 | 17000 | 2.9675        | 2.4476          | 0.7872                  |
| 7.8797 | 17500 | 2.9094        | 2.4572          | 0.775                   |
| 8.1045 | 18000 | 2.8743        | 2.4677          | 0.7743                  |
| 8.3297 | 18500 | 2.8748        | 2.4658          | 0.7872                  |
| 8.5550 | 19000 | 2.9201        | 2.4412          | 0.7865                  |
| 8.7802 | 19500 | 2.9437        | 2.4620          | 0.7811                  |
| 9.0050 | 20000 | 2.881         | 2.4608          | 0.7797                  |
| 9.2302 | 20500 | 2.8628        | 2.4801          | 0.7770                  |
| 9.4554 | 21000 | 2.884         | 2.4699          | 0.7831                  |
| 9.6806 | 21500 | 2.9658        | 2.4519          | 0.7845                  |
| 9.9059 | 22000 | 2.8991        | 2.4474          | 0.7845                  |


### Framework Versions
- Python: 3.11.11
- Sentence Transformers: 3.3.1
- Transformers: 4.47.1
- PyTorch: 2.5.1+cu124
- Accelerate: 1.2.1
- Datasets: 3.2.0
- Tokenizers: 0.21.0

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