CoolFace
Modelpublic

lv12/esci-nomic-embed-text-v1_5

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes51downloads
Model Card

SentenceTransformer based on nomic-ai/nomic-embed-text-v1.5

This is a sentence-transformers model finetuned from nomic-ai/nomic-embed-text-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.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: nomic-ai/nomic-embed-text-v1.5 <!-- at revision 91d2d6bfdddf0b0da840f901b533e99bae30d757 -->
  • Maximum Sequence Length: 8192 tokens
  • Output Dimensionality: 768 tokens
  • Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NomicBertModel 
  (1): Pooling({'word_embedding_dimension': 768, '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})
)

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 = [
    'search_query: お布団バッグ',
    'search_query: 足なしソファー',
    'search_query: all color handbag',
]
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. -->

Evaluation

Metrics

Triplet
MetricValue
cosine_accuracy0.787
dot_accuracy0.22
manhattan_accuracy0.762
euclidean_accuracy0.768
max_accuracy0.787

<!--

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: 100,000 training samples
  • Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
  • Approximate statistics based on the first 1000 samples: | | anchor | positive | negative | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 7 tokens</li><li>mean: 12.11 tokens</li><li>max: 47 tokens</li></ul> | <ul><li>min: 17 tokens</li><li>mean: 49.91 tokens</li><li>max: 166 tokens</li></ul> | <ul><li>min: 20 tokens</li><li>mean: 50.64 tokens</li><li>max: 152 tokens</li></ul> |
  • Samples: | anchor | positive | negative | |:------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------| | <code>searchquery: blー5c</code> | <code>searchdocument: [EnergyPower] TECSUN PL-368 電池2個セット SSB・同期検波・長波 [交換用バッテリーBL-5C付] デジタルDSPポケット短波ラジオ 超小型 長・中波用外付アンテナ 10キー ポータブルBCL受信機 FMステレオ/LW/MW/SW ワールドバンドレシーバー 850局プリセットメモリー シグナルメーター USB充電 スリープタイマー アラー, TECSUN, PL-368 電池+セット [ブラック]</code> | <code>searchdocument: RADIWOWで作る SIHUADON R108 ポータブル BCL短波ラジオAM FM LW SW 航空無線 DSPレシーバー LCD 良好屋内および屋外アクティビティの両親への贈り物, RADIWOW, グレー</code> | | <code>searchquery: かわいいロングtシャツ</code> | <code>searchdocument: レディース ロンt 半袖 tシャツ オーバーサイズ コットン スリット 大きいサイズ 白 シャツ ビッグシルエット ワンピース シャツワンピ ロングtシャツ おおきいサイズ 夏 ピンク カジュアル カップ付き カーディガン キラキラ キャミソール キャミ サテン シンプル シニア シフォン シースルー シ, Sleeping Sheep(スリーピング シープ), ホワイト</code> | <code>searchdocument: Perkisboby スポーツウェア レディース ヨガウェア 4点セット 上下セット 5点セットウェア フィットネス 2点セット ジャージ スポーツブラ パンツ パーカー 半袖 ハーフパンツ, Perkisboby, 2点セット-グレー</code> | | <code>searchquery: iphone xr otterbox symmetry case</code> | <code>searchdocument: Symmetry Clear Series Case for iPhone XR (ONLY) Symmetry Case for iPhone XR Symmetry Case - Clear, VTSOU, Clear</code> | <code>search_document: OtterBox Symmetry Series Case for Apple iPhone XS Max - Tonic Violet / Purple, OtterBox, Tonic Violet / Purple</code> |
  • Loss: <code>CachedMultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Evaluation Dataset

Unnamed Dataset
  • Size: 1,000 evaluation samples
  • Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
  • Approximate statistics based on the first 1000 samples: | | anchor | positive | negative | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 7 tokens</li><li>mean: 12.13 tokens</li><li>max: 49 tokens</li></ul> | <ul><li>min: 15 tokens</li><li>mean: 50.76 tokens</li><li>max: 173 tokens</li></ul> | <ul><li>min: 18 tokens</li><li>mean: 54.25 tokens</li><li>max: 161 tokens</li></ul> |
  • Samples: | anchor | positive | negative | |:---------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------| | <code>searchquery: snack vending machine</code> | <code>searchdocument: Red All Metal Triple Compartment Commercial Vending Machine for 1 inch Gumballs, 1 inch Toy Capsules, Bouncy Balls, Candy, Nuts with Stand by American Gumball Company, American Gumball Company, CANDY RED</code> | <code>searchdocument: Vending Machine Halloween Costume - Funny Snack Food Adult Men & Women Outfits, Hauntlook, Multicolored</code> | | <code>searchquery: slim credit card holder without id window</code> | <code>searchdocument: Banuce Top Grain Leather Card Holder for Women Men Unisex ID Credit Card Case Slim Card Wallet Black, Banuce, 1 ID + 5 Card Slots: Black</code> | <code>searchdocument: Mens Wallet RFID Genuine Leather Bifold Wallets For Men, ID Window 16 Card Holders Gift Box, Swallowmall, Black Stripe</code> | | <code>searchquery: gucci belts for women</code> | <code>searchdocument: Gucci Women's Gg0027o 50Mm Optical Glasses, Gucci, Havana</code> | <code>search_document: Gucci G-Gucci Gold PVD Women's Watch(Model:YA125511), Gucci, PVD/Brown</code> |
  • Loss: <code>CachedMultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • per_device_train_batch_size: 4
  • per_device_eval_batch_size: 4
  • gradient_accumulation_steps: 2
  • learning_rate: 1e-06
  • lr_scheduler_type: cosine
  • warmup_ratio: 0.1
  • dataloader_drop_last: True
  • dataloader_num_workers: 4
  • dataloader_prefetch_factor: 2
  • load_best_model_at_end: True
  • batch_sampler: no_duplicates
All Hyperparameters

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

  • overwrite_output_dir: False
  • do_predict: False
  • prediction_loss_only: True
  • per_device_train_batch_size: 4
  • per_device_eval_batch_size: 4
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 2
  • eval_accumulation_steps: None
  • learning_rate: 1e-06
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 3
  • max_steps: -1
  • lr_scheduler_type: cosine
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: True
  • dataloader_num_workers: 4
  • dataloader_prefetch_factor: 2
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedable_sampler': True}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: False
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional

</details>

Training Logs

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

EpochStepTraining Losslosstriplet-esci_cosine_accuracy
0.0081000.7191--
0.0162000.6917--
0.0243000.7129--
0.0324000.6826--
0.045000.7317--
0.0486000.7237--
0.0567000.6904--
0.0648000.6815--
0.0729000.6428--
0.0810000.65610.67410.74
0.08811000.6097--
0.09612000.6426--
0.10413000.618--
0.11214000.6346--
0.1215000.611--
0.12816000.6092--
0.13617000.6512--
0.14418000.646--
0.15219000.6584--
0.1620000.64030.64110.747
0.16821000.5882--
0.17622000.6361--
0.18423000.5641--
0.19224000.5734--
0.225000.6156--
0.20826000.6252--
0.21627000.634--
0.22428000.5743--
0.23229000.5222--
0.2430000.56040.61800.765
0.24831000.5864--
0.25632000.5541--
0.26433000.5661--
0.27234000.5493--
0.2835000.556--
0.28836000.56--
0.29637000.5552--
0.30438000.5833--
0.31239000.5578--
0.3240000.54950.60090.769
0.32841000.5245--
0.33642000.477--
0.34443000.5536--
0.35244000.5493--
0.3645000.532--
0.36846000.5341--
0.37647000.528--
0.38448000.5574--
0.39249000.4953--
0.450000.53650.59690.779
0.40851000.4835--
0.41652000.4573--
0.42453000.5554--
0.43254000.5623--
0.4455000.5955--
0.44856000.5086--
0.45657000.5081--
0.46458000.4829--
0.47259000.5066--
0.4860000.49970.59200.776
0.48861000.5075--
0.49662000.5051--
0.50463000.5019--
0.51264000.4774--
0.5265000.4975--
0.52866000.4756--
0.53667000.4656--
0.54468000.4671--
0.55269000.4646--
0.5670000.55950.58530.777
0.56871000.4812--
0.57672000.506--
0.58473000.49--
0.59274000.464--
0.675000.441--
0.60876000.4492--
0.61677000.457--
0.62478000.493--
0.63279000.4174--
0.6480000.46860.58090.785
0.64881000.4529--
0.65682000.4784--
0.66483000.4697--
0.67284000.4489--
0.6885000.4439--
0.68886000.4063--
0.69687000.4634--
0.70488000.4446--
0.71289000.4725--
0.7290000.39540.57690.781
0.72891000.4536--
0.73692000.4583--
0.74493000.4415--
0.75294000.4716--
0.7695000.4393--
0.76896000.4332--
0.77697000.4236--
0.78498000.4021--
0.79299000.4324--
0.8100000.41970.57960.78
0.808101000.4576--
0.816102000.4238--
0.824103000.4468--
0.832104000.4301--
0.84105000.414--
0.848106000.4563--
0.856107000.4212--
0.864108000.3905--
0.872109000.4384--
0.88110000.34740.57090.788
0.888111000.4396--
0.896112000.3819--
0.904113000.3748--
0.912114000.4217--
0.92115000.3893--
0.928116000.3835--
0.936117000.4303--
0.944118000.4274--
0.952119000.4089--
0.96120000.40090.57100.786
0.968121000.3832--
0.976122000.3543--
0.984123000.4866--
0.992124000.4531--
1.0125000.3728--
1.008126000.386--
1.016127000.3622--
1.024128000.4013--
1.032129000.3543--
1.04130000.39180.57120.792
1.048131000.3961--
1.056132000.3804--
1.064133000.4049--
1.072134000.3374--
1.08135000.3746--
1.088136000.3162--
1.096137000.3536--
1.104138000.3101--
1.112139000.3704--
1.12140000.34120.57580.788
1.1280141000.342--
1.1360142000.383--
1.144143000.3554--
1.152144000.4013--
1.16145000.3486--
1.168146000.3367--
1.176147000.3737--
1.184148000.319--
1.192149000.3211--
1.2150000.32840.58040.787

</details>

Framework Versions

  • Python: 3.10.12
  • Sentence Transformers: 3.0.0
  • Transformers: 4.38.2
  • PyTorch: 2.1.2+cu121
  • Accelerate: 0.27.2
  • Datasets: 2.19.1
  • Tokenizers: 0.15.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",
}
CachedMultipleNegativesRankingLoss
bibtex
@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}
}

<!--

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