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
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity

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:

pip install -U sentence-transformers

Then you can load this model and run inference.

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]])

Training Details

Training Dataset

Unnamed Dataset

  • Size: 150,000 training samples
  • Columns: sentence_0 and sentence_1
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1
    type string string
    details
    • min: 8 tokens
    • mean: 149.89 tokens
    • max: 256 tokens
    • min: 16 tokens
    • mean: 141.11 tokens
    • max: 256 tokens
  • Samples:
    sentence_0 sentence_1
    $f_n,f_n^{\prime}\rightarrow 0$ pointwise. But $(f_n^{\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 $f_n\colon [a,b]\rightarrow \mathbb{R}$ be a sequence of differentiable functions on $[a,b]$, and let $f_n\rightarrow f$ pointwise on $[a,b]$. If $f_n^{\prime}\rightarrow g$ uniformly on $[a,b]$, then $f$ is differentiable on $[a,b]$ and $f^{\prime} = g$. Find sequence of differentiable functions $f_n$ on $\mathbb{R}$ that converge uniformly, but $f'_n$ converges only pointwise Question: Find a sequence of differentiable functions $f_n$ 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 $f_n=x^n$ or $f_n=\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.
    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("true");} }; } } thanks What's the difference between JavaScript and Java? What's the difference between JavaScript and Java?
    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... 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. < 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 dba_objects WHERE object_name like '%DTN%' There is absolutely no documentation on this database and I have no idea where this field is being pulled from. Any thoughts?
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "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

Click to expand
  • 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: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch_fused
  • 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: {}

Training Logs

Epoch Step Training Loss
0.1067 500 1.3025
0.2133 1000 0.2615
0.3200 1500 0.1999
0.4266 2000 0.1671
0.5333 2500 0.1465
0.6399 3000 0.1371
0.7466 3500 0.1354
0.8532 4000 0.1277
0.9599 4500 0.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

@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

@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}
}
Downloads last month
14
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ahmedosama2003/techforum-duplicate-detector

Finetuned
(139)
this model

Papers for ahmedosama2003/techforum-duplicate-detector