electroglyph/technical
Viewer • Updated • 107k • 156 • 4
How to use aliRafik/bge_m3_finetuned_16bit with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("aliRafik/bge_m3_finetuned_16bit")
sentences = [
"ace-v",
"The floor plan was drafted at 1/4 inch scale where each quarter inch equals one foot.",
"Fingerprint examiners follow the ACE-V methodology for identification.",
"Most modern streaming services offer content in 1080p full HD quality."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This model was finetuned with Unsloth.
This is a sentence-transformers model finetuned from unsloth/bge-m3 on the technical dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
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({})
)
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 = [
'adult learning',
'The course was designed using adult learning best practices.',
'Solar developers calculate AEP, or annual energy production.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.7459, 0.1762],
# [0.7459, 1.0000, 0.2465],
# [0.1762, 0.2465, 1.0000]])
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| modality | text | text |
| details |
|
|
| anchor | positive |
|---|---|
.308 |
The .308 Winchester is a popular rifle cartridge used for hunting and target shooting. |
.308 |
Many precision rifles are chambered in .308 for its excellent long-range accuracy. |
.308 |
The sniper selected a .308 caliber round for the mission. |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"gather_across_devices": false,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
per_device_train_batch_size: 256learning_rate: 3e-05num_train_epochs: 5lr_scheduler_type: constant_with_warmupwarmup_ratio: 0.03bf16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 256per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 3e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 5max_steps: -1lr_scheduler_type: constant_with_warmuplr_scheduler_kwargs: Nonewarmup_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: 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: 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: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.1199 | 50 | 2.6276 |
| 0.2398 | 100 | 1.8416 |
| 0.3597 | 150 | 1.6568 |
| 0.4796 | 200 | 1.6146 |
| 0.5995 | 250 | 1.5547 |
| 0.7194 | 300 | 1.5393 |
| 0.8393 | 350 | 1.5067 |
| 0.9592 | 400 | 1.5013 |
| 1.0791 | 450 | 1.4107 |
| 1.1990 | 500 | 1.3787 |
| 1.3189 | 550 | 1.384 |
| 1.4388 | 600 | 1.3543 |
| 1.5588 | 650 | 1.3537 |
| 1.6787 | 700 | 1.335 |
| 1.7986 | 750 | 1.355 |
| 1.9185 | 800 | 1.331 |
| 2.0384 | 850 | 1.3144 |
| 2.1583 | 900 | 1.239 |
| 2.2782 | 950 | 1.2591 |
| 2.3981 | 1000 | 1.2408 |
| 2.5180 | 1050 | 1.2338 |
| 2.6379 | 1100 | 1.2168 |
| 2.7578 | 1150 | 1.2471 |
| 2.8777 | 1200 | 1.1998 |
| 2.9976 | 1250 | 1.1961 |
| 3.1175 | 1300 | 1.1119 |
| 3.2374 | 1350 | 1.1401 |
| 3.3573 | 1400 | 1.1171 |
| 3.4772 | 1450 | 1.1389 |
| 3.5971 | 1500 | 1.1033 |
| 3.7170 | 1550 | 1.1377 |
| 3.8369 | 1600 | 1.1284 |
| 3.9568 | 1650 | 1.0966 |
| 4.0767 | 1700 | 1.0581 |
| 4.1966 | 1750 | 1.0392 |
| 4.3165 | 1800 | 1.0258 |
| 4.4365 | 1850 | 1.0383 |
| 4.5564 | 1900 | 1.0418 |
| 4.6763 | 1950 | 1.0506 |
| 4.7962 | 2000 | 1.0285 |
| 4.9161 | 2050 | 1.0313 |
@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{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}
Base model
unsloth/bge-m3