CoolFace
Modelpublic

dtunkelang/bag-of-documents-minilm

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes83downloads
Model Card
The primary bag-of-documents query encoder: all-MiniLM-L6-v2 fine-tuned on bag-derived training signals from the Amazon ESCI catalog. Part of the bag-of-documents retrieval research; see the live demo.

SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2

This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

Model Description

  • —Model Type: Sentence Transformer
  • —Base model: sentence-transformers/all-MiniLM-L6-v2 <!-- at revision c9745ed1d9f207416be6d2e6f8de32d1f16199bf -->
  • —Maximum Sequence Length: 256 tokens
  • —Output Dimensionality: 384 dimensions
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'BertModel'})
  (1): Pooling({'word_embedding_dimension': 384, '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})
  (2): Normalize()
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
    'sebman',
    'night without stars',
    'kids swany gloves',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.3675, 0.1972],
#         [0.3675, 1.0000, 0.1981],
#         [0.1972, 0.1981, 1.0000]])

<!--

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. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

Unnamed Dataset
  • —Size: 59,282 training samples
  • —Columns: <code>sentence_0</code> and <code>label</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence_0 | label | |:--------|:---------------------------------------------------------------------------------|:-------------------------------------| | type | string | list | | details | <ul><li>min: 3 tokens</li><li>mean: 6.55 tokens</li><li>max: 31 tokens</li></ul> | <ul><li>size: 384 elements</li></ul> |
  • —Samples: | sentence_0 | label | |:----------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------| | <code>amazon smart plug</code> | <code>[-0.015805143862962723, -0.05832391977310181, 0.07093773037195206, 0.009944137185811996, 0.04236411303281784, ...]</code> | | <code>parchment paper</code> | <code>[-0.10958580672740936, 0.0555688738822937, -0.02000853419303894, 0.047862447798252106, -0.02194875292479992, ...]</code> | | <code>midnight club 3 dub edition remix xbox</code> | <code>[-0.13832898437976837, -0.035773828625679016, -0.008071236312389374, -0.06458242237567902, 0.015509296208620071, ...]</code> |
  • —Loss: <code>_main_.MSEEmbeddingLoss</code>

Training Hyperparameters

Non-Default Hyperparameters
  • —per_device_train_batch_size: 32
  • —num_train_epochs: 15
  • —eval_strategy: steps
  • —per_device_eval_batch_size: 32
  • —multi_dataset_batch_sampler: round_robin
All Hyperparameters

<details><summary>Click to expand</summary>

  • —per_device_train_batch_size: 32
  • —num_train_epochs: 15
  • —max_steps: -1
  • —learning_rate: 5e-05
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: None
  • —warmup_steps: 0
  • —optim: adamwtorchfused
  • —optim_args: None
  • —weight_decay: 0.0
  • —adam_beta1: 0.9
  • —adam_beta2: 0.999
  • —adam_epsilon: 1e-08
  • —optim_target_modules: None
  • —gradient_accumulation_steps: 1
  • —average_tokens_across_devices: True
  • —max_grad_norm: 1
  • —label_smoothing_factor: 0.0
  • —bf16: False
  • —fp16: False
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: None
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —torch_compile: False
  • —torch_compile_backend: None
  • —torch_compile_mode: None
  • —use_liger_kernel: False
  • —liger_kernel_config: None
  • —use_cache: False
  • —neftune_noise_alpha: None
  • —torch_empty_cache_steps: None
  • —auto_find_batch_size: False
  • —log_on_each_node: True
  • —logging_nan_inf_filter: True
  • —include_num_input_tokens_seen: no
  • —log_level: passive
  • —log_level_replica: warning
  • —disable_tqdm: False
  • —project: huggingface
  • —trackio_space_id: trackio
  • —eval_strategy: steps
  • —per_device_eval_batch_size: 32
  • —prediction_loss_only: True
  • —eval_on_start: False
  • —eval_do_concat_batches: True
  • —eval_use_gather_object: False
  • —eval_accumulation_steps: None
  • —include_for_metrics: []
  • —batch_eval_metrics: False
  • —save_only_model: False
  • —save_on_each_node: False
  • —enable_jit_checkpoint: False
  • —push_to_hub: False
  • —hub_private_repo: None
  • —hub_model_id: None
  • —hub_strategy: every_save
  • —hub_always_push: False
  • —hub_revision: None
  • —load_best_model_at_end: False
  • —ignore_data_skip: False
  • —restore_callback_states_from_checkpoint: False
  • —full_determinism: False
  • —seed: 42
  • —data_seed: None
  • —use_cpu: False
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —parallelism_config: None
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_pin_memory: True
  • —dataloader_persistent_workers: False
  • —dataloader_prefetch_factor: None
  • —remove_unused_columns: True
  • —label_names: None
  • —train_sampling_strategy: random
  • —length_column_name: length
  • —ddp_find_unused_parameters: None
  • —ddp_bucket_cap_mb: None
  • —ddp_broadcast_buffers: False
  • —ddp_backend: None
  • —ddp_timeout: 1800
  • —fsdp: []
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —deepspeed: None
  • —debug: []
  • —skip_memory_metrics: True
  • —do_predict: False
  • —resume_from_checkpoint: None
  • —warmup_ratio: None
  • —local_rank: -1
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: round_robin
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining Loss
0.26985000.1951
0.539710000.1530
0.809515000.1422
1.01853-
1.079320000.1349
1.349225000.1302
1.619030000.1266
1.888835000.1247
2.03706-
2.158740000.1200
2.428545000.1162
2.698350000.1159
2.968255000.1149
3.05559-
3.238060000.1106
3.507865000.1091
3.777770000.1088
4.07412-
4.047575000.1079
4.317380000.1047
4.587285000.1041
4.857090000.1047
5.09265-
5.126895000.1028
5.3967100000.1016
5.6665105000.1005
5.9363110000.1003
6.011118-
6.2062115000.0983
6.4760120000.0979
6.7458125000.0986
7.012971-
7.0157130000.0979
7.2855135000.0951
7.5553140000.0959
7.8251145000.0951
8.014824-
8.0950150000.0950
8.3648155000.0937
8.6346160000.0940
8.9045165000.0934
9.016677-
9.1743170000.0925
9.4441175000.0920
9.7140180000.0925
9.9838185000.0920
10.018530-
10.2536190000.0904
10.5235195000.0904
10.7933200000.0909
11.020383-
11.0631205000.0908
11.3330210000.0894
11.6028215000.0902
11.8726220000.0897
12.022236-
12.1425225000.0891
12.4123230000.0885
12.6821235000.0891
12.9520240000.0888
13.024089-
13.2218245000.0878
13.4916250000.0886
13.7615255000.0879
14.025942-
14.0313260000.0882
14.3011265000.0881
14.5710270000.0876
14.8408275000.0875
15.027795-

Framework Versions

  • —Python: 3.14.3
  • —Sentence Transformers: 5.3.0
  • —Transformers: 5.4.0
  • —PyTorch: 2.11.0
  • —Accelerate: 1.13.0
  • —Datasets: 4.8.4
  • —Tokenizers: 0.22.2

Citation

BibTeX

Sentence Transformers
bibtex
@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",
}

<!--

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. -->