CoolFace
Modelpublic

hanwenzhu/all-roberta-large-v1-lr5e-5-bs256-nneg3-ml-mar16

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

SentenceTransformer based on sentence-transformers/all-roberta-large-v1

This is a sentence-transformers model finetuned from sentence-transformers/all-roberta-large-v1. It maps sentences & paragraphs to a 1024-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-roberta-large-v1 <!-- at revision cf74d8acd4f198de950bf004b262e6accfed5d2c -->
  • —Maximum Sequence Length: 256 tokens
  • —Output Dimensionality: 1024 tokens
  • —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}) with Transformer model: RobertaModel 
  (1): Pooling({'word_embedding_dimension': 1024, '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("hanwenzhu/all-roberta-large-v1-lr5e-5-bs256-nneg3-ml-mar16")
# Run inference
sentences = [
    'Mathlib.Algebra.Polynomial.FieldDivision#94',
    'normalize_apply',
    'DifferentiableWithinAt.hasFDerivWithinAt',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]

# 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

Unnamed Dataset
  • —Size: 5,817,740 training samples
  • —Columns: <code>statename</code> and <code>premisename</code>
  • —Approximate statistics based on the first 1000 samples: | | statename | premisename | |:--------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 11 tokens</li><li>mean: 16.44 tokens</li><li>max: 24 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 10.9 tokens</li><li>max: 50 tokens</li></ul> |
  • —Samples: | statename | premisename | |:----------------------------------------------|:-----------------------------------| | <code>Mathlib.Algebra.Field.IsField#12</code> | <code>Classical.choosespec</code> | | <code>Mathlib.Algebra.Field.IsField#12</code> | <code>IsField.mulcomm</code> | | <code>Mathlib.Algebra.Field.IsField#12</code> | <code>eqofheq</code> |
  • —Loss: <code>loss.MaskedCachedMultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 1,959 evaluation samples
  • —Columns: <code>statename</code> and <code>premisename</code>
  • —Approximate statistics based on the first 1000 samples: | | statename | premisename | |:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 10 tokens</li><li>mean: 17.08 tokens</li><li>max: 24 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 11.05 tokens</li><li>max: 31 tokens</li></ul> |
  • —Samples: | statename | premisename | |:-------------------------------------------------------------|:----------------------------------------------------------| | <code>Mathlib.Algebra.Algebra.Hom#80</code> | <code>AlgHom.commutes</code> | | <code>Mathlib.Algebra.Algebra.NonUnitalSubalgebra#237</code> | <code>NonUnitalAlgHom.instNonUnitalAlgSemiHomClass</code> | | <code>Mathlib.Algebra.Algebra.NonUnitalSubalgebra#237</code> | <code>NonUnitalAlgebra.mem_top</code> |
  • —Loss: <code>loss.MaskedCachedMultipleNegativesRankingLoss</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: 256
  • —per_device_eval_batch_size: 64
  • —num_train_epochs: 1.0
  • —lr_scheduler_type: cosine
  • —warmup_ratio: 0.03
  • —bf16: True
  • —dataloader_num_workers: 4
  • —resume_from_checkpoint: /data/user_data/thomaszh/models/all-roberta-large-v1-lr5e-5-bs256-nneg3-ml/checkpoint-22116
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: 256
  • —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: 5e-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: 1.0
  • —max_steps: -1
  • —lr_scheduler_type: cosine
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.03
  • —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: 4
  • —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: /data/user_data/thomaszh/models/all-roberta-large-v1-lr5e-5-bs256-nneg3-ml/checkpoint-22116
  • —hub_model_id: None
  • —hub_strategy: every_save
  • —hub_private_repo: False
  • —hub_always_push: False
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —include_inputs_for_metrics: False
  • —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
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining Lossloss
0.9733221201.1781-
0.9738221301.1226-
0.9742221401.219-
0.9747221501.1531-
0.9751221601.1907-
0.9755221701.2081-
0.9760221801.1849-
0.9764221901.1923-
0.9769222001.1496-
0.9773222101.1868-
0.9777222201.1968-
0.9782222301.2081-
0.9786222401.1685-
0.9791222501.1618-
0.9795222601.1504-
0.9799222701.1328-
0.9804222801.2012-
0.9808222901.2439-
0.9813223001.202-
0.9817223101.1656-
0.9821223201.1664-
0.9826223301.1423-
0.9830223401.177-
0.983222344-1.3153
0.9835223501.1704-
0.9839223601.1787-
0.9843223701.2041-
0.9848223801.2031-
0.9852223901.1365-
0.9857224001.212-
0.9861224101.1562-
0.9865224201.1781-
0.9870224301.1507-
0.9874224401.2138-
0.9879224501.1967-
0.9883224601.1548-
0.9887224701.2121-
0.9892224801.1681-
0.9896224901.1805-
0.9901225001.2138-
0.9905225101.179-
0.9909225201.1608-
0.9914225301.1851-
0.9918225401.1804-
0.9923225501.154-
0.9927225601.1649-
0.9931225701.1815-
0.993222572-1.3150
0.9936225801.201-
0.9940225901.1987-
0.9945226001.1885-
0.9949226101.1378-
0.9953226201.1776-
0.9958226301.1298-
0.9962226401.2037-
0.9967226501.1926-
0.9971226601.2298-
0.9975226701.1539-
0.9980226801.1929-
0.9984226901.1783-
0.9989227001.1222-
0.9993227101.1309-
0.9997227201.1766-

Framework Versions

  • —Python: 3.11.8
  • —Sentence Transformers: 3.1.1
  • —Transformers: 4.45.1
  • —PyTorch: 2.5.1.post302
  • —Accelerate: 0.34.2
  • —Datasets: 3.0.0
  • —Tokenizers: 0.20.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",
}
MaskedCachedMultipleNegativesRankingLoss
bibtex
@misc{gao2021scaling,
    title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year={2021},
    eprint={2101.06983},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

<!--

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