初始化项目,由ModelHub XC社区提供模型

Model: aiknowyou/all-mpnet-base-questions-clustering-en
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-07-30 06:29:19 +08:00
commit a10c17b63f
14 changed files with 61448 additions and 0 deletions

33
.gitattributes vendored Normal file
View File

@@ -0,0 +1,33 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
pytorch_model.bin filter=lfs diff=lfs merge=lfs -text

7
1_Pooling/config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"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
}

151
README.md Normal file
View File

@@ -0,0 +1,151 @@
---
pipeline_tag: sentence-similarity
tags:
- sentence-transformers
- feature-extraction
- sentence-similarity
language: en
datasets:
- quora
- embedding-data/WikiAnswers
- flax-sentence-embeddings/stackexchange_xml
license: cc-by-nc-sa-4.0
---
# All-mpnet-base-v2 model fine-tuned for questions clustering
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
This model is named **all-mpnet-base-questions-clustering-en** since it is a Sentence Transformers model specifically fine-tuned for a questions clustering task. Three public dataset (Quora, WikiAnswer and StackExchange) has been used to enhance the model performance specifically in mapping questions with similar meanings.
## Usage (Sentence-Transformers)
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
```
pip install -U sentence-transformers
```
Then you can use the model like this:
```python
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]
model = SentenceTransformer('aiknowyou/all-mpnet-base-questions-clustering-en')
embeddings = model.encode(sentences)
print(embeddings)
```
## Evaluation Results
The present model has been evaluated by employing a test set belonging to the WikiAnswer dataset. The evaluation results are the following:
[
{
"epoch": 1,
"cossim_accuracy": 0.9931843415744172,
"cossim_accuracy_threshold": 0.35143423080444336,
"cossim_f1": 0.9897547191636324,
"cossim_precision": 0.9913437348280885,
"cossim_recall": 0.9881707893839572,
"cossim_f1_threshold": 0.35143423080444336,
"cossim_ap": 0.9989950013637923,
"manhattan_accuracy": 0.9934042015236294,
"manhattan_accuracy_threshold": 24.160316467285156,
"manhattan_f1": 0.9900818249442103,
"manhattan_precision": 0.9920113508380628,
"manhattan_recall": 0.9881597905828264,
"manhattan_f1_threshold": 24.160316467285156,
"manhattan_ap": 0.9990576126715013,
"euclidean_accuracy": 0.9931843415744172,
"euclidean_accuracy_threshold": 1.1389167308807373,
"euclidean_f1": 0.9897547191636324,
"euclidean_precision": 0.9913437348280885,
"euclidean_recall": 0.9881707893839572,
"euclidean_f1_threshold": 1.1389167308807373,
"euclidean_ap": 0.9989921332302106,
"dot_accuracy": 0.9931843415744172,
"dot_accuracy_threshold": 0.35143429040908813,
"dot_f1": 0.9897547191636324,
"dot_precision": 0.9913437348280885,
"dot_recall": 0.9881707893839572,
"dot_f1_threshold": 0.35143429040908813,
"dot_ap": 0.9989933009226604
}
]
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
## Training
The model was trained with the parameters:
**DataLoader**:
`torch.utils.data.dataloader.DataLoader` of length 34123 with parameters:
```
{'batch_size': 32, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
```
**Loss**:
`sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss` with parameters:
```
{'scale': 20.0, 'similarity_fct': 'cos_sim'}
```
**DataLoader**:
`torch.utils.data.dataloader.DataLoader` of length 51184 with parameters:
```
{'batch_size': 32, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
```
**Loss**:
`sentence_transformers.losses.OnlineContrastiveLoss.OnlineContrastiveLoss`
Parameters of the fit()-Method:
```
{
"epochs": 2,
"evaluation_steps": 0,
"evaluator": "sentence_transformers.evaluation.SequentialEvaluator.SequentialEvaluator",
"max_grad_norm": 1,
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
"optimizer_params": {
"lr": 2e-05
},
"scheduler": "WarmupLinear",
"steps_per_epoch": null,
"warmup_steps": 1000,
"weight_decay": 0.01
}
```
## Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 384, 'do_lower_case': False}) with Transformer model: MPNetModel
(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})
(2): Normalize()
)
```
## Contribution
Thanks to [@tradicio](https://huggingface.co/tradicio) for adding this model.
## License
This work is licensed under a
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].
[![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]
[cc-by-nc-sa]: http://creativecommons.org/licenses/by-nc-sa/4.0/
[cc-by-nc-sa-image]: https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png

View File

@@ -0,0 +1,2 @@
epoch,steps,cossim_accuracy,cossim_accuracy_threshold,cossim_f1,cossim_precision,cossim_recall,cossim_f1_threshold,cossim_ap,manhattan_accuracy,manhattan_accuracy_threshold,manhattan_f1,manhattan_precision,manhattan_recall,manhattan_f1_threshold,manhattan_ap,euclidean_accuracy,euclidean_accuracy_threshold,euclidean_f1,euclidean_precision,euclidean_recall,euclidean_f1_threshold,euclidean_ap,dot_accuracy,dot_accuracy_threshold,dot_f1,dot_precision,dot_recall,dot_f1_threshold,dot_ap
0,0,0.9893422889619312,0.3684113025665283,0.9839550952295576,0.9870342598792521,0.9808950824360144,0.3684113025665283,0.9981098929310646,0.9887431706003276,24.35479736328125,0.9830630888912166,0.9855571523325226,0.9805816166037902,24.358116149902344,0.9979432632969408,0.9893422889619312,1.123911738395691,0.9839550952295576,0.9870342598792521,0.9808950824360144,1.123911738395691,0.9981070245867787,0.9893422889619312,0.36841127276420593,0.9839550952295576,0.9870342598792521,0.9808950824360144,0.36841127276420593,0.9981101239841529
1 epoch steps cossim_accuracy cossim_accuracy_threshold cossim_f1 cossim_precision cossim_recall cossim_f1_threshold cossim_ap manhattan_accuracy manhattan_accuracy_threshold manhattan_f1 manhattan_precision manhattan_recall manhattan_f1_threshold manhattan_ap euclidean_accuracy euclidean_accuracy_threshold euclidean_f1 euclidean_precision euclidean_recall euclidean_f1_threshold euclidean_ap dot_accuracy dot_accuracy_threshold dot_f1 dot_precision dot_recall dot_f1_threshold dot_ap
2 0 0 0.9893422889619312 0.3684113025665283 0.9839550952295576 0.9870342598792521 0.9808950824360144 0.3684113025665283 0.9981098929310646 0.9887431706003276 24.35479736328125 0.9830630888912166 0.9855571523325226 0.9805816166037902 24.358116149902344 0.9979432632969408 0.9893422889619312 1.123911738395691 0.9839550952295576 0.9870342598792521 0.9808950824360144 1.123911738395691 0.9981070245867787 0.9893422889619312 0.36841127276420593 0.9839550952295576 0.9870342598792521 0.9808950824360144 0.36841127276420593 0.9981101239841529

24
config.json Normal file
View File

@@ -0,0 +1,24 @@
{
"_name_or_path": "/home/utente/.cache/torch/sentence_transformers/sentence-transformers_all-mpnet-base-v2/",
"architectures": [
"MPNetModel"
],
"attention_probs_dropout_prob": 0.1,
"bos_token_id": 0,
"eos_token_id": 2,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"layer_norm_eps": 1e-05,
"max_position_embeddings": 514,
"model_type": "mpnet",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pad_token_id": 1,
"relative_attention_num_buckets": 32,
"torch_dtype": "float32",
"transformers_version": "4.22.0.dev0",
"vocab_size": 30527
}

View File

@@ -0,0 +1,7 @@
{
"__version__": {
"sentence_transformers": "2.0.0",
"transformers": "4.6.1",
"pytorch": "1.8.1"
}
}

View File

@@ -0,0 +1,3 @@
epoch,steps,cossim_accuracy,cossim_accuracy_threshold,cossim_f1,cossim_precision,cossim_recall,cossim_f1_threshold,cossim_ap,manhattan_accuracy,manhattan_accuracy_threshold,manhattan_f1,manhattan_precision,manhattan_recall,manhattan_f1_threshold,manhattan_ap,euclidean_accuracy,euclidean_accuracy_threshold,euclidean_f1,euclidean_precision,euclidean_recall,euclidean_f1_threshold,euclidean_ap,dot_accuracy,dot_accuracy_threshold,dot_f1,dot_precision,dot_recall,dot_f1_threshold,dot_ap
0,-1,0.9906596164909619,0.3930458724498749,0.9859670564400695,0.9870212179663819,0.9849151442492768,0.3930458724498749,0.9984901891426392,0.991234916691401,23.361751556396484,0.9868355558244485,0.9869576936405692,0.9867134482341425,23.616687774658203,0.9986105475645636,0.9906596164909619,1.1017749309539795,0.9859670564400695,0.9870212179663819,0.9849151442492768,1.1017749309539795,0.9984873210075305,0.9906596164909619,0.39304593205451965,0.9859670564400695,0.9870212179663819,0.9849151442492768,0.39304593205451965,0.9984897548380124
1,-1,0.9931843415744172,0.35143423080444336,0.9897547191636324,0.9913437348280885,0.9881707893839572,0.35143423080444336,0.9989950013637923,0.9934042015236294,24.160316467285156,0.9900818249442103,0.9920113508380628,0.9881597905828264,24.160316467285156,0.9990576126715013,0.9931843415744172,1.1389167308807373,0.9897547191636324,0.9913437348280885,0.9881707893839572,1.1389167308807373,0.9989921332302106,0.9931843415744172,0.35143429040908813,0.9897547191636324,0.9913437348280885,0.9881707893839572,0.35143429040908813,0.9989933009226604
1 epoch steps cossim_accuracy cossim_accuracy_threshold cossim_f1 cossim_precision cossim_recall cossim_f1_threshold cossim_ap manhattan_accuracy manhattan_accuracy_threshold manhattan_f1 manhattan_precision manhattan_recall manhattan_f1_threshold manhattan_ap euclidean_accuracy euclidean_accuracy_threshold euclidean_f1 euclidean_precision euclidean_recall euclidean_f1_threshold euclidean_ap dot_accuracy dot_accuracy_threshold dot_f1 dot_precision dot_recall dot_f1_threshold dot_ap
2 0 -1 0.9906596164909619 0.3930458724498749 0.9859670564400695 0.9870212179663819 0.9849151442492768 0.3930458724498749 0.9984901891426392 0.991234916691401 23.361751556396484 0.9868355558244485 0.9869576936405692 0.9867134482341425 23.616687774658203 0.9986105475645636 0.9906596164909619 1.1017749309539795 0.9859670564400695 0.9870212179663819 0.9849151442492768 1.1017749309539795 0.9984873210075305 0.9906596164909619 0.39304593205451965 0.9859670564400695 0.9870212179663819 0.9849151442492768 0.39304593205451965 0.9984897548380124
3 1 -1 0.9931843415744172 0.35143423080444336 0.9897547191636324 0.9913437348280885 0.9881707893839572 0.35143423080444336 0.9989950013637923 0.9934042015236294 24.160316467285156 0.9900818249442103 0.9920113508380628 0.9881597905828264 24.160316467285156 0.9990576126715013 0.9931843415744172 1.1389167308807373 0.9897547191636324 0.9913437348280885 0.9881707893839572 1.1389167308807373 0.9989921332302106 0.9931843415744172 0.35143429040908813 0.9897547191636324 0.9913437348280885 0.9881707893839572 0.35143429040908813 0.9989933009226604

20
modules.json Normal file
View File

@@ -0,0 +1,20 @@
[
{
"idx": 0,
"name": "0",
"path": "",
"type": "sentence_transformers.models.Transformer"
},
{
"idx": 1,
"name": "1",
"path": "1_Pooling",
"type": "sentence_transformers.models.Pooling"
},
{
"idx": 2,
"name": "2",
"path": "2_Normalize",
"type": "sentence_transformers.models.Normalize"
}
]

3
pytorch_model.bin Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9b0627657a0954b301f54383025898a0de1dc0c76d37a852cb2195167f66926c
size 438014769

View File

@@ -0,0 +1,4 @@
{
"max_seq_length": 384,
"do_lower_case": false
}

15
special_tokens_map.json Normal file
View File

@@ -0,0 +1,15 @@
{
"bos_token": "<s>",
"cls_token": "<s>",
"eos_token": "</s>",
"mask_token": {
"content": "<mask>",
"lstrip": true,
"normalized": false,
"rstrip": false,
"single_word": false
},
"pad_token": "<pad>",
"sep_token": "</s>",
"unk_token": "[UNK]"
}

30636
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

16
tokenizer_config.json Normal file
View File

@@ -0,0 +1,16 @@
{
"bos_token": "<s>",
"cls_token": "<s>",
"do_lower_case": true,
"eos_token": "</s>",
"mask_token": "<mask>",
"model_max_length": 512,
"name_or_path": "/home/utente/.cache/torch/sentence_transformers/sentence-transformers_all-mpnet-base-v2/",
"pad_token": "<pad>",
"sep_token": "</s>",
"special_tokens_map_file": null,
"strip_accents": null,
"tokenize_chinese_chars": true,
"tokenizer_class": "MPNetTokenizer",
"unk_token": "[UNK]"
}

30527
vocab.txt Normal file

File diff suppressed because it is too large Load Diff