CoolFace
Modelpublic

HassanCS/TCRb_HLA_peptide_esm2_t6_8M_UR50D_best

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes13downloads
Model Card

SentenceTransformer based on facebook/esm2t68M_UR50D

This is a sentence-transformers model finetuned from facebook/esm2_t6_8M_UR50D. It maps sentences & paragraphs to a 320-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: facebook/esm2_t6_8M_UR50D <!-- at revision c731040fcd8d73dceaa04b0a8e6329b345b0f5df -->
  • —Maximum Sequence Length: 1026 tokens
  • —Output Dimensionality: 320 dimensions
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 1026, 'do_lower_case': False}) with Transformer model: EsmModel 
  (1): Pooling({'word_embedding_dimension': 320, '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/TCRb_HLA_peptide_esm2_t6_8M_UR50D_best")
# Run inference
sentences = [
    'D A G V T Q S P T H L I K T R G Q Q V T L R C S P I S G H K S V S W Y Q Q V L G Q G P Q F I F Q Y Y E K E E R G R G N F P D R F S A R Q F P N Y S S E L N V N A L L L G D S A L Y L C C A S S P G T D Y G Y T F F G S G T R L T V V E',
    'E T G V T Q S P T H L I K T R G Q Q V T L R C S S Q S G H N T V S W Y Q Q A L G Q G P Q F I F Q Y Y R E E E N G R G N F P P R F S G L Q F P N Y S S E L N V N A L E L D D S A L Y L C C A S S S R T S G I N E Q F F F G P G T R L T V L E',
    'G A G V S Q S L R H K V A K K G K D V A L R Y D P I S G H N A L Y W Y R Q S L G Q G L E F P I Y F Q G K D A A D K S G L P R D R F S A Q R S E G S I S T L K F Q R T Q Q G D L A V Y L C A S S S T R G S R G E Q F F G P G T R L T V L E',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 320]

# 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

Semantic Similarity
MetricValue
pearson_cosine0.9369
spearman_cosine0.9778

<!--

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: 504,071 training samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | score | |:--------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:---------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 111 tokens</li><li>mean: 117.87 tokens</li><li>max: 125 tokens</li></ul> | <ul><li>min: 109 tokens</li><li>mean: 117.88 tokens</li><li>max: 132 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.36</li><li>max: 1.0</li></ul> |
  • —Samples: | sentence1 | sentence2 | score | |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------| | <code>N A G V T Q T P K F Q V L K T G Q S M T L Q C A Q D M N H N S M Y W Y R Q D P G M G L R L I Y Y S A S E G T T D K G E V P N G Y N V S R L N K R E F S L R L E S A A P S Q T S V Y F C A S R S G S G T N Y N E Q F F G P G T R L T V L E</code> | <code>G A V V S Q H P S W V I C K S G T S V K I E C R S L D F Q A T T M F W Y R Q F P K Q S L M L M A T S N E G S K A T Y E Q G V E K D K F L I N H A S L T L S T L T V T S A H P E D S S F Y I C S A P T S G G H N E Q F G P G T R L T V L E</code> | <code>0.36983471074380164</code> | | <code>D T G V S Q N P R H K I T K R G Q N V T F R C D P I S E H N R L Y W Y R Q T L G Q G P E F L T Y F Q N E A Q L E K S R L L S D R F S A E R P K G S F S T L E I Q R T E Q G D S A M Y L C A S S L I Q G A S W G Y T F G S G T R L T V V E</code> | <code>N A G V T Q T P K F Q V L K T G Q S M T L Q C A Q D M N H E Y M S W Y R Q D P G M G L R L I H Y S V G A G I T D Q G E V P N G Y N V S R S T T E D F P L R L L S A A P S Q T S V Y F C A S S S L D G N Y G Y T F G S G T R L T V V E</code> | <code>0.8450413223140495</code> | | <code>D V K V T Q S S R Y L V K R T G E K V F L E C V Q D M D H E N M F W Y R Q D P G L G L R L I Y F S Y D V K M K E K G D I P E G Y S V S R E K K E R F S L I L E S A S T N Q T S M Y L C C A S R V R D R G R L D Y G Y T F F G S G T R L T V V E</code> | <code>D G G I T Q S P K Y L F R K E G Q N V T L S C E Q N L N H D A M Y W Y R Q V P G Q G L R L I Y Y S H I V N D F Q K G D I A E G Y S V S R E K K E S F P L T V T S A Q K N P T A F Y L C C A S S S R S G N E K L F F F G S G T Q L S V L E</code> | <code>0.8347107438016529</code> |
  • —Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 56,008 evaluation samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>score</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | score | |:--------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:---------------------------------------------------------------| | type | string | string | float | | details | <ul><li>min: 110 tokens</li><li>mean: 117.92 tokens</li><li>max: 125 tokens</li></ul> | <ul><li>min: 111 tokens</li><li>mean: 117.93 tokens</li><li>max: 127 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.38</li><li>max: 1.0</li></ul> |
  • —Samples: | sentence1 | sentence2 | score | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------| | <code>N A G V T Q T P K F Q V L K T G Q S M T L Q C A Q D M N H E Y M S W Y R Q D P G M G L R L I H Y S V G A G I T D Q G E V P N G Y N V S R S T T E D F P L R L L S A A P S Q T S V Y F C C A S S P I T G T G I Y G Y T F F G S G T R L T V V E</code> | <code>D G G I T Q S P K Y L F R K E G Q N V T L S C E Q N L N H D A M Y W Y R Q D P G Q G L R L I Y Y S Q I V N D F Q K G D I A E G Y S V S R E K K E S F P L T V T S A Q K N P T A F Y L C C A S S M I P D M N T E A F F F G Q G T R L T V V E</code> | <code>0.03925619834710743</code> | | <code>G A V V S Q H P S W V I C K S G T S V K I E C R S L D F Q A T T M F W Y R Q F P K Q S L M L M A T S N E G S K A T Y E Q G V E K D K F L I N H A S L T L S T L T V T S A H P E D S S F Y I C S A R D S T G N G Y T F G S G T R L T V V E</code> | <code>S A V I S Q K P S R D I C Q R G T S L T I Q C Q V D S Q V T M M F W Y R Q Q P G Q S L T L I A T A N Q G S E A T Y E S G F V I D K F P I S R P N L T F S T L T V S N M S P E D S S I Y L C S V G T G G T N E K L F F G Q G T R L T V V E</code> | <code>0.8347107438016529</code> | | <code>D A R V T Q T P R H K V T E M G Q E V T M R C Q P I L G H N T V F W Y R Q T M M Q G L E L L A Y F R N R A P L D D S G M P K D R F S A E M P D A T L A T L K I Q P S E P R D S A V Y F C A S G T G E G S Y N E Q F F G P G T R L T V L E</code> | <code>D A R V T Q T P R H K V T E M G Q E V T M R C Q P I L G H N T V F W Y R Q T M M Q G L E L L A Y F R N R A P L D D S G M P K D R F S A E M P D A T L A T L K I Q P S E P R D S A V Y F C A S G D Y G N R G P Y S N Q P Q H F G D G T R L S I L E</code> | <code>0.07024793388429751</code> |
  • —Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: epoch
  • —per_device_train_batch_size: 128
  • —per_device_eval_batch_size: 128
  • —learning_rate: 0.001
  • —weight_decay: 0.0001
  • —num_train_epochs: 10
  • —fp16: True
  • —load_best_model_at_end: True
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: epoch
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 128
  • —per_device_eval_batch_size: 128
  • —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: 0.001
  • —weight_decay: 0.0001
  • —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.0
  • —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: True
  • —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: None
  • —hub_always_push: False
  • —hub_revision: None
  • —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
  • —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
  • —liger_kernel_config: None
  • —eval_use_gather_object: False
  • —average_tokens_across_devices: False
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

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

EpochStepTraining LossValidation Lossall-dev_spearman_cosine
0.050810010.3431--
0.101520010.3239--
0.152330010.3059--
0.203040010.2992--
0.253850010.2805--
0.304660010.2669--
0.355370010.2524--
0.406180010.2405--
0.456990010.2277--
0.5076100010.2183--
0.5584110010.1955--
0.6091120010.1802--
0.6599130010.1639--
0.7107140010.1569--
0.7614150010.142--
0.8122160010.1199--
0.8629170010.1018--
0.9137180010.0895--
0.9645190010.0613--
1.01970-10.04200.7603
1.015220009.9671--
1.066021009.9951--
1.116822009.984--
1.167523009.9659--
1.218324009.9412--
1.269025009.924--
1.319826009.9016--
1.370627009.8786--
1.421328009.8664--
1.472129009.8448--
1.522830009.8323--
1.573631009.8085--
1.624432009.7986--
1.675133009.7862--
1.725934009.7621--
1.776635009.75--
1.827436009.7384--
1.878237009.721--
1.928938009.7194--
1.979739009.7179--
2.03940-9.73220.8905
2.030540009.7386--
2.081241009.7514--
2.132042009.7336--
2.182743009.7278--
2.233544009.7203--
2.284345009.6991--
2.335046009.6859--
2.385847009.6665--
2.436548009.6652--
2.487349009.6321--
2.538150009.6195--
2.588851009.6006--
2.639652009.5913--
2.690453009.5792--
2.741154009.5701--
2.791955009.562--
2.842656009.5474--
2.893457009.5147--
2.944258009.5161--
2.994959009.5074--
3.05910-9.51050.9338
3.045760009.3679--
3.096461009.4141--
3.147262009.3998--
3.198063009.3777--
3.248764009.3718--
3.299565009.3744--
3.350366009.3661--
3.401067009.3472--
3.451868009.3239--
3.502569009.3358--
3.553370009.3072--
3.604171009.3102--
3.654872009.29--
3.705673009.3095--
3.756374009.2874--
3.807175009.2643--
3.857976009.259--
3.908677009.2706--
3.959478009.2403--
4.07880-9.35420.9535
4.010279009.2373--
4.060980009.3228--
4.111781009.3337--
4.162482009.3371--
4.213283009.3342--
4.264084009.3354--
4.314785009.32--
4.365586009.3151--
4.416287009.3038--
4.467088009.2938--
4.517889009.281--
4.568590009.285--
4.619391009.2787--
4.670192009.2665--
4.720893009.2467--
4.771694009.2345--
4.822395009.2412--
4.873196009.2245--
4.923997009.2366--
4.974698009.2023--
5.09850-9.30570.9580
5.025499009.0698--
5.0761100009.1091--
5.1269101009.1081--
5.1777102009.1166--
5.2284103009.1056--
5.2792104009.098--
5.3299105009.1041--
5.3807106009.0786--
5.4315107009.0669--
5.4822108009.0534--
5.5330109009.0634--
5.5838110009.0708--
5.6345111009.048--
5.6853112009.0551--
5.7360113009.0384--
5.7868114009.0244--
5.8376115009.0145--
5.8883116009.0065--
5.9391117009.0116--
5.9898118008.9942--
6.011820-9.21160.9678
6.0406119009.0665--
6.0914120009.0975--
6.1421121009.115--
6.1929122009.1014--
6.2437123009.1229--
6.2944124009.1035--
6.3452125009.0862--
6.3959126009.0889--
6.4467127009.0783--
6.4975128009.0815--
6.5482129009.066--
6.5990130009.0758--
6.6497131009.0685--
6.7005132009.056--
6.7513133009.058--
6.8020134009.0499--
6.8528135009.0246--
6.9036136009.0354--
6.9543137009.0156--
7.013790-9.17650.9688
7.0051138008.9387--
7.0558139008.9268--
7.1066140008.9435--
7.1574141008.9202--
7.2081142008.9302--
7.2589143008.9157--
7.3096144008.9093--
7.3604145008.9195--
7.4112146008.9024--
7.4619147008.8853--
7.5127148008.8902--
7.5635149008.8683--
7.6142150008.8682--
7.6650151008.871--
7.7157152008.8676--
7.7665153008.8705--
7.8173154008.881--
7.8680155008.8622--
7.9188156008.8379--
7.9695157008.8466--
8.015760-9.13950.9742
8.0203158008.8919--
8.0711159008.9284--
8.1218160008.9415--
8.1726161008.9568--
8.2234162008.9346--
8.2741163008.9446--
8.3249164008.9332--
8.3756165008.933--
8.4264166008.9317--
8.4772167008.9394--
8.5279168008.9284--
8.5787169008.9024--
8.6294170008.9151--
8.6802171008.9195--
8.7310172008.8973--
8.7817173008.9165--
8.8325174008.8804--
8.8832175008.8863--
8.9340176008.8841--
8.9848177008.8949--
9.017730-9.11840.9744
9.0355178008.7504--
9.0863179008.7935--
9.1371180008.8054--
9.1878181008.7777--
9.2386182008.7812--
9.2893183008.7668--
9.3401184008.7764--
9.3909185008.7825--
9.4416186008.7815--
9.4924187008.7639--
9.5431188008.7596--
9.5939189008.7778--
9.6447190008.7285--
9.6954191008.7511--
9.7462192008.753--
9.7970193008.7391--
9.8477194008.7404--
9.8985195008.7201--
9.9492196008.713--
10.0197008.64669.10.9778
  • —The bold row denotes the saved checkpoint. </details>

Framework Versions

  • —Python: 3.11.13
  • —Sentence Transformers: 4.1.0
  • —Transformers: 4.53.3
  • —PyTorch: 2.6.0+cu124
  • —Accelerate: 1.9.0
  • —Datasets: 4.4.1
  • —Tokenizers: 0.21.2

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",
}
CoSENTLoss
bibtex
@online{kexuefm-8847,
    title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
    author={Su Jianlin},
    year={2022},
    month={Jan},
    url={https://kexue.fm/archives/8847},
}

<!--

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