ONNX 模型库
返回模型

说明文档

SentenceTransformer

这是一个 sentence-transformers 模型。它将句子和段落映射到 384 维的稠密向量空间,可用于语义文本相似度、语义搜索、复述挖掘、文本分类、聚类等任务。

模型详情

模型描述

  • 模型类型: Sentence Transformer <!-- - 基础模型: Unknown -->
  • 最大序列长度: 128 个 token
  • 输出维度: 384 维
  • 相似度函数: 余弦相似度 <!-- - 训练数据集: Unknown --> <!-- - 语言: Unknown --> <!-- - 许可证: Unknown -->

模型来源

完整模型架构

SentenceTransformer(
  (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: 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})
)

使用方法

直接使用 (Sentence Transformers)

首先安装 Sentence Transformers 库:

pip install -U sentence-transformers

然后你可以加载此模型并运行推理。

from sentence_transformers import SentenceTransformer

# 从 🤗 Hub 下载
model = SentenceTransformer("sentence_transformers_model_id")
# 运行推理
sentences = [
    'gravel parking',
    'asfalterad uppfart',
    'rauhallinen naapurusto',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# 获取嵌入的相似度分数
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

<!--

直接使用 (Transformers)

<details><summary>点击查看 Transformers 中的直接用法</summary>

</details> -->

<!--

下游使用 (Sentence Transformers)

你可以在自己的数据集上微调此模型。

<details><summary>点击展开</summary>

</details> -->

<!--

超出范围的使用

列出模型可能被预见性滥用的方式,并说明用户不应该用模型做什么。 -->

评估

指标

语义相似度

指标
pearson_cosine 0.7845
spearman_cosine 0.8182

<!--

偏见、风险和局限性

这个模型有哪些已知或可预见的问题?你也可以在这里标记已知的失败案例或模型的弱点。 -->

<!--

建议

对于可预见的问题有什么建议?例如,过滤显式内容。 -->

训练详情

训练数据集

未命名数据集

  • 大小: 1,290,285 个训练样本
  • 列: <code>sentence_0</code>, <code>sentence_1</code>, 和 <code>label</code>
  • 基于前 1000 个样本的近似统计:
    sentence_0 sentence_1 label
    type string string float
    details <ul><li>min: 3 tokens</li><li>mean: 5.36 tokens</li><li>max: 12 tokens</li></ul> <ul><li>min: 3 tokens</li><li>mean: 5.47 tokens</li><li>max: 11 tokens</li></ul> <ul><li>min: 0.0</li><li>mean: 0.34</li><li>max: 0.9</li></ul>
  • 样本:
    sentence_0 sentence_1 label
    <code>kerrostalo</code> <code>puuaita</code> <code>0.1</code>
    <code>corner unit</code> <code>large yard</code> <code>0.3</code>
    <code>easy access to highway</code> <code>oma pysäköinti</code> <code>0.3</code>
  • 损失函数: <code>main.TemperatureScaledCosineSimilarityLoss</code> 参数如下:
    {
        \"loss_fct\": \"torch.nn.modules.loss.MSELoss\"
    }
    

训练超参数

非默认超参数

  • eval_strategy: steps
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • num_train_epochs: 5
  • multi_dataset_batch_sampler: round_robin

所有超参数

<details><summary>点击展开</summary>

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 5
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • 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: 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: 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: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • 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: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • 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
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

</details>

训练日志

<details><summary>点击展开</summary>

Epoch Step Training Loss trait-eval_spearman_cosine
0.0248 500 0.1261 -
0.0496 1000 0.1155 0.2026
0.0744 1500 0.119 -
0.0992 2000 0.1193 0.2516
0.1240 2500 0.118 -
0.1488 3000 0.1151 0.2638
0.1736 3500 0.1152 -
0.1984 4000 0.1093 0.2700
0.2232 4500 0.1077 -
0.2480 5000 0.109 0.2942
0.2728 5500 0.1015 -
0.2976 6000 0.1059 0.3171
0.3224 6500 0.1052 -
0.3472 7000 0.1042 0.3114
0.3720 7500 0.1006 -
0.3968 8000 0.1007 0.3328
0.4216 8500 0.1013 -
0.4464 9000 0.0938 0.3407
0.4712 9500 0.0971 -
0.4960 10000 0.0976 0.3430
0.5208 10500 0.0945 -
0.5456 11000 0.0937 0.3603
0.5704 11500 0.0919 -
0.5952 12000 0.0893 0.3916
0.6200 12500 0.0904 -
0.6448 13000 0.0866 0.3931
0.6696 13500 0.087 -
0.6944 14000 0.0848 0.4178
0.7192 14500 0.087 -
0.7440 15000 0.0827 0.4218
0.7688 15500 0.0851 -
0.7936 16000 0.0807 0.4414
0.8184 16500 0.0803 -
0.8432 17000 0.0803 0.4526
0.8680 17500 0.0784 -
0.8928 18000 0.0776 0.4592
0.9176 18500 0.0761 -
0.9424 19000 0.0739 0.4856
0.9672 19500 0.0724 -
0.9920 20000 0.0738 0.4928
1.0 20161 - 0.4863
1.0168 20500 0.0707 -
1.0416 21000 0.0699 0.4950
1.0664 21500 0.0637 -
1.0912 22000 0.0677 0.5000
1.1160 22500 0.0638 -
1.1408 23000 0.0653 0.5306
1.1656 23500 0.0661 -
1.1904 24000 0.0679 0.5292
1.2152 24500 0.0618 -
1.2400 25000 0.0616 0.5253
1.2648 25500 0.0626 -
1.2896 26000 0.0624 0.5422
1.3144 26500 0.0613 -
1.3392 27000 0.0623 0.5515
1.3640 27500 0.0601 -
1.3888 28000 0.0589 0.5606
1.4136 28500 0.06 -
1.4384 29000 0.0598 0.5774
1.4632 29500 0.0553 -
1.4880 30000 0.0596 0.5812
1.5128 30500 0.0547 -
1.5376 31000 0.0542 0.5956
1.5624 31500 0.0547 -
1.5872 32000 0.0545 0.6053
1.6120 32500 0.0525 -
1.6368 33000 0.0545 0.6137
1.6616 33500 0.0532 -
1.6864 34000 0.0525 0.6213
1.7112 34500 0.0529 -
1.7360 35000 0.0515 0.6152
1.7608 35500 0.0506 -
1.7856 36000 0.0502 0.6211
1.8104 36500 0.0513 -
1.8352 37000 0.0476 0.6344
1.8600 37500 0.0491 -
1.8848 38000 0.0485 0.6438
1.9096 38500 0.0488 -
1.9344 39000 0.0471 0.6591
1.9592 39500 0.049 -
1.9840 40000 0.0486 0.6692
2.0 40322 - 0.6619
2.0088 40500 0.044 -
2.0336 41000 0.0407 0.6729
2.0584 41500 0.0422 -
2.0832 42000 0.0427 0.6775
2.1080 42500 0.0425 -
2.1328 43000 0.043 0.6772
2.1576 43500 0.0426 -
2.1824 44000 0.04 0.6877
2.2072 44500 0.041 -
2.2320 45000 0.0422 0.6885
2.2568 45500 0.04 -
2.2816 46000 0.0399 0.6903
2.3064 46500 0.0414 -
2.3312 47000 0.0397 0.7008
2.3560 47500 0.0406 -
2.3808 48000 0.0395 0.7004
2.4056 48500 0.0375 -
2.4304 49000 0.0391 0.6964
2.4552 49500 0.0378 -
2.4800 50000 0.0379 0.7092
2.5048 50500 0.0394 -
2.5296 51000 0.0399 0.7122
2.5544 51500 0.0357 -
2.5792 52000 0.0362 0.7170
2.6040 52500 0.0383 -
2.6288 53000 0.0396 0.7218
2.6536 53500 0.037 -
2.6784 54000 0.0372 0.7312
2.7032 54500 0.0372 -
2.7280 55000 0.0365 0.7303
2.7528 55500 0.0364 -
2.7776 56000 0.0356 0.7366
2.8024 56500 0.034 -
2.8272 57000 0.036 0.7415
2.8520 57500 0.035 -
2.8768 58000 0.0355 0.7402
2.9016 58500 0.0331 -
2.9264 59000 0.0345 0.7475
2.9512 59500 0.0345 -
2.9760 60000 0.0348 0.7489
3.0 60483 - 0.7500
3.0008 60500 0.0351 -
3.0256 61000 0.0294 0.7537
3.0504 61500 0.0297 -
3.0752 62000 0.0301 0.7557
3.1000 62500 0.0311 -
3.1248 63000 0.0314 0.7628
3.1496 63500 0.0288 -
3.1744 64000 0.0311 0.7713
3.1992 64500 0.03 -
3.2240 65000 0.0307 0.7728
3.2488 65500 0.0321 -
3.2736 66000 0.028 0.7726
3.2984 66500 0.031 -
3.3232 67000 0.0283 0.7717
3.3480 67500 0.0302 -
3.3728 68000 0.0302 0.7808
3.3976 68500 0.0303 -
3.4224 69000 0.0285 0.7790
3.4472 69500 0.0304 -
3.4720 70000 0.0287 0.7856
3.4969 70500 0.0301 -
3.5217 71000 0.0285 0.7886
3.5465 71500 0.0295 -
3.5713 72000 0.0296 0.7899
3.5961 72500 0.0269 -
3.6209 73000 0.0278 0.7911
3.6457 73500 0.0299 -
3.6705 74000 0.0285 0.7898
3.6953 74500 0.0286 -
3.7201 75000 0.0281 0.7891
3.7449 75500 0.0308 -
3.7697 76000 0.0288 0.7893
3.7945 76500 0.0283 -
3.8193 77000 0.0264 0.7953
3.8441 77500 0.0265 -
3.8689 78000 0.0271 0.7942
3.8937 78500 0.0263 -
3.9185 79000 0.0278 0.7932
3.9433 79500 0.0258 -
3.9681 80000 0.028 0.7996
3.9929 80500 0.0284 -
4.0 80644 - 0.8017
4.0177 81000 0.0258 0.8022
4.0425 81500 0.027 -
4.0673 82000 0.0228 0.8034
4.0921 82500 0.0259 -
4.1169 83000 0.0257 0.8057
4.1417 83500 0.0248 -
4.1665 84000 0.025 0.8060
4.1913 84500 0.024 -
4.2161 85000 0.0267 0.8084
4.2409 85500 0.0244 -
4.2657 86000 0.0261 0.8058
4.2905 86500 0.0256 -
4.3153 87000 0.0252 0.8061
4.3401 87500 0.0246 -
4.3649 88000 0.0243 0.8095
4.3897 88500 0.0243 -
4.4145 89000 0.0251 0.8113
4.4393 89500 0.0247 -
4.4641 90000 0.0239 0.8109
4.4889 90500 0.0248 -
4.5137 91000 0.0235 0.8129
4.5385 91500 0.0246 -
4.5633 92000 0.0231 0.8132
4.5881 92500 0.0254 -
4.6129 93000 0.0249 0.8140
4.6377 93500 0.0229 -
4.6625 94000 0.025 0.8143
4.6873 94500 0.0244 -
4.7121 95000 0.0227 0.8158
4.7369 95500 0.0223 -
4.7617 96000 0.0232 0.8166
4.7865 96500 0.024 -
4.8113 97000 0.0243 0.8170
4.8361 97500 0.0229 -
4.8609 98000 0.0243 0.8172
4.8857 98500 0.0223 -
4.9105 99000 0.0252 0.8176
4.9353 99500 0.0242 -
4.9601 100000 0.0221 0.8182
4.9849 100500 0.022 -
5.0 100805 - 0.8182

</details>

框架版本

  • Python: 3.13.2
  • Sentence Transformers: 3.4.1
  • Transformers: 4.49.0
  • PyTorch: 2.7.0.dev20250221+cu128
  • Accelerate: 1.4.0
  • Datasets: 3.3.2
  • Tokenizers: 0.21.0

引用

BibTeX

Sentence Transformers

@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\",
}

<!--

术语表

明确定义术语以便让不同受众都能理解。 -->

<!--

模型卡作者

列出创建模型卡的人员,为模型卡构建中的详细工作提供认可和责任归属。 -->

<!--

模型卡联系方式

为有模型卡更新、建议或问题的人提供联系模型卡作者的方式。 -->

Aikoa/trait-embeddings-1

作者 Aikoa

sentence-similarity sentence-transformers
↓ 0 ♥ 1

创建时间: 2025-02-22 18:53:26+00:00

更新时间: 2025-03-06 13:04:02+00:00

在 Hugging Face 上查看

文件 (43)

.dockerignore
.gcloudignore
.gitattributes
.gitignore
.python-version
1_Pooling/config.json
Dockerfile
README.md
app.py
config.json
config_sentence_transformers.json
eval/similarity_evaluation_trait-eval_results.csv
m2v_onnx/README.md
m2v_onnx/config.json
m2v_onnx/model.safetensors
m2v_onnx/modules.json
m2v_onnx/onnx/model.onnx ONNX
m2v_onnx/special_tokens_map.json
m2v_onnx/tokenizer.json
m2v_onnx/tokenizer_config.json
m2v_onnx/vocab.txt
model.safetensors
modules.json
onnx/config.json
onnx/model.onnx ONNX
onnx/ort_config.json
onnx/special_tokens_map.json
onnx/tokenizer.json
onnx/tokenizer_config.json
onnx/unigram.json
requirements.txt
scripts/distill.py
scripts/export_to_onnx.py
scripts/quantize.py
sentence_bert_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json
unigram.json
vertex/deploy-vertex-model.sh
vertex/model_handler.py
vertex/package_torchserve.py
vertex/requirements-vertex.txt