Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 1026, 'do_lower_case': False, 'architecture': '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})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("HassanCS/peptide_HLA_TCRa_TCRb__esm2_t6_8M_UR50D_up_to_epoch_8")
5# Run inference
6sentences = [
7 'M E V T P S G T W L',
8 'G Q A R V A Y Q V',
9 'L L L A R A A S L S L',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 320]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.4961, 0.5182],
19# [0.4961, 1.0000, 0.8793],
20# [0.5182, 0.8793, 1.0000]])all-devEmbeddingSimilarityEvaluator| Metric | Value |
|---|---|
| pearson_cosine | 0.9649 |
| spearman_cosine | 0.9629 |
sentence1, sentence2, and score| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| sentence1 | sentence2 | score |
|---|---|---|
V Y G I R L E H F | A L G W V F V P V | 0.4487163971048506 |
G R I A F F L K Y | I P S I N V H H Y | 0.2950890611282742 |
I L A K F A H W L | Q T N P V T L Q Y | 0.24611965364324553 |
CoSENTLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "pairwise_cos_sim"
4}sentence1, sentence2, and score| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| sentence1 | sentence2 | score |
|---|---|---|
K S K R T P M G F | G A D G V G K S A L | 0.35084774335438396 |
T P R V T G G G A M | E I F D R Y G E E V | 0.21484461945678654 |
S R I M L L A P K | K I F G S L A F L | 0.14818627314226981 |
CoSENTLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "pairwise_cos_sim"
4}eval_strategy: epochper_device_train_batch_size: 128per_device_eval_batch_size: 128learning_rate: 0.001weight_decay: 0.0001num_train_epochs: 8fp16: Trueload_best_model_at_end: Trueoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 128per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 0.001weight_decay: 0.0001adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 8max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Trueignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss | all-dev_spearman_cosine |
|---|---|---|---|---|
| 0.1258 | 100 | 8.9433 | - | - |
| 0.2516 | 200 | 8.7471 | - | - |
| 0.3774 | 300 | 8.6225 | - | - |
| 0.5031 | 400 | 8.5602 | - | - |
| 0.6289 | 500 | 8.5013 | - | - |
| 0.7547 | 600 | 8.4547 | - | - |
| 0.8805 | 700 | 8.4103 | - | - |
| 1.0 | 795 | - | 8.3649 | 0.8817 |
| 1.0063 | 800 | 8.3797 | - | - |
| 1.1321 | 900 | 8.3271 | - | - |
| 1.2579 | 1000 | 8.3076 | - | - |
| 1.3836 | 1100 | 8.2519 | - | - |
| 1.5094 | 1200 | 8.2203 | - | - |
| 1.6352 | 1300 | 8.2108 | - | - |
| 1.7610 | 1400 | 8.1601 | - | - |
| 1.8868 | 1500 | 8.1745 | - | - |
| 2.0 | 1590 | - | 8.1604 | 0.9278 |
| 2.0126 | 1600 | 8.1477 | - | - |
| 2.1384 | 1700 | 8.192 | - | - |
| 2.2642 | 1800 | 8.1813 | - | - |
| 2.3899 | 1900 | 8.1643 | - | - |
| 2.5157 | 2000 | 8.1401 | - | - |
| 2.6415 | 2100 | 8.1043 | - | - |
| 2.7673 | 2200 | 8.1092 | - | - |
| 2.8931 | 2300 | 8.0935 | - | - |
| 3.0 | 2385 | - | 8.0852 | 0.9385 |
| 3.0189 | 2400 | 8.0631 | - | - |
| 3.1447 | 2500 | 8.031 | - | - |
| 3.2704 | 2600 | 8.0052 | - | - |
| 3.3962 | 2700 | 7.9924 | - | - |
| 3.5220 | 2800 | 7.9701 | - | - |
| 3.6478 | 2900 | 7.958 | - | - |
| 3.7736 | 3000 | 7.9537 | - | - |
| 3.8994 | 3100 | 7.9321 | - | - |
| 4.0 | 3180 | - | 7.9955 | 0.9511 |
| 4.0252 | 3200 | 7.9196 | - | - |
| 4.1509 | 3300 | 7.9891 | - | - |
| 4.2767 | 3400 | 7.9788 | - | - |
| 4.4025 | 3500 | 7.9793 | - | - |
| 4.5283 | 3600 | 7.9699 | - | - |
| 4.6541 | 3700 | 7.9371 | - | - |
| 4.7799 | 3800 | 7.9548 | - | - |
| 4.9057 | 3900 | 7.9349 | - | - |
| 5.0 | 3975 | - | 7.9789 | 0.9520 |
| 5.0314 | 4000 | 7.9036 | - | - |
| 5.1572 | 4100 | 7.874 | - | - |
| 5.2830 | 4200 | 7.853 | - | - |
| 5.4088 | 4300 | 7.8523 | - | - |
| 5.5346 | 4400 | 7.8475 | - | - |
| 5.6604 | 4500 | 7.8436 | - | - |
| 5.7862 | 4600 | 7.8402 | - | - |
| 5.9119 | 4700 | 7.8097 | - | - |
| 6.0 | 4770 | - | 7.9175 | 0.9592 |
| 6.0377 | 4800 | 7.8271 | - | - |
| 6.1635 | 4900 | 7.8704 | - | - |
| 6.2893 | 5000 | 7.8793 | - | - |
| 6.4151 | 5100 | 7.8644 | - | - |
| 6.5409 | 5200 | 7.8611 | - | - |
| 6.6667 | 5300 | 7.8571 | - | - |
| 6.7925 | 5400 | 7.8439 | - | - |
| 6.9182 | 5500 | 7.845 | - | - |
| 7.0 | 5565 | - | 7.9248 | 0.9585 |
| 7.0440 | 5600 | 7.795 | - | - |
| 7.1698 | 5700 | 7.7812 | - | - |
| 7.2956 | 5800 | 7.7793 | - | - |
| 7.4214 | 5900 | 7.7608 | - | - |
| 7.5472 | 6000 | 7.7587 | - | - |
| 7.6730 | 6100 | 7.7586 | - | - |
| 7.7987 | 6200 | 7.7612 | - | - |
| 7.9245 | 6300 | 7.7674 | - | - |
| 8.0 | 6360 | - | 7.8833 | 0.9629 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@article{10531646,
2 author={Huang, Xiang and Peng, Hao and Zou, Dongcheng and Liu, Zhiwei and Li, Jianxin and Liu, Kay and Wu, Jia and Su, Jianlin and Yu, Philip S.},
3 journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing},
4 title={CoSENT: Consistent Sentence Embedding via Similarity Ranking},
5 year={2024},
6 doi={10.1109/TASLP.2024.3402087}
7}