Team Ai
Modelpublic

mihirsingh141/retriever_module

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes96downloads
Model Card

term-mapper

This is a sentence-transformers model finetuned from sentence-transformers/all-mpnet-base-v2. 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: sentence-transformers/all-mpnet-base-v2 <!-- at revision e8c3b32edf5434bc2275fc9bab85f82640a19130 -->
  • —Maximum Sequence Length: 384 tokens
  • —Output Dimensionality: 768 dimensions
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown -->
  • —Language: en
  • —License: apache-2.0

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 384, 'do_lower_case': False, 'architecture': '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})
  (2): 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("sentence_transformers_model_id")
# Run inference
sentences = [
    'board cert agency code, Board Cert Agency Code',
    '2nd board cert',
    'comments',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000,  0.6759, -0.0045],
#         [ 0.6759,  1.0000,  0.0552],
#         [-0.0045,  0.0552,  1.0000]])

<!--

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

<!--

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: 61,927 training samples
  • —Columns: <code>anchor</code> and <code>positive</code>
  • —Approximate statistics based on the first 1000 samples: | | anchor | positive | |:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 9 tokens</li><li>mean: 10.39 tokens</li><li>max: 11 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 6.42 tokens</li><li>max: 25 tokens</li></ul> |
  • —Samples: | anchor | positive | |:------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------| | <code>accepting patients ind, Accepting Patients IND</code> | <code>primary spec accepting new patients for pcps and ob</code> | | <code>accepting patients ind, Accepting Patients IND</code> | <code>accepting new patients (all practitioner types ongoing outpatient basis) (y n) (no blanks)</code> | | <code>accepting patients ind, Accepting Patients IND</code> | <code>acc ind for pts</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 7,092 evaluation samples
  • —Columns: <code>anchor</code> and <code>positive</code>
  • —Approximate statistics based on the first 1000 samples: | | anchor | positive | |:--------|:----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 5 tokens</li><li>mean: 11.39 tokens</li><li>max: 19 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 6.96 tokens</li><li>max: 23 tokens</li></ul> |
  • —Samples: | anchor | positive | |:------------------------------------------------------------|:-------------------------------------| | <code>accepting patients ind, Accepting Patients IND</code> | <code>open close panel</code> | | <code>accepting patients ind, Accepting Patients IND</code> | <code>panel status</code> | | <code>accepting patients ind, Accepting Patients IND</code> | <code>commercial panel status</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: 32
  • —per_device_eval_batch_size: 32
  • —learning_rate: 2e-05
  • —warmup_ratio: 0.1
  • —fp16: True
  • —load_best_model_at_end: 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: 32
  • —per_device_eval_batch_size: 32
  • —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: 3
  • —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: 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: no_duplicates
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

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

EpochStepTraining LossValidation Loss
0.0258500.8668-
0.05171000.75050.6548
0.07751500.6506-
0.10332000.46720.4107
0.12912500.403-
0.15503000.32840.2954
0.18083500.3005-
0.20664000.22480.2149
0.23244500.219-
0.25835000.17940.1685
0.28415500.1441-
0.30996000.15220.1397
0.33576500.1322-
0.36167000.12540.1283
0.38747500.1194-
0.41328000.1340.1140
0.43908500.0932-
0.46499000.10250.0957
0.49079500.1063-
0.516510000.09560.0945
0.542410500.071-
0.568211000.07270.0836
0.594011500.0895-
0.619812000.07860.0750
0.645712500.0923-
0.671513000.09050.0742
0.697313500.0522-
0.723114000.06450.0693
0.749014500.0711-
0.774815000.06550.0627
0.800615500.0532-
0.826416000.06020.0615
0.852316500.0674-
0.878117000.05370.0564
0.903917500.0578-
0.929818000.06430.0533
0.955618500.0655-
0.981419000.05620.0519
1.007219500.0538-
1.033120000.0430.0470
1.058920500.035-
1.084721000.04120.0454
1.110521500.0362-
1.136422000.04540.0449
1.162222500.0438-
1.188023000.04530.0433
1.213823500.0298-
1.239724000.03510.0444
1.265524500.0349-
1.291325000.03910.0431
1.317125500.0404-
1.343026000.03710.0423
1.368826500.0382-
1.394627000.03250.0420
1.420527500.0394-
1.446328000.04690.0421
1.472128500.0466-
1.497929000.03740.0407
1.523829500.0321-
1.549630000.0220.0388
1.575430500.0229-
1.601231000.03540.0367
1.627131500.0275-
1.652932000.0360.0358
1.678732500.0349-
1.704533000.03590.0337
1.730433500.0386-
1.756234000.0290.0341
1.782034500.0348-
1.807935000.02410.0342
1.833735500.0281-
1.859536000.02390.0323
1.885336500.0281-
1.911237000.03010.0323
1.937037500.0186-
1.962838000.02460.0308
1.988638500.0315-
2.014539000.01850.0302
2.040339500.0272-
2.066140000.0250.0304
2.091940500.0262-
2.117841000.020.0306
2.143641500.0163-
2.169442000.03010.0294
2.195242500.0176-
2.221143000.02060.0297
2.246943500.0121-
2.272744000.02060.0294
2.298644500.018-
2.324445000.01780.0291
2.350245500.0153-
2.376046000.02190.0288
2.401946500.0214-
2.427747000.02120.0281
2.453547500.0183-
2.479348000.03020.0280
2.505248500.0158-
2.531049000.020.0274
2.556849500.0171-
2.582650000.02750.0269
2.608550500.0193-
2.634351000.01580.0269
2.660151500.0179-
2.686052000.02140.0269
2.711852500.0225-
2.737653000.01660.0264
2.763453500.0243-
2.789354000.01540.0262
2.815154500.0245-
2.840955000.01220.0261
2.866755500.0234-
2.892656000.02170.0259
2.918456500.0166-
2.944257000.01650.0258
2.970057500.0126-
2.995958000.02010.0258
  • —The bold row denotes the saved checkpoint. </details>

Framework Versions

  • —Python: 3.10.18
  • —Sentence Transformers: 5.0.0
  • —Transformers: 4.53.3
  • —PyTorch: 2.7.1+cu126
  • —Accelerate: 1.9.0
  • —Datasets: 3.6.0
  • —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",
}
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. -->