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

Model: sentence-transformers/distilbert-base-nli-stsb-quora-ranking
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-06-25 08:55:16 +08:00
commit 39051940ee
29 changed files with 49417 additions and 0 deletions

9
.gitattributes vendored Normal file
View File

@@ -0,0 +1,9 @@
*.bin.* filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tar.gz filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
model.safetensors 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
}

100
README.md Normal file
View File

@@ -0,0 +1,100 @@
---
license: apache-2.0
library_name: sentence-transformers
tags:
- sentence-transformers
- feature-extraction
- sentence-similarity
- transformers
pipeline_tag: sentence-similarity
---
# sentence-transformers/distilbert-base-nli-stsb-quora-ranking
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.
## 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('sentence-transformers/distilbert-base-nli-stsb-quora-ranking')
embeddings = model.encode(sentences)
print(embeddings)
```
## Usage (HuggingFace Transformers)
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
```python
from transformers import AutoTokenizer, AutoModel
import torch
#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0] #First element of model_output contains all token embeddings
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
# Sentences we want sentence embeddings for
sentences = ['This is an example sentence', 'Each sentence is converted']
# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained('sentence-transformers/distilbert-base-nli-stsb-quora-ranking')
model = AutoModel.from_pretrained('sentence-transformers/distilbert-base-nli-stsb-quora-ranking')
# Tokenize sentences
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
# Compute token embeddings
with torch.no_grad():
model_output = model(**encoded_input)
# Perform pooling. In this case, max pooling.
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
print("Sentence embeddings:")
print(sentence_embeddings)
```
## Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: DistilBertModel
(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})
)
```
## Citing & Authors
This model was trained by [sentence-transformers](https://www.sbert.net/).
If you find this model helpful, feel free to cite our publication [Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks](https://arxiv.org/abs/1908.10084):
```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 = "http://arxiv.org/abs/1908.10084",
}
```

View File

@@ -0,0 +1,21 @@
epoch,steps,cosine_acc,euclidean_acc,manhattan_acc
0,1000,0.8388813185387061,0.8391408734021154,0.8393679839075985
0,-1,0.8431639737849588,0.8413795340990202,0.8413470897410941
1,1000,0.8499772889494517,0.8535461683213289,0.8535461683213289
1,-1,0.8468950749464668,0.8484524041269224,0.8482252936214393
2,1000,0.8527675037311011,0.8553630523651937,0.855427941081046
2,-1,0.8521835052884303,0.8532866134579197,0.8536435013951074
3,1000,0.8523781714359873,0.8533190578158458,0.8532541690999935
3,-1,0.8505288430341964,0.853967944974369,0.8538057231847381
4,1000,0.8533190578158458,0.8544221659853352,0.8542923885536305
4,-1,0.8516643955616119,0.855427941081046,0.8552981636493414
5,1000,0.8519888391408734,0.854389721627409,0.8542274998377782
5,-1,0.8531892803841412,0.8550061644280059,0.8548763869963013
6,1000,0.851502173771981,0.8546168321328921,0.8547790539225228
6,-1,0.851696839919538,0.8551359418597106,0.8553630523651937
7,1000,0.8515346181299072,0.8537083901109597,0.8539030562585166
7,-1,0.8517941729933165,0.8532541690999935,0.8533839465316981
8,1000,0.8514372850561287,0.8532866134579197,0.8537083901109597
8,-1,0.8512101745506456,0.8535137239634027,0.8541301667639998
9,1000,0.8509830640451626,0.8534812796054766,0.8532217247420674
9,-1,0.8508532866134579,0.8538706119005904,0.8531568360262151
1 epoch steps cosine_acc euclidean_acc manhattan_acc
2 0 1000 0.8388813185387061 0.8391408734021154 0.8393679839075985
3 0 -1 0.8431639737849588 0.8413795340990202 0.8413470897410941
4 1 1000 0.8499772889494517 0.8535461683213289 0.8535461683213289
5 1 -1 0.8468950749464668 0.8484524041269224 0.8482252936214393
6 2 1000 0.8527675037311011 0.8553630523651937 0.855427941081046
7 2 -1 0.8521835052884303 0.8532866134579197 0.8536435013951074
8 3 1000 0.8523781714359873 0.8533190578158458 0.8532541690999935
9 3 -1 0.8505288430341964 0.853967944974369 0.8538057231847381
10 4 1000 0.8533190578158458 0.8544221659853352 0.8542923885536305
11 4 -1 0.8516643955616119 0.855427941081046 0.8552981636493414
12 5 1000 0.8519888391408734 0.854389721627409 0.8542274998377782
13 5 -1 0.8531892803841412 0.8550061644280059 0.8548763869963013
14 6 1000 0.851502173771981 0.8546168321328921 0.8547790539225228
15 6 -1 0.851696839919538 0.8551359418597106 0.8553630523651937
16 7 1000 0.8515346181299072 0.8537083901109597 0.8539030562585166
17 7 -1 0.8517941729933165 0.8532541690999935 0.8533839465316981
18 8 1000 0.8514372850561287 0.8532866134579197 0.8537083901109597
19 8 -1 0.8512101745506456 0.8535137239634027 0.8541301667639998
20 9 1000 0.8509830640451626 0.8534812796054766 0.8532217247420674
21 9 -1 0.8508532866134579 0.8538706119005904 0.8531568360262151

23
config.json Normal file
View File

@@ -0,0 +1,23 @@
{
"_name_or_path": "old_models/distilbert-base-nli-stsb-quora-ranking/0_Transformer",
"activation": "gelu",
"architectures": [
"DistilBertModel"
],
"attention_dropout": 0.1,
"dim": 768,
"dropout": 0.1,
"hidden_dim": 3072,
"initializer_range": 0.02,
"max_position_embeddings": 512,
"model_type": "distilbert",
"n_heads": 12,
"n_layers": 6,
"pad_token_id": 0,
"qa_dropout": 0.1,
"seq_classif_dropout": 0.2,
"sinusoidal_pos_embds": false,
"tie_weights_": true,
"transformers_version": "4.7.0",
"vocab_size": 30522
}

View File

@@ -0,0 +1,7 @@
{
"__version__": {
"sentence_transformers": "2.0.0",
"transformers": "4.7.0",
"pytorch": "1.9.0+cu102"
}
}

3
model.safetensors Normal file
View File

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

14
modules.json Normal file
View File

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

3
onnx/model.onnx Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:00c81d08b17b689d93887f0cdd6fe5a92b209df56d83e5e082cbdfa1a77987e9
size 265564612

3
onnx/model_O1.onnx Normal file
View File

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

3
onnx/model_O2.onnx Normal file
View File

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

3
onnx/model_O3.onnx Normal file
View File

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

3
onnx/model_O4.onnx Normal file
View File

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

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:30767c2fc0563af26c89287bc9dbe5f0aae3b3c85541eb78a271e77c108cb700
size 66965107

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:30767c2fc0563af26c89287bc9dbe5f0aae3b3c85541eb78a271e77c108cb700
size 66965107

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:30767c2fc0563af26c89287bc9dbe5f0aae3b3c85541eb78a271e77c108cb700
size 66965107

View File

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

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38de8535ac06c59f395eae1918e7f7256d5b69cbd0576f5f5919c763113e582f
size 265455736

7127
openvino/openvino_model.xml Normal file

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
epoch,steps,precision,recall,f1,threshold
0,1000,0.519327731092437,0.5638686131386861,0.5406824146981627,0.8566352128982544
0,-1,0.5397614314115308,0.4954379562043796,0.5166508087535681,0.8849869966506958
1,1000,0.5610651974288338,0.5574817518248175,0.5592677345537758,0.8567585945129395
1,-1,0.5682656826568265,0.5620437956204379,0.565137614678899,0.8601372241973877
2,1000,0.5085536547433903,0.5967153284671532,0.5491183879093199,0.8429018259048462
2,-1,0.5730941704035875,0.583029197080292,0.5780189959294438,0.8694514632225037
3,1000,0.5825602968460112,0.572992700729927,0.5777368905243792,0.86957848072052
3,-1,0.5531380753138075,0.6031021897810219,0.577040593627237,0.8499239683151245
4,1000,0.5730240549828178,0.6085766423357665,0.5902654867256637,0.8780158758163452
4,-1,0.5891544117647058,0.5848540145985401,0.5869963369963369,0.8710873126983643
5,1000,0.6232657417289221,0.5328467153284672,0.5745204131824889,0.8838479518890381
5,-1,0.5913461538461539,0.5611313868613139,0.5758426966292134,0.8885542154312134
6,1000,0.5984251968503937,0.5547445255474452,0.5757575757575758,0.8850898742675781
6,-1,0.6162280701754386,0.5127737226277372,0.5597609561752989,0.8889120817184448
7,1000,0.6458100558659218,0.5273722627737226,0.5806127574083375,0.9036331176757812
7,-1,0.542765787370104,0.6195255474452555,0.5786109927567107,0.8808742165565491
8,1000,0.6081218274111675,0.5465328467153284,0.5756847669389716,0.899591863155365
8,-1,0.5954500494559841,0.5492700729927007,0.5714285714285713,0.8881204724311829
9,1000,0.5725952813067151,0.5757299270072993,0.5741583257506825,0.886372983455658
9,-1,0.5646017699115045,0.5821167883211679,0.5732255166217429,0.8853609561920166
1 epoch steps precision recall f1 threshold
2 0 1000 0.519327731092437 0.5638686131386861 0.5406824146981627 0.8566352128982544
3 0 -1 0.5397614314115308 0.4954379562043796 0.5166508087535681 0.8849869966506958
4 1 1000 0.5610651974288338 0.5574817518248175 0.5592677345537758 0.8567585945129395
5 1 -1 0.5682656826568265 0.5620437956204379 0.565137614678899 0.8601372241973877
6 2 1000 0.5085536547433903 0.5967153284671532 0.5491183879093199 0.8429018259048462
7 2 -1 0.5730941704035875 0.583029197080292 0.5780189959294438 0.8694514632225037
8 3 1000 0.5825602968460112 0.572992700729927 0.5777368905243792 0.86957848072052
9 3 -1 0.5531380753138075 0.6031021897810219 0.577040593627237 0.8499239683151245
10 4 1000 0.5730240549828178 0.6085766423357665 0.5902654867256637 0.8780158758163452
11 4 -1 0.5891544117647058 0.5848540145985401 0.5869963369963369 0.8710873126983643
12 5 1000 0.6232657417289221 0.5328467153284672 0.5745204131824889 0.8838479518890381
13 5 -1 0.5913461538461539 0.5611313868613139 0.5758426966292134 0.8885542154312134
14 6 1000 0.5984251968503937 0.5547445255474452 0.5757575757575758 0.8850898742675781
15 6 -1 0.6162280701754386 0.5127737226277372 0.5597609561752989 0.8889120817184448
16 7 1000 0.6458100558659218 0.5273722627737226 0.5806127574083375 0.9036331176757812
17 7 -1 0.542765787370104 0.6195255474452555 0.5786109927567107 0.8808742165565491
18 8 1000 0.6081218274111675 0.5465328467153284 0.5756847669389716 0.899591863155365
19 8 -1 0.5954500494559841 0.5492700729927007 0.5714285714285713 0.8881204724311829
20 9 1000 0.5725952813067151 0.5757299270072993 0.5741583257506825 0.886372983455658
21 9 -1 0.5646017699115045 0.5821167883211679 0.5732255166217429 0.8853609561920166

3
pytorch_model.bin Normal file
View File

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

View File

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

1
special_tokens_map.json Normal file
View File

@@ -0,0 +1 @@
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}

3
tf_model.h5 Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:854c83efaa54c3d007f656b85cffedf1069401209e3818badbb057d685923ddf
size 265571968

1
tokenizer.json Normal file

File diff suppressed because one or more lines are too long

1
tokenizer_config.json Normal file
View File

@@ -0,0 +1 @@
{"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": "output/training_nli_distilbert-base-uncased-2020-07-22_10-20-15/0_Transformer/special_tokens_map.json", "full_tokenizer_file": null, "name_or_path": "old_models/distilbert-base-nli-stsb-quora-ranking/0_Transformer", "do_basic_tokenize": true, "never_split": null}

30522
vocab.txt Normal file

File diff suppressed because it is too large Load Diff