CoolFace
Modelpublic

LequeuISIR/final-DPR-8e-05

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes19downloads
Model Card

SentenceTransformer

This is a sentence-transformers model trained on the json dataset. 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: Unknown -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 768 dimensions
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —json <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: ModernBertModel 
  (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("LequeuISIR/final-DPR-8e-05")
# Run inference
sentences = [
    'This incites social hatred, threatens economic and social stability, and undermines trust in the authorities.',
    '\xa0The conditions for a healthy entrepreneurship, where the most innovative and creative win and where the source of enrichment cannot be property speculation or guilds and networks.   ',
    'As a result, the profits of the oligarchs are more than 400 times what our entire country gets from the exploitation of natural resources.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

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

<!--

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

json
  • —Dataset: json
  • —Size: 478,146 training samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | label | |:--------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 17 tokens</li><li>mean: 33.73 tokens</li><li>max: 107 tokens</li></ul> | <ul><li>min: 16 tokens</li><li>mean: 33.84 tokens</li><li>max: 101 tokens</li></ul> | <ul><li>0: ~57.50%</li><li>1: ~4.10%</li><li>2: ~38.40%</li></ul> |
  • —Samples: | sentence1 | sentence2 | label | |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------| | <code>There have also been other important structural changes in the countryside, which have come together to form this new, as yet unknown, country.</code> | <code>Meanwhile, investment, which is the way to increase production, employment capacity and competitiveness of the economy, fell from 20% of output in 1974 to only 11.8% on average between 1984 and 1988.</code> | <code>0</code> | | <code>Introduce new visa categories so we can be responsive to humanitarian needs and incentivise greater investment in our domestic infrastructure and regional economies</code> | <code>The purpose of the project is to design and implement public policies aimed at achieving greater and faster inclusion of immigrants.</code> | <code>2</code> | | <code>and economic crimes that seriously and generally affect the fundamental rights of individuals and the international community as a whole.</code> | <code>For the first time in the history, not only of Ecuador, but of the entire world, a government promoted a public audit process of the foreign debt and declared some of its tranches illegitimate and immoral.</code> | <code>0</code> |
  • —Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Evaluation Dataset

json
  • —Dataset: json
  • —Size: 478,146 evaluation samples
  • —Columns: <code>sentence1</code>, <code>sentence2</code>, and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence1 | sentence2 | label | |:--------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 17 tokens</li><li>mean: 33.62 tokens</li><li>max: 103 tokens</li></ul> | <ul><li>min: 16 tokens</li><li>mean: 34.48 tokens</li><li>max: 111 tokens</li></ul> | <ul><li>0: ~57.30%</li><li>1: ~2.90%</li><li>2: ~39.80%</li></ul> |
  • —Samples: | sentence1 | sentence2 | label | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------| | <code>The anchoring of the Slovak Republic in the European Union allows citizens to feel: secure politically, secure economically, secure socially.</code> | <code>Radikale Venstre wants Denmark to participate fully and firmly in EU cooperation on immigration, asylum and cross-border crime.</code> | <code>2</code> | | <code>Portugal's participation in the Community's negotiation of the next financial perspective should also be geared in the same direction.</code> | <code>Given the dynamic international framework, safeguarding the national interest requires adjustments to each of these vectors.</code> | <code>2</code> | | <code>On asylum, the Green Party will: Dismantle the direct provision system and replace it with an efficient and humane system for determining the status of asylum seekers</code> | <code>The crisis in the coal sector subsequently forced these immigrant workers to move into other economic sectors such as metallurgy, chemicals, construction and transport.</code> | <code>2</code> |
  • —Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 64
  • —per_device_eval_batch_size: 64
  • —learning_rate: 8e-05
  • —num_train_epochs: 5
  • —warmup_ratio: 0.05
  • —bf16: 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: 64
  • —per_device_eval_batch_size: 64
  • —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: 8e-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: 5
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.05
  • —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: True
  • —fp16: False
  • —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: False
  • —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
  • —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
  • —dispatch_batches: None
  • —split_batches: 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
  • —eval_use_gather_object: False
  • —average_tokens_across_devices: False
  • —prompts: None
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining LossValidation Loss
0.08375000.78899.5828
0.167310001.21589.3274
0.251015001.82159.4274
0.334620002.35488.2583
0.418325002.74938.1446
0.501930002.89987.9046
0.585635002.92988.0640
0.669240002.90537.2746
0.752945003.09057.5099
0.836550003.18647.3883
0.920255003.23226.9968
1.003860003.11947.4682
1.087565003.01227.7295
1.171270003.04537.1696
1.254875002.94397.2775
1.338580003.11087.4838
1.422185002.85127.5204
1.505890002.98657.4528
1.589495002.99958.0682
1.6731100003.10737.5344
1.7567105003.06317.4572
1.8404110002.99157.4961
1.9240115003.04457.3575
2.0077120002.95017.9786
2.0914125002.33778.6208
2.1750130002.28338.8356
2.2587135002.27858.8709
2.3423140002.30128.6250
2.4260145002.34888.1099
2.5096150002.0959.2305
2.5933155002.41238.6405
2.6769160002.22368.7805
2.7606165002.33678.7110
2.8442170002.11598.6447
2.9279175002.16228.7123
3.0115180002.19169.0314
3.0952185001.6049.3373
3.1789190001.41169.6509
3.2625195001.40369.9127
3.3462200001.53929.8093
3.4298205001.57919.8325
3.5135210001.53439.7822
3.5971215001.39139.6243
3.6808220001.51519.9644
3.7644225001.39229.7816
3.8481230001.33619.5338
3.9317235001.33639.8282
4.0154240001.223410.2117
4.0990245000.592710.4107
4.1827250000.687910.4405
4.2664255000.683210.5138
4.3500260000.651410.2798
4.4337265000.739610.3250
4.5173270000.681310.4115
4.6010275000.76510.1365
4.6846280000.591510.2402
4.7683285000.502810.3197
4.8519290000.530610.3270
4.9356295000.588610.3543

Framework Versions

  • —Python: 3.9.21
  • —Sentence Transformers: 3.4.0
  • —Transformers: 4.48.1
  • —PyTorch: 2.5.1+cu124
  • —Accelerate: 1.3.0
  • —Datasets: 3.2.0
  • —Tokenizers: 0.21.0

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