Downloads · 30 days
23
5% of all-time downloads
CatkinChen/BAAI_bge-base-en-v1.5_retrieval_finetuned_2025-03-31_20-43-41
BAAI_bge-base-en-v1.5_retrieval_finetuned_2025-03-31_20-43-41 is a sentence similarity model from CatkinChen. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is a sentence-transformers model finetuned from BAAI/bge-base-en-v1.5. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, para…
Downloads · 30 days
23
5% of all-time downloads
All-time downloads
457
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This is a sentence-transformers model finetuned from BAAI/bge-base-en-v1.5. 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': True}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, '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()
)
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("CatkinChen/BAAI_bge-base-en-v1.5_retrieval_finetuned_2025-03-31_20-43-41")
# Run inference
sentences = [
'What is the name of the spell that creates a mark in the sky?',
'Book: 4, Chapter: 9\nPassage: They waited, listening to the sounds of the uneven steps behind the dark trees. But the footsteps came to a sudden halt. "Hello?" called Harry. There was silence. Harry got to his feet and peered around the tree. It was too dark to see very far, but he could sense somebody standing just beyond the range of his vision. "Who\'s there?" he said. And then, without warning, the silence was rent by a voice unlike any they had heard in the wood; and it uttered, not a panicked shout, but what sounded like a spell. "MORSMORDRE!" And something vast, green, and glittering erupted from the patch of darkness Harry\'s eyes had been struggling to penetrate; it flew up over the treetops and into the sky. "What the - ?" gasped Ron as he sprang to his feet again, staring up at the thing that had appeared.',
'Book: 4, Chapter: 9\nPassage: The Dark Mark\'s a wizard\'s sign. It requires a wand." "Yeah," said Mr. Diggory, "and she had a wand." "What?" said Mr. Weasley.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
<!--
### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>
-->
<!--
### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.1235 |
| cosine_accuracy@3 | 0.1852 |
| cosine_accuracy@5 | 0.2099 |
| cosine_accuracy@10 | 0.3086 |
| cosine_precision@1 | 0.1235 |
| cosine_precision@3 | 0.0658 |
| cosine_precision@5 | 0.0444 |
| cosine_precision@10 | 0.0321 |
| cosine_recall@1 | 0.1111 |
| cosine_recall@3 | 0.1564 |
| cosine_recall@5 | 0.1749 |
| cosine_recall@10 | 0.2613 |
| cosine_ndcg@10 | 0.1786 |
| cosine_mrr@10 | 0.1661 |
| cosine_map@100 | 0.1552 |
| sentence_0 | sentence_1 | sentence_2 | |
|---|---|---|---|
| type | string | string | string |
| details | <ul><li>min: 9 tokens</li><li>mean: 17.76 tokens</li><li>max: 51 tokens</li></ul> | <ul><li>min: 46 tokens</li><li>mean: 215.37 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 40 tokens</li><li>mean: 207.31 tokens</li><li>max: 512 tokens</li></ul> |
| sentence_0 | sentence_1 | sentence_2 |
|---|---|---|
| <code>What specific detail about a mirror in the first book, when paired with a family revelation in the fifth book, suggests a hidden bloodline connection?</code> | <code>Book: 1, Chapter: 12<br>Passage: He had seen his parents and would be seeing them again tonight. He had almost forgotten about Flamel. It didn't seem very important anymore. Who cared what the three-headed dog was guarding? What did it matter if Snape stole it, really? "Are you all right?" said Ron. "You look odd." What Harry feared most was that he might not be able to find the mirror room again. With Ron covered in the cloak, too, they had to walk much more slowly the next night. They tried retracing Harry's route from the library, wandering around the dark passageways for nearly an hour. "I'm freezing," said Ron.</code> | <code>Book: 2, Chapter: 17<br>Passage: I wondered, you see. There are strange likenesses between us, after all. Even you must have noticed. Both half-bloods, orphans, raised by Muggles. Probably the only two Parselmouths to come to Hogwarts since the great Slytherin himself. We even look something alike ... but after all, it was merely a lucky chance that saved you from me.</code> |
| <code>What is the name of the broomstick Harry receives in his third year?</code> | <code>Book: 3, Chapter: 11<br>Passage: As he moved all these things aside, he saw a long, thin package lying underneath. "What's that?" said Ron, looking over, a freshly unwrapped pair of maroon socks in his hand. "Dunno ..."<br>Harry ripped the parcel open and gasped as a magnificent, gleaming broomstick rolled out onto his bedspread. Ron dropped his socks and jumped off his bed for a closer look.</code> | <code>Book: 3, Chapter: 12<br>Passage: I reckon it's time you ordered a new broom, Harry. There's an order form at the back of Which Broomstick ... you could get a Nimbus Two Thousand and One, like Malfoy's got." "I'm not buying anything Malfoy thinks is good," said Harry flatly. January faded imperceptibly into February, with no change in the bitterly cold weather. The match against Ravenclaw was drawing nearer and nearer, but Harry still hadn't ordered a new broom. He was now asking Professor McGonagall for news of the Firebolt after every Transfiguration lesson, Ron standing hopefully at his shoulder, Hermione rushing past with her face averted. "No, Potter, you can't have it back yet," Professor McGonagall told him the twelfth time this happened, before he'd even opened his mouth. "We've checked for most of the usual curses, but Professor Flitwick believes the broom might be carrying a Hurling Hex.</code> |
| <code>What creature does Harry encounter in the Chamber of Secrets?</code> | <code>Book: 2, Chapter: 17<br>Passage: Harry backed away until he hit the dark Chamber wall, and as he shut his eyes tight he felt Fawkes' wing sweep his cheek as he took flight. Harry wanted to shout, "Don't leave me!" but what chance did a phoenix have against the king of serpents? Something huge hit the stone floor of the Chamber. Harry felt it shudder - he knew what was happening, he could sense it, could almost see the giant serpent uncoiling itself from Slytherin's mouth.</code> | <code>Book: 2, Chapter: 15<br>Passage: Ron fell onto his bed without bothering to get undressed. Harry, however, didn't feel very sleepy. He sat on the edge of his fourposter, thinking hard about everything Aragog had said. The creature that was lurking somewhere in the castle, he thought, sounded like a sort of monster Voldemort - even other monsters didn't want to name it. But he and Ron were no closer to finding out what it was, or how it Petrified its victims. Even Hagrid had never known what was in the Chamber of Secrets. Harry swung his legs up onto his bed and leaned back against his pillows, watching the moon glinting at him through the tower window. He couldn't see what else they could do. They had hit dead ends everywhere. Riddle had caught the wrong person, the Heir of Slytherin had got off, and no one could tell whether it was the same person, or a different one, who had opened the Chamber this time. There was nobody else to ask.</code> |
{
"distance_metric": "TripletDistanceMetric.COSINE",
"triplet_margin": 0.3
}
eval_strategy: stepsper_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 1multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_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: Falseuse_ipex: Falsebf16: Falsefp16: 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}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: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | cosine_ndcg@10 |
|---|---|---|
| 0.5 | 10 | 0.1678 |
| 1.0 | 20 | 0.1786 |
| -1 | -1 | 0.1786 |
@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{hermans2017defense,
title={In Defense of the Triplet Loss for Person Re-Identification},
author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
year={2017},
eprint={1703.07737},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->