Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup
Paper • 2101.06983 • Published • 2
How to use Jrinky/jina_final_temp with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Jrinky/jina_final_temp", trust_remote_code=True)
sentences = [
"What are some examples of postgraduate fellowships in the United States and Canada",
"Fellowships as a training program\nFellowships may involve a short placement for capacity building, e.g., to get more experience in government, such as the American Association for the Advancement of Science's fellowships and the American Academy of Arts and Sciences Fellowship programs. Some institutions offer fellowships as a professional training program as well as a financial grant, such as the Balsillie School of International Affairs, where tuition and other fees are paid by the fellowship. Fellowships as a special membership grade\n\nFellows are often the highest grade of membership of many professional associations or learned societies, for example, the Chartered Institute of Arbitrators, the Chartered Governance Institute or Royal College of Surgeons. Lower grades are referred to as members (who typically share voting rights with the fellows), or associates (who may or may not, depending on whether \"associate\" status is a form of full membership). Additional grades of membership exist in, for example, the IEEE and the ACM. Fellowships of this type can be awarded as a title of honor in their own right, e.g. the Fellowship of the Royal Society (FRS). Exclusive learned societies such as the Royal Society have Fellow as the only grade of membership. Appointment as an honorary fellow in a learned or professional society can be either to honour exceptional achievement or service within the professional domain of the awarding body or to honour contributions related to the domain from someone who is professionally outside it. Membership of the awarding body may or may not be a requirement. How a fellowship is awarded varies for each society, but may typically involve some or all of these:\n A qualifying period in a lower grade\n Passing a series of examinations\n Nomination by two existing fellows who know the applicant professionally\n Evidence of continued formal training post-qualification\n Evidence of substantial achievement in the subject area\n Submission of a thesis or portfolio of works which will be examined\n Election by a vote of the fellowship\n\nIn ancient universities\n\nAt the ancient universities of the University of Oxford, the University of Cambridge, and Trinity College, Dublin, members of the teaching staff typically have two affiliations: one as a reader, lecturer, or other academic rank within a department of the university, as at other universities, and a second affiliation as a fellow of one of the colleges of the university. The fellows, sometimes referred to as university dons, form the governing body of the college. They may elect a council to handle day-to-day management.",
"If you are an enrolled domestic or international student studying a full degree program, you may be eligible to study overseas! We have over 70 partner institutions worldwide and the opportunities are endless. Visit our USC International and Study Overseas blog to learn more about the amazing experiences our students are having abroad.",
"The title (senior) fellow can also be bestowed to an academic member of staff upon retirement who continues to be affiliated to a university in the United Kingdom. The term teaching fellow or teaching assistant is used, in the United States and United Kingdom, in secondary school, high school and middle school setting for students or adults that assist a teacher with one or more classes. Medical fellowships\n\nIn US medical institutions, a fellow refers to someone who has completed residency training (e.g. in internal medicine, pediatrics, general surgery, etc.) and is currently in a 1 to 3 year subspecialty training program (e.g. cardiology, pediatric nephrology, transplant surgery, etc.). Research fellowships\n\nAs an academic position\n\nThe title of research fellow may be used to denote an academic position at a university or a similar institution; it is roughly equivalent to the title of lecturer in the Commonwealth teaching career pathway. As a financial grant\nResearch fellow may also refer to the recipient of academic financial grant or scholarship. For example, in Germany, institutions such as the Alexander von Humboldt Foundation offer research fellowship for postdoctoral research and refer to the holder as research fellows, while the award holder may formally hold a specific academic title at their home institution (e.g., Privatdozent). These are often shortened to the name of the programme or organization, e.g. Dorothy Hodgkin Fellow rather than Dorothy Hodgkin Research Fellow, except where this might cause confusion with another fellowship, (e.g. Royal Society University Research Fellowship.)",
"In the context of graduate school in the United States and Canada, a fellow is a recipient of a postgraduate fellowship. Examples include the NSF Graduate Research Fellowship, the DoD National Defense Science and Engineering Graduate Fellowship, the DOE Computational Science Graduate Fellowship, the Guggenheim Fellowship, the Rosenthal Fellowship, the Frank Knox Memorial Fellowship, the Woodrow Wilson Teaching Fellowship and the Presidential Management Fellowship. It is granted to prospective or current students, on the basis of their academic or research achievements. In the UK, research fellowships are awarded to support postdoctoral researchers such as those funded by the Wellcome Trust and the Biotechnology and Biological Sciences Research Council (BBSRC). At ETH Zurich, postdoctoral fellowships support incoming researchers. The MacArthur Fellows Program (aka \"genius grant\") as prestigious research fellowship awarded in the United States. Fellowships as a training program\nFellowships may involve a short placement for capacity building, e.g., to get more experience in government, such as the American Association for the Advancement of Science's fellowships and the American Academy of Arts and Sciences Fellowship programs. Some institutions offer fellowships as a professional training program as well as a financial grant, such as the Balsillie School of International Affairs, where tuition and other fees are paid by the fellowship. Fellowships as a special membership grade\n\nFellows are often the highest grade of membership of many professional associations or learned societies, for example, the Chartered Institute of Arbitrators, the Chartered Governance Institute or Royal College of Surgeons. Lower grades are referred to as members (who typically share voting rights with the fellows), or associates (who may or may not, depending on whether \"associate\" status is a form of full membership). Additional grades of membership exist in, for example, the IEEE and the ACM. Fellowships of this type can be awarded as a title of honor in their own right, e.g. the Fellowship of the Royal Society (FRS). Exclusive learned societies such as the Royal Society have Fellow as the only grade of membership. Appointment as an honorary fellow in a learned or professional society can be either to honour exceptional achievement or service within the professional domain of the awarding body or to honour contributions related to the domain from someone who is professionally outside it. Membership of the awarding body may or may not be a requirement. How a fellowship is awarded varies for each society, but may typically involve some or all of these:\n A qualifying period in a lower grade\n Passing a series of examinations\n Nomination by two existing fellows who know the applicant professionally\n Evidence of continued formal training post-qualification\n Evidence of substantial achievement in the subject area\n Submission of a thesis or portfolio of works which will be examined\n Election by a vote of the fellowship\n\nIn ancient universities\n\nAt the ancient universities of the University of Oxford, the University of Cambridge, and Trinity College, Dublin, members of the teaching staff typically have two affiliations: one as a reader, lecturer, or other academic rank within a department of the university, as at other universities, and a second affiliation as a fellow of one of the colleges of the university. The fellows, sometimes referred to as university dons, form the governing body of the college. They may elect a council to handle day-to-day management. All fellows are entitled to certain privileges within their colleges, which may include dining at High Table (free of charge) and possibly the right to a room in college (free of charge). At Cambridge, retired academics may remain fellows. At Oxford, however, a Governing Body fellow would normally be elected a fellow emeritus and would leave the Governing Body upon his or her retirement. Distinguished old members of the college, or its benefactors and friends, might also be elected 'Honorary Fellow', normally for life; but beyond limited dining rights this is merely an honour. Most Oxford colleges have 'Fellows by Special Election' or 'Supernumerary Fellows', who may be members of the teaching staff, but not necessarily members of the Governing Body. Some senior administrators of a college such as bursars are made fellows, and thereby become members of the governing body, because of their importance to the running of a college."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [5, 5]This is a sentence-transformers model finetuned from jinaai/jina-embeddings-v3 on the hard_negative_merged dataset. 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.
SentenceTransformer(
(transformer): Transformer(
(auto_model): XLMRobertaLoRA(
(roberta): XLMRobertaModel(
(embeddings): XLMRobertaEmbeddings(
(word_embeddings): ParametrizedEmbedding(
250002, 1024, padding_idx=1
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
(token_type_embeddings): ParametrizedEmbedding(
1, 1024
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
)
(emb_drop): Dropout(p=0.1, inplace=False)
(emb_ln): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
(encoder): XLMRobertaEncoder(
(layers): ModuleList(
(0-23): 24 x Block(
(mixer): MHA(
(rotary_emb): RotaryEmbedding()
(Wqkv): ParametrizedLinearResidual(
in_features=1024, out_features=3072, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
(inner_attn): FlashSelfAttention(
(drop): Dropout(p=0.1, inplace=False)
)
(inner_cross_attn): FlashCrossAttention(
(drop): Dropout(p=0.1, inplace=False)
)
(out_proj): ParametrizedLinear(
in_features=1024, out_features=1024, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
)
(dropout1): Dropout(p=0.1, inplace=False)
(drop_path1): StochasticDepth(p=0.0, mode=row)
(norm1): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
(mlp): Mlp(
(fc1): ParametrizedLinear(
in_features=1024, out_features=4096, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
(fc2): ParametrizedLinear(
in_features=4096, out_features=1024, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
)
(dropout2): Dropout(p=0.1, inplace=False)
(drop_path2): StochasticDepth(p=0.0, mode=row)
(norm2): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
)
)
)
(pooler): XLMRobertaPooler(
(dense): ParametrizedLinear(
in_features=1024, out_features=1024, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
(activation): Tanh()
)
)
)
)
(pooler): 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})
(normalizer): Normalize()
)
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("Jrinky/jina_final_temp")
# Run inference
sentences = [
'What is the description of the Myrmecoleon and what are its two interpretations',
'The stone lies at the bottom of the sea and comes to life early in the morning. When it rises from its resting-place to the surface of the sea, it opens its mouth and takes in some heavenly dew, and the rays of the sun shine around it; thus there grows within the stone a most precious, shining pearl indeed, conceived from the heavenly dew and given lustre by the rays of the sun." Interpretations\n\nThere are two interpretations of what a Myrmecoleon is. In one version, the antlion is so called because it is the "lion of ants", a large ant or small animal that hides in the dust and kills ants. In the other version, it is a beast that is the result of a mating between a lion and an ant. It has the face of a lion and the body of an ant, with each part having its appropriate nature. Because the lion part will only eat meat and the ant part can only digest grain, the ant-lion starves.',
'It is found in Medieval bestiaries such as the Hortus Sanitatis of Jacob Meydenbach. It is also referenced in some sources as a Formicaleon (Antlion), Formicaleun or Mirmicioleon.',
]
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]
anchor, positive, negative_1, negative_2, and negative_3| anchor | positive | negative_1 | negative_2 | negative_3 | |
|---|---|---|---|---|---|
| type | string | string | string | string | string |
| details |
|
|
|
|
|
| anchor | positive | negative_1 | negative_2 | negative_3 |
|---|---|---|---|---|
What does the plot of the story revolve around |
Respawn points are created when the player accumulates enough blood collected from slain enemies or in-level blood pickups, and idles a certain distance away from immediate level hazards. Plot |
An really interesting idea behind the story and one that had me unable to put it down some nights! View all my reviews |
And everything has such meaning and depth behind it. Nothing is just said casually, and it is all so thoughfully laced with emotion and words to draw you in to the story itself. |
It has a terribly implication that this flashback may be lasting more than a chapter. It's not as if we aren't learning anything of importance. I'm just not curious where this is going. I'm wondering when it'll finally be over. Not something you want from your audience as a story teller. In no simple terms. |
What type of warranty is offered with the Zhumell Signature 10x42 binoculars |
The Signature is also backed by Zhumell's full, 25-year, no-fault warranty, ensuring a lifetime of worry-free viewing. The Zhumell Signature 10x42 binoculars will give you plenty of power - whenever you need it, for as long as you need it! |
This item is backed by a Limited Lifetime Warranty. In the event this item should fail due to manufacturing defects during intended use, we will exchange the part free of charge (excludes shipping charges) for the original purchaser. |
if you have different ideas or better suggestion ,be free to leave message . Warranty and terms: |
We have more than 55 years of experience designing, manufacturing and refining custom optical lenses for use in a range of industries. Our production staff follows strict ISO 9001 standards and uses state-of-the-art metrology equipment to test finished lenses for quality and performance. |
When did he announce his retirement from all professional rugby |
He was named in the Pro12 Dream Teams at the end of the 2014/15 and 2016/17 seasons. In April 2021 he announced his retirement from all professional rugby. International career |
After retiring from full-time professional football, he worked as a production controller before becoming a sales administrator for International Computers Limited. He lived in Southampton for the rest of his life and died on 28 January 2014. |
On December 15 2018, it was announced that he had left WWE voluntarily. Professional boxing record |
class="wikitable" style="text-align:center;" |
cachedselfloss2.CachedInfonce with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
anchor, positive, negative_1, negative_2, and negative_3| anchor | positive | negative_1 | negative_2 | negative_3 | |
|---|---|---|---|---|---|
| type | string | string | string | string | string |
| details |
|
|
|
|
|
| anchor | positive | negative_1 | negative_2 | negative_3 |
|---|---|---|---|---|
What could the term 'Golia' refer to |
Golia may refer to: |
Gouka may refer to: |
Gottschelia is a genus of liverworts belonging to the family Cephaloziellaceae. |
Agila may refer to: |
What is the timeframe in which Itera plans to potentially make an agreement with a financial institution |
As Itera's President Igor Makarov reported at today's meeting of the Russian Gas Society in Moscow, the gas company could make an agreement with a financial institution, which would make the most profitable and optimum offer, in the next two to three months. According to him, they are currently holding negotiations with several financial enterprises, which specialize in introducing companies to the financial market. |
The process from receipt of the funding proposal to completion of due diligence is incredibly quick, with a goal of 30 days. After initial evaluation of their proposals, a selected number of start-ups, usually 6 to 8, are asked to make preliminary presentations to the steering committee. |
Coinexchange, Cryptopia, YoBit, HitBtc, Binance, Bittrex |
The project will be floated in the market for solicitation of expression of interest from the potential investors in June 2017. The land slots will be awarded to the successful bidders based on evaluation by the end of August, 2017. The Monitoring and Evaluation (M&E) of forest sites, awarded to successful bidders, will be done in collaboration with the Forestry, Wildlife & Fisheries Department, Government of the Punjab, as per the provisions of PPP Act, 2014, and The Punjab Forest (Amendment) Act, 2016. Revenue sharing will be done in this initiative. The Company in order to effectively reach out to the business community is organizing seminars in collaboration with various Chambers of Commerce & Industry to sensitize business groups to invest in the opportunity. |
What role does File History play in the issue being discussed |
What has File History got to do with the problem |
Newspapers feature stories about lost computers and memory sticks but a more common and longstanding problem is about staff accessing records that they have no right to see. It has always been possible for staff to look at paper records, and in most cases, there is no track of record. |
In data vault it is referred to as the record source. Background |
The idea of preservation, in the sense of both immortalization and protection is addressed. How do we decide what to remember from history, and what do we leave out |
cachedselfloss2.CachedInfonce with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 500per_device_eval_batch_size: 500learning_rate: 2e-05num_train_epochs: 10warmup_ratio: 0.1bf16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 500per_device_eval_batch_size: 500per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 10max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_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: Truedataloader_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}tp_size: 0fsdp_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: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsegradient_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: 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: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.1786 | 40 | 8.7768 | 8.5959 |
| 0.3571 | 80 | 8.8187 | 8.5129 |
| 0.5357 | 120 | 8.6175 | 8.2742 |
| 0.7143 | 160 | 8.0868 | 7.8954 |
| 0.8929 | 200 | 7.5681 | 7.3531 |
| 1.0714 | 240 | 7.0288 | 6.5431 |
| 1.25 | 280 | 6.2266 | 5.8462 |
| 1.4286 | 320 | 5.4682 | 5.2924 |
| 1.6071 | 360 | 5.0398 | 4.8148 |
| 1.7857 | 400 | 4.5158 | 4.4110 |
| 1.9643 | 440 | 4.184 | 4.0419 |
| 2.1429 | 480 | 3.7868 | 3.7165 |
| 2.3214 | 520 | 3.6258 | 3.4216 |
| 2.5 | 560 | 3.2262 | 3.1530 |
| 2.6786 | 600 | 3.0175 | 2.9128 |
| 2.8571 | 640 | 2.75 | 2.6999 |
| 3.0357 | 680 | 2.4915 | 2.5085 |
@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
jinaai/jina-embeddings-v3