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
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 1024 tokens
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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:
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("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]
Training Details
Training Dataset
Unnamed Dataset
- Size: 5,817,740 training samples
- Columns:
state_nameandpremise_name - Approximate statistics based on the first 1000 samples:
state_name premise_name type string string details - min: 11 tokens
- mean: 16.44 tokens
- max: 24 tokens
- min: 3 tokens
- mean: 10.9 tokens
- max: 50 tokens
- Samples:
state_name premise_name Mathlib.Algebra.Field.IsField#12Classical.choose_specMathlib.Algebra.Field.IsField#12IsField.mul_commMathlib.Algebra.Field.IsField#12eq_of_heq - Loss:
loss.MaskedCachedMultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Evaluation Dataset
Unnamed Dataset
- Size: 1,959 evaluation samples
- Columns:
state_nameandpremise_name - Approximate statistics based on the first 1000 samples:
state_name premise_name type string string details - min: 10 tokens
- mean: 17.08 tokens
- max: 24 tokens
- min: 5 tokens
- mean: 11.05 tokens
- max: 31 tokens
- Samples:
state_name premise_name Mathlib.Algebra.Algebra.Hom#80AlgHom.commutesMathlib.Algebra.Algebra.NonUnitalSubalgebra#237NonUnitalAlgHom.instNonUnitalAlgSemiHomClassMathlib.Algebra.Algebra.NonUnitalSubalgebra#237NonUnitalAlgebra.mem_top - Loss:
loss.MaskedCachedMultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepsper_device_train_batch_size: 256per_device_eval_batch_size: 64num_train_epochs: 1.0lr_scheduler_type: cosinewarmup_ratio: 0.03bf16: Truedataloader_num_workers: 4resume_from_checkpoint: /data/user_data/thomaszh/models/all-roberta-large-v1-lr5e-5-bs256-nneg3-ml/checkpoint-22116
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 256per_device_eval_batch_size: 64per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1.0max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.03warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 4dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: /data/user_data/thomaszh/models/all-roberta-large-v1-lr5e-5-bs256-nneg3-ml/checkpoint-22116hub_model_id: Nonehub_strategy: every_savehub_private_repo: Falsehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseeval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Nonedispatch_batches: Nonesplit_batches: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falsebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportional
Training Logs
| Epoch | Step | Training Loss | loss |
|---|---|---|---|
| 0.9733 | 22120 | 1.1781 | - |
| 0.9738 | 22130 | 1.1226 | - |
| 0.9742 | 22140 | 1.219 | - |
| 0.9747 | 22150 | 1.1531 | - |
| 0.9751 | 22160 | 1.1907 | - |
| 0.9755 | 22170 | 1.2081 | - |
| 0.9760 | 22180 | 1.1849 | - |
| 0.9764 | 22190 | 1.1923 | - |
| 0.9769 | 22200 | 1.1496 | - |
| 0.9773 | 22210 | 1.1868 | - |
| 0.9777 | 22220 | 1.1968 | - |
| 0.9782 | 22230 | 1.2081 | - |
| 0.9786 | 22240 | 1.1685 | - |
| 0.9791 | 22250 | 1.1618 | - |
| 0.9795 | 22260 | 1.1504 | - |
| 0.9799 | 22270 | 1.1328 | - |
| 0.9804 | 22280 | 1.2012 | - |
| 0.9808 | 22290 | 1.2439 | - |
| 0.9813 | 22300 | 1.202 | - |
| 0.9817 | 22310 | 1.1656 | - |
| 0.9821 | 22320 | 1.1664 | - |
| 0.9826 | 22330 | 1.1423 | - |
| 0.9830 | 22340 | 1.177 | - |
| 0.9832 | 22344 | - | 1.3153 |
| 0.9835 | 22350 | 1.1704 | - |
| 0.9839 | 22360 | 1.1787 | - |
| 0.9843 | 22370 | 1.2041 | - |
| 0.9848 | 22380 | 1.2031 | - |
| 0.9852 | 22390 | 1.1365 | - |
| 0.9857 | 22400 | 1.212 | - |
| 0.9861 | 22410 | 1.1562 | - |
| 0.9865 | 22420 | 1.1781 | - |
| 0.9870 | 22430 | 1.1507 | - |
| 0.9874 | 22440 | 1.2138 | - |
| 0.9879 | 22450 | 1.1967 | - |
| 0.9883 | 22460 | 1.1548 | - |
| 0.9887 | 22470 | 1.2121 | - |
| 0.9892 | 22480 | 1.1681 | - |
| 0.9896 | 22490 | 1.1805 | - |
| 0.9901 | 22500 | 1.2138 | - |
| 0.9905 | 22510 | 1.179 | - |
| 0.9909 | 22520 | 1.1608 | - |
| 0.9914 | 22530 | 1.1851 | - |
| 0.9918 | 22540 | 1.1804 | - |
| 0.9923 | 22550 | 1.154 | - |
| 0.9927 | 22560 | 1.1649 | - |
| 0.9931 | 22570 | 1.1815 | - |
| 0.9932 | 22572 | - | 1.3150 |
| 0.9936 | 22580 | 1.201 | - |
| 0.9940 | 22590 | 1.1987 | - |
| 0.9945 | 22600 | 1.1885 | - |
| 0.9949 | 22610 | 1.1378 | - |
| 0.9953 | 22620 | 1.1776 | - |
| 0.9958 | 22630 | 1.1298 | - |
| 0.9962 | 22640 | 1.2037 | - |
| 0.9967 | 22650 | 1.1926 | - |
| 0.9971 | 22660 | 1.2298 | - |
| 0.9975 | 22670 | 1.1539 | - |
| 0.9980 | 22680 | 1.1929 | - |
| 0.9984 | 22690 | 1.1783 | - |
| 0.9989 | 22700 | 1.1222 | - |
| 0.9993 | 22710 | 1.1309 | - |
| 0.9997 | 22720 | 1.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
@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
@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}
}
- Downloads last month
- 4
Model tree for hanwenzhu/all-roberta-large-v1-lr5e-5-bs256-nneg3-ml-mar16
Base model
sentence-transformers/all-roberta-large-v1