CoolFace
Modelpublic

ybWw/bge-base-financial-matryoshka-dataset_v1_chinadatapay

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes80downloads
Model Card

SentenceTransformer

This is a sentence-transformers model trained on the json dataset. 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: Unknown -->
  • —Maximum Sequence Length: 512 tokens
  • —Output Dimensionality: 768 tokens
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —json <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

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()
)

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("ybWw/bge-base-financial-matryoshka-dataset_v1_chinadatapay")
# Run inference
sentences = [
    '它可以在手机解锁系统中使用,以确保只有真实的用户才能进入设备。活体检测可以应用于人脸支付领域,为用户提供更加安全和便捷的交易方式。在线视频会议和语音聊天等应用中,活体检测也可以验证用户身份,并防止冒充或欺诈行为的发生。另外,一些银行、金融机构以及政府机关等领域也利用活体检测技术来加强身份认证的可靠性和准确性。安卓活体检测在各个领域都具有广泛且重要的应用价值。',
    '活体检测有哪些应用场景?',
    '需要注意哪些因素在使用人像比对api时?',
]
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

Information Retrieval
MetricValue
cosine_accuracy@10.6844
cosine_accuracy@30.7608
cosine_accuracy@50.7807
cosine_accuracy@100.8339
cosine_precision@10.6844
cosine_precision@30.2536
cosine_precision@50.1561
cosine_precision@100.0834
cosine_recall@10.6844
cosine_recall@30.7608
cosine_recall@50.7807
cosine_recall@100.8339
cosine_ndcg@100.7553
cosine_mrr@100.7307
cosine_map@1000.7381
Information Retrieval
MetricValue
cosine_accuracy@10.6811
cosine_accuracy@30.7641
cosine_accuracy@50.7774
cosine_accuracy@100.8239
cosine_precision@10.6811
cosine_precision@30.2547
cosine_precision@50.1555
cosine_precision@100.0824
cosine_recall@10.6811
cosine_recall@30.7641
cosine_recall@50.7774
cosine_recall@100.8239
cosine_ndcg@100.75
cosine_mrr@100.7267
cosine_map@1000.7346
Information Retrieval
MetricValue
cosine_accuracy@10.6744
cosine_accuracy@30.7475
cosine_accuracy@50.7741
cosine_accuracy@100.8272
cosine_precision@10.6744
cosine_precision@30.2492
cosine_precision@50.1548
cosine_precision@100.0827
cosine_recall@10.6744
cosine_recall@30.7475
cosine_recall@50.7741
cosine_recall@100.8272
cosine_ndcg@100.7453
cosine_mrr@100.7199
cosine_map@1000.7271
Information Retrieval
MetricValue
cosine_accuracy@10.6645
cosine_accuracy@30.7542
cosine_accuracy@50.7674
cosine_accuracy@100.8173
cosine_precision@10.6645
cosine_precision@30.2514
cosine_precision@50.1535
cosine_precision@100.0817
cosine_recall@10.6645
cosine_recall@30.7542
cosine_recall@50.7674
cosine_recall@100.8173
cosine_ndcg@100.7395
cosine_mrr@100.7149
cosine_map@1000.7218
Information Retrieval
MetricValue
cosine_accuracy@10.6545
cosine_accuracy@30.7209
cosine_accuracy@50.7674
cosine_accuracy@100.7807
cosine_precision@10.6545
cosine_precision@30.2403
cosine_precision@50.1535
cosine_precision@100.0781
cosine_recall@10.6545
cosine_recall@30.7209
cosine_recall@50.7674
cosine_recall@100.7807
cosine_ndcg@100.7169
cosine_mrr@100.6962
cosine_map@1000.7047

<!--

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

json
  • —Dataset: json
  • —Size: 2,709 training samples
  • —Columns: <code>positive</code> and <code>anchor</code>
  • —Approximate statistics based on the first 1000 samples: | | positive | anchor | |:--------|:-------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 12 tokens</li><li>mean: 296.04 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 8 tokens</li><li>mean: 20.47 tokens</li><li>max: 43 tokens</li></ul> |
  • —Samples: | positive | anchor | |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------| | <code>在Android开发过程中,可以通过以下步骤集成和使用人脸识别活体检测API:<br>1、需要将相关的人脸识别活体检测库添加到项目的依赖中。这些库可以从第三方提供商或者开源社区获取。<br>2、在代码中引入相应的类和方法来进行人脸识别活体检测功能的调用。通常情况下,这些类和方法会提供一系列接口用于初始化、启动摄像头、捕捉图像,并返回检测结果。<br>3、在使用之前,请确保已经申请并获取了必要的权限,比如访问相机和存储设备等权限。<br>4、创建一个预览界面来展示实时视频流,并通过调用上述引入的类及其方法,在界面上显示摄像头捕捉到的图像内容。<br>5、调整设置参数以满足特定需求,例如设置最小可靠度阈值、配置活体检测算法类型等。这些参数将直接影响到人脸识别活体检测效果。<br>6、开始监听预览画面,并在每个新帧到达时进行处理。此时,可以调用相关方法对当前帧进行人脸识别与活体检测操作,并根据返回结果做出相应业务逻辑处理。<br>7、确保在使用完毕后正确释放资源,包括停止预览、释放摄像头等操作。<br>需要注意的是,在集成和使用人脸识别活体检测API时,可能会遇到一些性能和兼容性问题。为了提供更好的用户体验,请尽量优化算法、适配不同设备,并通过错误处理机制及时捕捉异常情况。同时,建议参考相关文档和示例代码以获取更详细的操作指南。</code> | <code>在Android开发过程中如何集成和使用人脸识别活体检测API?</code> | | <code>方便问一下你这边公司全称是什么吗?不方便透露全称(为什么要公司全称:我们这边是正规合法的企业,需要确定是真实的企业和真实的运用场景),如果您不方便的话留一个简称也可以的,我稍后让领导和你对接,给您发一下产品资料和报价。</code> | <code>数据库没有公司全称?</code> | | <code>要找到合适的车辆VIN核验接口供应商,你可以采取以下步骤:<br>1、市场研究:进行市场调查,了解目前有哪些车辆VIN核验接口供应商可供选择。通过搜索引擎、专业论坛和社交媒体等渠道收集相关信息。<br>2、产品质量:考虑供应商的产品质量是否符合标准。可以阅读其他用户的评价和反馈,在互联网上寻找产品质量方面的信息,并与不同供应商进行对比。<br>3、价格竞争力:价格是选择供应商时重要的考虑因素之一。比较不同供应商之间的价格差异,并注意是否提供优惠或折扣政策。<br>4、可靠性和信誉度:确保所选供应商具有良好的声誉和可靠性。可以参考客户评价、行业认证和持续合作关系等方面来判断其信誉度。<br>5、运营支持:询问潜在供应商有关售后服务、技术支持以及订单处理能力等方面的问题,以确保他们能够满足你未来可能需要的所有需求。<br>6、试用测试:向感兴趣的车辆VIN核验接口供应商提出需要接口进行测试,验证其适用性和质量。<br>您可以了解下数据宝公司。数据宝作为接口服务商,直连50+国家部委数据,接口直连国家数据库内数据,数据源覆盖全国所有车辆,实时核验,从源头保证数据合规性,非爬虫、缓存数据库,规避数据污染及合规风险。仅需输入车辆vin识别码,可输出品牌名称、发动机型号、整备质量、核定载客数、车辆型号代码等几十项相关车辆参数。还设有多个服务器防范防灾,确保接口服务稳定不间断。</code> | <code>如何找到合适的车辆vin核验接口供应商?</code> |
  • —Loss: <code>MatryoshkaLoss</code> with these parameters:
json
  {
      "loss": "MultipleNegativesRankingLoss",
      "matryoshka_dims": [
          768,
          512,
          256,
          128,
          64
      ],
      "matryoshka_weights": [
          1,
          1,
          1,
          1,
          1
      ],
      "n_dims_per_step": -1
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: epoch
  • —per_device_train_batch_size: 32
  • —per_device_eval_batch_size: 16
  • —gradient_accumulation_steps: 16
  • —learning_rate: 2e-05
  • —num_train_epochs: 4
  • —lr_scheduler_type: cosine
  • —warmup_ratio: 0.1
  • —bf16: True
  • —tf32: True
  • —load_best_model_at_end: True
  • —optim: adamwtorchfused
  • —batch_sampler: no_duplicates
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: epoch
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 32
  • —per_device_eval_batch_size: 16
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 16
  • —eval_accumulation_steps: None
  • —learning_rate: 2e-05
  • —weight_decay: 0.0
  • —adam_beta1: 0.9
  • —adam_beta2: 0.999
  • —adam_epsilon: 1e-08
  • —max_grad_norm: 1.0
  • —num_train_epochs: 4
  • —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
  • —restore_callback_states_from_checkpoint: False
  • —no_cuda: False
  • —use_cpu: False
  • —use_mps_device: False
  • —seed: 42
  • —data_seed: None
  • —jit_mode_eval: False
  • —use_ipex: False
  • —bf16: True
  • —fp16: False
  • —fp16_opt_level: O1
  • —half_precision_backend: auto
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: True
  • —local_rank: 0
  • —ddp_backend: None
  • —tpu_num_cores: None
  • —tpu_metrics_debug: False
  • —debug: []
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_prefetch_factor: None
  • —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, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamwtorchfused
  • —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
  • —eval_do_concat_batches: True
  • —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
  • —optim_target_modules: None
  • —batch_eval_metrics: False
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining Lossdim_768_cosine_map@100dim_512_cosine_map@100dim_256_cosine_map@100dim_128_cosine_map@100dim_64_cosine_map@100
0.94125-0.70610.69200.67530.66240.6096
1.8824102.52090.73330.72820.71950.71100.6927
2.823515-0.73800.73370.72320.72080.7010
3.7647201.02490.73810.73460.72710.72180.7047
  • —The bold row denotes the saved checkpoint.

Framework Versions

  • —Python: 3.8.20
  • —Sentence Transformers: 3.2.1
  • —Transformers: 4.41.2
  • —PyTorch: 2.1.2+cu121
  • —Accelerate: 1.0.1
  • —Datasets: 2.19.1
  • —Tokenizers: 0.19.1

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",
}
MatryoshkaLoss
bibtex
@misc{kusupati2024matryoshka,
    title={Matryoshka Representation Learning},
    author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
    year={2024},
    eprint={2205.13147},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}
MultipleNegativesRankingLoss
bibtex
@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

<!--

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