Upload with huggingface_hub
Browse files- 1_Pooling/config.json +7 -0
- README.md +91 -0
- config.json +24 -0
- config_sentence_transformers.json +7 -0
- eval/binary_classification_evaluation_results.csv +10 -0
- modules.json +20 -0
- pytorch_model.bin +3 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +15 -0
- tokenizer.json +0 -0
- tokenizer_config.json +16 -0
- vocab.txt +0 -0
1_Pooling/config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 768,
|
3 |
+
"pooling_mode_cls_token": false,
|
4 |
+
"pooling_mode_mean_tokens": true,
|
5 |
+
"pooling_mode_max_tokens": false,
|
6 |
+
"pooling_mode_mean_sqrt_len_tokens": false
|
7 |
+
}
|
README.md
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: sentence-similarity
|
3 |
+
tags:
|
4 |
+
- sentence-transformers
|
5 |
+
- feature-extraction
|
6 |
+
- sentence-similarity
|
7 |
+
|
8 |
+
---
|
9 |
+
|
10 |
+
# {MODEL_NAME}
|
11 |
+
|
12 |
+
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.
|
13 |
+
|
14 |
+
<!--- Describe your model here -->
|
15 |
+
|
16 |
+
## Usage (Sentence-Transformers)
|
17 |
+
|
18 |
+
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
19 |
+
|
20 |
+
```
|
21 |
+
pip install -U sentence-transformers
|
22 |
+
```
|
23 |
+
|
24 |
+
Then you can use the model like this:
|
25 |
+
|
26 |
+
```python
|
27 |
+
from sentence_transformers import SentenceTransformer
|
28 |
+
sentences = ["This is an example sentence", "Each sentence is converted"]
|
29 |
+
|
30 |
+
model = SentenceTransformer('{MODEL_NAME}')
|
31 |
+
embeddings = model.encode(sentences)
|
32 |
+
print(embeddings)
|
33 |
+
```
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
## Evaluation Results
|
38 |
+
|
39 |
+
<!--- Describe how your model was evaluated -->
|
40 |
+
|
41 |
+
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
|
42 |
+
|
43 |
+
|
44 |
+
## Training
|
45 |
+
The model was trained with the parameters:
|
46 |
+
|
47 |
+
**DataLoader**:
|
48 |
+
|
49 |
+
`torch.utils.data.dataloader.DataLoader` of length 639 with parameters:
|
50 |
+
```
|
51 |
+
{'batch_size': 512, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
52 |
+
```
|
53 |
+
|
54 |
+
**Loss**:
|
55 |
+
|
56 |
+
`sentence_transformers.losses.ContrastiveLoss.ContrastiveLoss` with parameters:
|
57 |
+
```
|
58 |
+
{'distance_metric': 'SiameseDistanceMetric.COSINE_DISTANCE', 'margin': 0.5, 'size_average': True}
|
59 |
+
```
|
60 |
+
|
61 |
+
Parameters of the fit()-Method:
|
62 |
+
```
|
63 |
+
{
|
64 |
+
"epochs": 3,
|
65 |
+
"evaluation_steps": 250,
|
66 |
+
"evaluator": "sentence_transformers.evaluation.BinaryClassificationEvaluator.BinaryClassificationEvaluator",
|
67 |
+
"max_grad_norm": 1,
|
68 |
+
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
|
69 |
+
"optimizer_params": {
|
70 |
+
"lr": 2e-05
|
71 |
+
},
|
72 |
+
"scheduler": "WarmupLinear",
|
73 |
+
"steps_per_epoch": null,
|
74 |
+
"warmup_steps": 50,
|
75 |
+
"weight_decay": 0.01
|
76 |
+
}
|
77 |
+
```
|
78 |
+
|
79 |
+
|
80 |
+
## Full Model Architecture
|
81 |
+
```
|
82 |
+
SentenceTransformer(
|
83 |
+
(0): Transformer({'max_seq_length': 384, 'do_lower_case': False}) with Transformer model: MPNetModel
|
84 |
+
(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})
|
85 |
+
(2): Normalize()
|
86 |
+
)
|
87 |
+
```
|
88 |
+
|
89 |
+
## Citing & Authors
|
90 |
+
|
91 |
+
<!--- Describe where people can find more information -->
|
config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/root/.cache/torch/sentence_transformers/sentence-transformers_all-mpnet-base-v2/",
|
3 |
+
"architectures": [
|
4 |
+
"MPNetModel"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"eos_token_id": 2,
|
9 |
+
"hidden_act": "gelu",
|
10 |
+
"hidden_dropout_prob": 0.1,
|
11 |
+
"hidden_size": 768,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 3072,
|
14 |
+
"layer_norm_eps": 1e-05,
|
15 |
+
"max_position_embeddings": 514,
|
16 |
+
"model_type": "mpnet",
|
17 |
+
"num_attention_heads": 12,
|
18 |
+
"num_hidden_layers": 12,
|
19 |
+
"pad_token_id": 1,
|
20 |
+
"relative_attention_num_buckets": 32,
|
21 |
+
"torch_dtype": "float32",
|
22 |
+
"transformers_version": "4.20.1",
|
23 |
+
"vocab_size": 30527
|
24 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "2.0.0",
|
4 |
+
"transformers": "4.6.1",
|
5 |
+
"pytorch": "1.8.1"
|
6 |
+
}
|
7 |
+
}
|
eval/binary_classification_evaluation_results.csv
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,250,0.9971255486184089,0.7860784530639648,0.47115384615384615,0.5051546391752577,0.44144144144144143,0.6751430034637451,0.42224987872785896,0.9971255486184089,14.197881698608398,0.4716981132075471,0.49504950495049505,0.45045045045045046,17.451753616333008,0.4103248192058105,0.9971255486184089,0.6540963649749756,0.47115384615384615,0.5051546391752577,0.44144144144144143,0.806047797203064,0.42224987872785896,0.9971255486184089,0.7860783934593201,0.47115384615384615,0.5051546391752577,0.44144144144144143,0.6751430034637451,0.42997188644986667
|
3 |
+
0,500,0.9971873647771528,0.7727430462837219,0.5077720207253886,0.5975609756097561,0.44144144144144143,0.6742345690727234,0.46843184368529395,0.9971564566977807,14.54420280456543,0.502673796791444,0.618421052631579,0.42342342342342343,16.89820671081543,0.46304702067355674,0.9971873647771528,0.6741615533828735,0.5077720207253886,0.5975609756097561,0.44144144144144143,0.8071737289428711,0.46843184368529395,0.9971873647771528,0.7727429866790771,0.5077720207253886,0.5975609756097561,0.44144144144144143,0.6742346286773682,0.4650212902747405
|
4 |
+
0,-1,0.9973109970946406,0.7720497846603394,0.4927536231884059,0.53125,0.4594594594594595,0.6796356439590454,0.47324615287139826,0.9973109970946406,14.612258911132812,0.49197860962566836,0.6052631578947368,0.4144144144144144,16.49704933166504,0.4683868113938224,0.9973109970946406,0.6751812696456909,0.4927536231884059,0.53125,0.4594594594594595,0.8004552125930786,0.4732461528713983,0.9973109970946406,0.7720497846603394,0.4927536231884059,0.53125,0.4594594594594595,0.679635763168335,0.48096816059340597
|
5 |
+
1,250,0.9975582617296161,0.7318648099899292,0.5325443786982249,0.7758620689655172,0.40540540540540543,0.7318648099899292,0.5093372329211693,0.9974346294121283,15.47210693359375,0.5204081632653061,0.6,0.4594594594594595,17.269819259643555,0.503391952080188,0.9975582617296161,0.7323043942451477,0.5325443786982249,0.7758620689655172,0.40540540540540543,0.7323043942451477,0.5093372329211694,0.9975582617296161,0.7318648099899292,0.5325443786982249,0.7758620689655172,0.40540540540540543,0.7318648099899292,0.5097662333501698
|
6 |
+
1,500,0.9974964455708722,0.7629842758178711,0.5384615384615384,0.6901408450704225,0.44144144144144143,0.7261955738067627,0.5128704073299246,0.9974964455708722,14.797735214233398,0.5363128491620112,0.7058823529411765,0.43243243243243246,15.855657577514648,0.5102833557355283,0.9974964455708722,0.6884797811508179,0.5384615384615384,0.6901408450704225,0.44144144144144143,0.7399995923042297,0.5128704073299246,0.9974964455708722,0.7629842758178711,0.5384615384615384,0.6901408450704225,0.44144144144144143,0.7261955738067627,0.512398506858024
|
7 |
+
1,-1,0.9974655374915002,0.7498965263366699,0.5414364640883977,0.7,0.44144144144144143,0.7086991667747498,0.5097892190044456,0.9974655374915002,14.969259262084961,0.542713567839196,0.6136363636363636,0.4864864864864865,17.64130973815918,0.5065909871354535,0.9974655374915002,0.7072519063949585,0.5414364640883977,0.7,0.44144144144144143,0.7632806301116943,0.5097892190044457,0.9974655374915002,0.7498965263366699,0.5414364640883977,0.7,0.44144144144144143,0.7086991667747498,0.5175112267264533
|
8 |
+
2,250,0.997589169808988,0.7229688167572021,0.5617977528089888,0.746268656716418,0.45045045045045046,0.7229688167572021,0.517788880933702,0.997589169808988,16.01903533935547,0.5568181818181819,0.7538461538461538,0.44144144144144143,16.01903533935547,0.5156980805030804,0.997589169808988,0.7443519830703735,0.5617977528089888,0.746268656716418,0.45045045045045046,0.7443519830703735,0.517788880933702,0.997589169808988,0.7229687571525574,0.5617977528089888,0.746268656716418,0.45045045045045046,0.7229687571525574,0.5129626261074471
|
9 |
+
2,500,0.99762007788836,0.7199109196662903,0.56,0.765625,0.44144144144144143,0.7199109196662903,0.5123524806692401,0.997589169808988,16.367429733276367,0.5617977528089888,0.746268656716418,0.45045045045045046,16.517536163330078,0.5099140594602563,0.99762007788836,0.748445451259613,0.56,0.765625,0.44144144144144143,0.748445451259613,0.5123524806692401,0.99762007788836,0.7199110388755798,0.56,0.765625,0.44144144144144143,0.7199110388755798,0.5157844841012436
|
10 |
+
2,-1,0.99762007788836,0.7229962348937988,0.5617977528089888,0.746268656716418,0.45045045045045046,0.7168759703636169,0.5126609396662768,0.997589169808988,16.32653045654297,0.5568181818181819,0.7538461538461538,0.44144144144144143,16.32653045654297,0.5103884237996142,0.99762007788836,0.744316577911377,0.5617977528089888,0.746268656716418,0.45045045045045046,0.7524944543838501,0.5126609396662768,0.99762007788836,0.7229962348937988,0.5617977528089888,0.746268656716418,0.45045045045045046,0.7168759703636169,0.5130899400952773
|
modules.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"idx": 0,
|
4 |
+
"name": "0",
|
5 |
+
"path": "",
|
6 |
+
"type": "sentence_transformers.models.Transformer"
|
7 |
+
},
|
8 |
+
{
|
9 |
+
"idx": 1,
|
10 |
+
"name": "1",
|
11 |
+
"path": "1_Pooling",
|
12 |
+
"type": "sentence_transformers.models.Pooling"
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"idx": 2,
|
16 |
+
"name": "2",
|
17 |
+
"path": "2_Normalize",
|
18 |
+
"type": "sentence_transformers.models.Normalize"
|
19 |
+
}
|
20 |
+
]
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:926a42592745a2128bdbdcb6b37349b6c5e18042cb0e9854758a3a219f1d15dd
|
3 |
+
size 438014769
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 384,
|
3 |
+
"do_lower_case": false
|
4 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"cls_token": "<s>",
|
4 |
+
"eos_token": "</s>",
|
5 |
+
"mask_token": {
|
6 |
+
"content": "<mask>",
|
7 |
+
"lstrip": true,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"pad_token": "<pad>",
|
13 |
+
"sep_token": "</s>",
|
14 |
+
"unk_token": "[UNK]"
|
15 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"cls_token": "<s>",
|
4 |
+
"do_lower_case": true,
|
5 |
+
"eos_token": "</s>",
|
6 |
+
"mask_token": "<mask>",
|
7 |
+
"model_max_length": 512,
|
8 |
+
"name_or_path": "/root/.cache/torch/sentence_transformers/sentence-transformers_all-mpnet-base-v2/",
|
9 |
+
"pad_token": "<pad>",
|
10 |
+
"sep_token": "</s>",
|
11 |
+
"special_tokens_map_file": null,
|
12 |
+
"strip_accents": null,
|
13 |
+
"tokenize_chinese_chars": true,
|
14 |
+
"tokenizer_class": "MPNetTokenizer",
|
15 |
+
"unk_token": "[UNK]"
|
16 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|