Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup
Paper • 2101.06983 • Published • 2
This is a sentence-transformers model finetuned from PaDaS-Lab/xlm-roberta-base-msmarco. 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.
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'XLMRobertaModel'})
(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})
)
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 = [
'Quando rivolgersi all’ortopedico?',
'È opportuno avvalersi di un consulto specialistico da parte di un medico ortopedico nel caso in cui il paziente abbia subito lesioni traumatiche come quelle sopra menzionate oppure manifesti sintomi quali dolore locale e difficoltà motorie e articolatorie a carico degli arti o delle strutture muscolari.',
'In caso di epicondilite si raccomanda di rivolgersi ad uno specialista (ad esempio un ortopedico); il punto cardine del trattamento del gomito del tennista è in ogni caso la sospensione del movimento che causa dolore; impacchi di ghiaccio ed antinfiammatori possono ridurre il fastidio e il medico specialista può inoltre suggerire il ricorso a tutori specifici che allevino la tensione sul tendine. Anche un approccio fisioterapico può sicuramente aiutare, ma se queste terapie (od altre più avanzate come ) non dovessero funzionare è possibile valutare come ultima risorsa una gestione chirurgica (non prima di 6-12 mesi di trattamento tradizionale).',
]
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.6583, 0.3812],
# [0.6583, 1.0000, 0.5606],
# [0.3812, 0.5606, 1.0000]])
sentence_0, sentence_1, sentence_2, sentence_3, sentence_4, and sentence_5| sentence_0 | sentence_1 | sentence_2 | sentence_3 | sentence_4 | sentence_5 | |
|---|---|---|---|---|---|---|
| type | string | string | string | string | string | string |
| details |
|
|
|
|
|
|
| sentence_0 | sentence_1 | sentence_2 | sentence_3 | sentence_4 | sentence_5 |
|---|---|---|---|---|---|
What kind of careers could I pursue? |
The sky is pretty much the limit! Earning a degree from AUM helps provide a strong foundation for a career in business, healthcare, science, fine arts, nursing and a lot more. Many of our 32,000 graduates are nurses, teachers, theatre professionals, historians, business executives, economists, IT managers, kinesiologists–in addition to many other job titles. If you’re already passionate about a specific career direction, great! We can help you determine the College and the major that will help you get there. However, if you do not know what career field is right for you, we can help with valuable resources like the Career Development Center. Our career development specialists will help you assess your natural skills and interests, explore your academic options, and assist you in developing an implementation plan. This way, on graduation day you’ll be ready to hit the job market and jumpstart your career! |
There is a greater demand for CFP certificate holders in the BFSI domain and they would have an upper hand over others. A CFP professional could look at working with: Banks Wealth managements firms and distribution houses Mutual fund and insurance companies Boutique financial planning firms Financial planning software firms The certification would open up the doors of entrepreneurship. Aspiring individuals could look at starting on her own and pursue a career as a practicing financial planner. |
Primarily, Developmental Disability Nurses work in any role that brings them in contact with patients. This could be in a hospital, a clinic, in a group home, in the community, or in any other institutional environment. Some DD nurses also pursue careers in teaching, medical administration, and some policy work. |
After graduating, you could have the opportunity to play volleyball professionally, either domestically or internationally. You could also pursue coaching or related athletic professions. Additionally, the degree you earn will open doors to careers in your chosen field of study. |
A bachelor’s degree in interior design opens many doors. It will open the doors to a wide variety of opportunities. In addition to working in the field of residential design, you can pursue a career in commercial interior design, facility management, set design, showroom design, and sales. No matter what your interests are, you’ll find a career that suits you and your interests. Here are some of the different kinds of jobs you can get with an interiors degree. In addition to being a talented designer, you’ll be in high demand. A large number of businesses and restaurants seek a fresh look that will attract new customers. Individuals hire interior designers to help them remodel or flip existing spaces, or to create their dream home. The field of interior design is very diverse, and you’ll need a thorough knowledge of color theory, textiles, and other design elements to be successful. |
¿Cuáles son las actividades que se realizan en una excursión? |
Puedes saber qué incluye una excursión haciendo clic en una actividad. Entonces verás una descripción completa de esta bajo el título ‘Experiencia’. En especial, encontrarás información sobre lo que está incluido y no incluido en el precio de la excursión. Por ejemplo, transporte, refrescos o guía. |
Excursiones y actividades cercanas: Punta Cana le ofrece innumerables planes para combinar el ambiente relajante de los hoteles todo incluido con unas vacaciones más activas que consisten en excursiones, actividades y entretenidas atracciones. Hay varios parques naturales para los amantes de la naturaleza como Los Haitises (cerca de Samaná), e islas semidesiertas como la Isla Saona y la Isla Catalina (cerca de La Romana). Además, si te apetece descubrir la mezcla de la cultura nativa, te encantarán los Altos de Chavón en La Romana y, por supuesto, la ciudad de Santo Domingo. |
Sí, ofrecemos una variedad de actividades extracurriculares y oportunidades de inmersión cultural diseñadas específicamente para personas mayores. Estas actividades pueden incluir excursiones a museos, eventos culturales, talleres o clases de tango, lo que brinda a los estudiantes la oportunidad de sumergirse en la cultura argentina mientras mejoran sus habilidades lingüísticas. |
Las actividades que se realizan en Auckland son excursiones, visitar las playas, museos, actividad deportiva, pasear por los parques, entre otras, todas llenas de mucha diversión y facilitan la práctica del idioma inglés. |
Las excursiones incluye el transporte de ida y vuelta y la recogida en tu hotel de Mallorca. Dependiendo del proveedor algunas solo pasan por determinadas zonas de a isla a la hora de recoger a la personas. Te recomendamos que antes hacer la reserva te informes bien de esto. |
Why is chicken used for coward? |
The belief is that hens were used in this way because they were characterized as timid while roosters were portrayed as brave. Powerful leaders and other important men were sometimes referred to as “cocks” (in a good way) in the mid-16th century and hens were compared to them as weak. |
If someone calls you a chicken, they mean that you are a coward or afraid to do something. |
Definitely! You can to use chicken thighs, chicken breasts as well ss chicken drumsticks here. Just keep a note that if you are using chicken breasts, do not use small cut pieces, keep large chunks and cook. You can opt to use boneless chicken in this recipe. However, chicken on bone gives the best flavor, so I would recommend that. |
Sure, why not! It won't be the same, but it will be delicious. Shred up the cooked chicken and toss it with the marinade. Let it sit for 15 minutes before lightly sautéeing it just to warm through. |
Chickens are not considered prey of rats so they are safe from predation. However, rats will be attracted to chicken feed. That is why it is so important to keep the area clean, not only of poop but excess food on the ground. |
CachedMultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 32,
"gather_across_devices": false
}
per_device_train_batch_size: 128per_device_eval_batch_size: 128num_train_epochs: 1fp16: Truemulti_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 128per_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: 1num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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: Falsebf16: Falsefp16: Truefp16_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: 0dataloader_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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.0502 | 500 | 1.601 |
| 0.1004 | 1000 | 0.5685 |
| 0.1505 | 1500 | 0.5108 |
| 0.2007 | 2000 | 0.4857 |
| 0.2509 | 2500 | 0.4684 |
| 0.3011 | 3000 | 0.4544 |
| 0.3513 | 3500 | 0.4383 |
| 0.4014 | 4000 | 0.4292 |
| 0.4516 | 4500 | 0.4209 |
| 0.5018 | 5000 | 0.4125 |
| 0.5520 | 5500 | 0.4097 |
| 0.6022 | 6000 | 0.4045 |
| 0.6523 | 6500 | 0.4039 |
| 0.7025 | 7000 | 0.3965 |
| 0.7527 | 7500 | 0.3946 |
| 0.8029 | 8000 | 0.3912 |
| 0.8531 | 8500 | 0.3908 |
| 0.9033 | 9000 | 0.3872 |
| 0.9534 | 9500 | 0.3849 |
@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",
}
@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}
}
Base model
FacebookAI/xlm-roberta-base