SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'XLMRobertaModel'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'cls', 'include_prompt': True})
(2): Normalize({})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("TesNik369/bge-m3-tqa-merged-epoch-3")
5# Run inference
6queries = [
7 'A map in which all the lines of latitude and longitude are straight lines is a',
8]
9documents = [
10 'Most maps use a grid of lines to help you to find your location. This grid system is called a geographic coordinate system. Using this system you can define your location by two numbers, latitude and longitude. Both numbers are angles between your location, the center of Earth, and a reference line (Figure 2.20).',
11 'Topographic maps represent the locations of geographical features, such as hills and valleys. Topographic maps use contour lines to show different elevations. A contour line is a line of equal elevation. If you walk along a contour line you will not go uphill or downhill. Topographic maps are also called contour maps. The rules of topographic maps are: Each line connects all points of a specific elevation. Contour lines never cross since a single point can only have one elevation. Every fifth contour line is bolded and labeled. Adjacent contour lines are separated by a constant difference in elevation (such as 20 ft or 100 ft). The difference in elevation is the contour interval, which is indicated in the map legend. Scales indicate horizontal distance and are also found on the map legend. Old Faithful erupting, Yellowstone Na- tional Park. While the Figure 1.1 isnt exactly the same view as the map at the top of this concept, it is easy to see the main features. Hills, forests, development, and trees are all seen around Old Faithful.',
12 'In addition to sunlight, aquatic producers also need dissolved oxygen and nutrients. Water near the surface generally contains more dissolved oxygen than deeper water. Many nutrients enter the water from the land. Therefore, water nearer shore usually contains more dissolved nutrients than water farther from shore.',
13]
14query_embeddings = model.encode_query(queries)
15document_embeddings = model.encode_document(documents)
16print(query_embeddings.shape, document_embeddings.shape)
17# [1, 1024] [3, 1024]
18
19# Get the similarity scores for the embeddings
20similarities = model.similarity(query_embeddings, document_embeddings)
21print(similarities)
22# tensor([[0.5938, 0.6104, 0.2369]])tqa-devInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.4319 |
| cosine_accuracy@3 | 0.7621 |
| cosine_accuracy@5 | 0.8776 |
| cosine_accuracy@10 | 0.9515 |
| cosine_precision@1 | 0.4319 |
| cosine_precision@3 | 0.254 |
| cosine_precision@5 | 0.1755 |
| cosine_precision@10 | 0.0952 |
| cosine_recall@1 | 0.4319 |
| cosine_recall@3 | 0.7621 |
| cosine_recall@5 | 0.8776 |
| cosine_recall@10 | 0.9515 |
| cosine_ndcg@10 | 0.6987 |
| cosine_mrr@10 | 0.6165 |
| cosine_map@100 | 0.6189 |
anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| modality | text | text | text |
| details |
|
|
|
| anchor | positive | negative |
|---|---|---|
maximum distance the particles of a medium move from their resting position | The speed of most waves depends on the medium through which they are traveling. Generally, waves travel fastest through solids and slowest through gases. Thats because particles are closest together in solids and farthest apart in gases. When particles are farther apart, it takes longer for the energy of the disturbance to pass from particle to particle. | The speed of most waves depends on the medium, or the matter through which the waves are traveling. Generally, waves travel fastest through solids and slowest through gases. Thats because particles are closest together in solids and farthest apart in gases. When particles are farther apart, it takes longer for the energy of the disturbance to pass from particle to particle through the medium. Click image to the left or use the URL below. URL: |
One function of the cornea is to protect the eye. | The structure of the human eye is shown in Figure 22.24. Find each structure in the diagram as you read about it below. The cornea is the transparent outer covering of the eye. It protects the eye and also acts as a convex lens, helping to focus light that enters the eye. The pupil is an opening in the front of the eye. It looks black because it doesnt reflect any light. It allows light to enter the eye. The pupil automatically gets bigger or smaller to let more or less light in as needed. The iris is the colored part of the eye. It controls the size of the pupil. The lens is a convex lens that fine-tunes the focus so an image forms on the back of the eye. Tiny muscles control the shape of the lens to focus images of close or distant objects. The retina is a membrane lining the back of the eye. The retina has nerve cells called rods and cones that change images to electrical signals. Rods are good at sensing dim light but cant distinguish different colors of light. Cones can sense colo... | The function of the eye is to focus light and form images. We see some objects, such as stars and light bulbs, because they give off their own light. However, we see most objects because they reflect light from another source such as the sun. We form images of the objects when some of the reflected light enters our eyes. Look at the parts of the eye in Figure 20.12. Follow the path of light through the eye as you read about it below. 1. Light from an object passes first through the cornea. This is a clear, protective covering on the outside of the eye. 2. Then light passes through the pupil, an opening in the center of the eye. The pupil, which looks black, is surrounded by the colored part of the eye, called the iris. 3. Light entering through the pupil next passes through the lens. The lens is a clear, curved structure, like the lens of a magnifying glass. Along with the cornea, the lens focuses the light on the back of the eye. 4. The back of the eye is covered by a thin layer calle... |
part of the ear that transmits and amplifies vibrations from the eardrum | The outer ear includes the pinna, ear canal, and eardrum. The pinna is the only part of the ear that extends outward from the head. Its position and shape make it good at catching sound waves and funneling them into the ear canal. The ear canal is a tube that carries sound waves into the ear. The sound waves travel through the air inside the ear canal to the eardrum. The eardrum is like the head of a drum. Its a thin membrane stretched tight across the end of the ear canal. The eardrum vibrates when sound waves strike it, and it sends the vibrations on to the middle ear. | The outer ear includes the pinna, ear canal, and eardrum. The pinna is the only part of the ear that extends outward from the head. Its position and shape make it good at catching sound waves and funneling them into the ear canal. The ear canal is a tube that carries sound waves into the ear. The sound waves travel through the air inside the ear canal to the eardrum. The eardrum is like the head of a drum. It is a thin membrane stretched tight across the end of the ear canal. The eardrum vibrates when sound waves strike it, and it sends the vibrations on to the middle ear. Q: How might cupping his hands behind his ears help the boy pictured in the opening image hear better? A: His hands might help the pinna of his ears catch sound waves and direct them into the ear canal. |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}per_device_train_batch_size: 16per_device_eval_batch_size: 32gradient_accumulation_steps: 8learning_rate: 2e-05lr_scheduler_type: cosinewarmup_ratio: 0.05seed: 3407fp16: Truegradient_checkpointing: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 8eval_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: 3max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.05warmup_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: 3407data_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: Truegradient_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: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | tqa-dev_cosine_ndcg@10 |
|---|---|---|---|
| 0.0156 | 1 | 1.129 | - |
| 0.3113 | 20 | 1.0796 | - |
| 0.6226 | 40 | 1.047 | - |
| 0.9339 | 60 | 1.0395 | - |
| 1.0 | 65 | - | 0.7032 |
| 1.2335 | 80 | 1.0342 | - |
| 1.5447 | 100 | 0.9842 | - |
| 1.8560 | 120 | 0.972 | - |
| 2.0 | 130 | - | 0.7020 |
| 2.1556 | 140 | 0.9788 | - |
| 2.4669 | 160 | 0.9826 | - |
| 2.7782 | 180 | 0.9577 | - |
| 3.0 | 195 | - | 0.6987 |
| -1 | -1 | - | 0.6987 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}