CoolFace
Modelpublic

ahmedosama2003/techforum-duplicate-detector

sourceHugging Faceupdated 4mo agoView on Hugging Face
1likes71downloads
Model Card

SentenceTransformer based on microsoft/codebert-base

This is a sentence-transformers model finetuned from microsoft/codebert-base. 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/codebert-base <!-- at revision 3b0952feddeffad0063f274080e3c23d75e7eb39 -->
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'RobertaModel'})
  (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("sentence_transformers_model_id")
# Run inference
sentences = [
    "How to adjust volume using batch files I want to know how to set volume with cmd but can't download software. I know it is possible because I had it but deleted it. opps",
    "How can I control the master volume in Windows? Some keyboards have volume controls on them that can be pressed anytime to control the master volume.  My keyboard does not have that.  Is there a way that I can create a key macro that will work like the volume controls on those keyboards?  It should always allow me to control the volume, even if I'm playing a game.",
    "How many organisms have ever lived on Earth? I've looked for some information on this, but couldn't find anything useful. Has there been any noteworthy attempt to estimate the sum amount of individuals of all species that have ever lived on Earth?",
]
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.3945,  0.0683],
#         [ 0.3945,  1.0000, -0.0343],
#         [ 0.0683, -0.0343,  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: 150,000 training samples
  • Columns: <code>sentence0</code> and <code>sentence1</code>
  • Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | |:--------|:------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 8 tokens</li><li>mean: 149.89 tokens</li><li>max: 256 tokens</li></ul> | <ul><li>min: 16 tokens</li><li>mean: 141.11 tokens</li><li>max: 256 tokens</li></ul> |
  • Samples: | sentence0 | sentence1 | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>$fn,fn^{\prime}\rightarrow 0$ pointwise. But $(fn^{\prime}) $ is not uniformly convergent. Find an example of such a sequence of functions. I was studying uniform convergence of sequence and series. I encounter this problem. Trying to find an example. Any help will be appreciated. The domain of the function can be any closed interval. For example, [0,1] will suffice. I am looking for an example to show that the conditions of the following theorems are necessary but not sufficient: Let $fn\colon [a,b]\rightarrow \mathbb{R}$ be a sequence of differentiable functions on $[a,b]$, and let $fn\rightarrow f$ pointwise on $[a,b]$. If $fn^{\prime}\rightarrow g$ uniformly on $[a,b]$, then $f$ is differentiable on $[a,b]$ and $f^{\prime} = g$.</code> | <code>Find sequence of differentiable functions $fn$ on $\mathbb{R}$ that converge uniformly, but $f'n$ converges only pointwise Question: Find a sequence of differentiable functions $fn$ on $\mathbb{R}$ that converge uniformly to a differentiable function $f$, such that $f'n$ converges pointwise but not uniformly to $f'$. Attempt: I have tried a number of possibilities, such as $fn=x^n$ or $fn=\frac{x^n}{n}$ but I don't know what the right approach is to construct the function. I am initially thinking that it's easiest to construct such a sequence of functions on the interval $[0,1]$ so that in the limit of $n$, part of the function goes to $0$ and the other part goes to $1$. However, this would make the resulting $f$ non-differentiable.</code> | | <code>Why is isNaN() is undefined? I'm new to this, so wondering if someone could please advise why isNaN() is undefined? package nan; public class nan { public static void main(String[] args) { { if (isNaN(1)) {System.out.println(&quot;true&quot;);} }; } } thanks</code> | <code>What's the difference between JavaScript and Java? What's the difference between JavaScript and Java?</code> | | <code>How can I find data pattern matches in all fields/tables in an oracle database? Specifically, I am trying to find any credit card numbers that have been typed into text fields of any table in the database. This code below works for a single table where I know the primary key is "ID", but I cannot find a way to make this dynamic so that I can loop through many hundreds of table and rows. drop table tab1 purge; create table tab1(id number primary key, col1 varchar2(20), col2 varchar2(20), col3 varchar2(20)); Insert into TAB1 Values (1, 'No card here', 'Hello', 'nothing'); Insert into TAB1 Values (2, '1111222233334444', 'Visa', 'Hello'); Insert into TAB1 Values (3, 'Hello', 'MasterCard', '1111 2222 3333 4444'); Insert into TAB1 Values (4, 'Hello', '1111-2222-3333-4444', 'Visa'); Insert into TAB1 Values (5, 'Amex', 'Hello', '1111 222222 33333'); Insert into TAB1 Values (6, '111122222233333', 'Amex', 'Hello'); Insert into TAB1 Values (7, 'nothing', 'No card here', 'Hello'); COMMI...</code> | <code>Search All Fields In All Tables For A Specific Value (Oracle) Is it possible to search every field of every table for a particular value in Oracle? There are hundreds of tables with thousands of rows in some tables so I know this could take a very long time to query. But the only thing I know is that a value for the field I would like to query against is 1/22/2008P09RR8. &lt; I've tried using this statement below to find an appropriate column based on what I think it should be named but it returned no results. SELECT * from dbaobjects WHERE objectname like '%DTN%' There is absolutely no documentation on this database and I have no idea where this field is being pulled from. Any thoughts?</code> |
  • Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • num_train_epochs: 1
  • multi_dataset_batch_sampler: round_robin
All Hyperparameters

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

  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 1
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_ratio: None
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • enable_jit_checkpoint: False
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • use_cpu: False
  • seed: 42
  • data_seed: None
  • bf16: False
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: -1
  • ddp_backend: None
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamwtorchfused
  • optim_args: None
  • group_by_length: False
  • length_column_name: length
  • project: huggingface
  • trackio_space_id: trackio
  • 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
  • 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_for_metrics: []
  • eval_do_concat_batches: True
  • auto_find_batch_size: False
  • full_determinism: False
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_num_input_tokens_seen: no
  • 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: True
  • use_cache: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin
  • router_mapping: {}
  • learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining Loss
0.10675001.3025
0.213310000.2615
0.320015000.1999
0.426620000.1671
0.533325000.1465
0.639930000.1371
0.746635000.1354
0.853240000.1277
0.959945000.1233

Framework Versions

  • Python: 3.12.12
  • Sentence Transformers: 5.2.3
  • Transformers: 5.0.0
  • PyTorch: 2.10.0+cu128
  • Accelerate: 1.12.0
  • Datasets: 4.8.3
  • Tokenizers: 0.22.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. -->