To solve the warning from sentence_transformers, add 4 configs files.
Browse files4 configs file. config.json under 1_Pooling directory as described in modules.json.
With putting those 4 files under the sbert-base-chinese-nli/ , the Warning "WARNING - No sentence-transformers model found with name /Users/peter42/.cache/torch/sentence_transformers/uer_sbert-base-chinese-nli. Creating a new one with MEAN pooling." would be solved.
The reason of Warning is described in the source code of https://github.com/UKPLab/sentence-transformers
If modules.json exsits, standard sentence_transformers load function is called. Or Auto model/Tokenize as huggingface model with mean pooling will be called.
- config.json +6 -22
- config_sentence_transformers.json +7 -0
- modules.json +20 -0
- sentence_bert_config.json +4 -0
config.json
CHANGED
@@ -1,23 +1,7 @@
|
|
1 |
{
|
2 |
-
"
|
3 |
-
|
4 |
-
|
5 |
-
"
|
6 |
-
"
|
7 |
-
|
8 |
-
"hidden_dropout_prob": 0.1,
|
9 |
-
"hidden_size": 768,
|
10 |
-
"initializer_range": 0.02,
|
11 |
-
"intermediate_size": 3072,
|
12 |
-
"layer_norm_eps": 1e-12,
|
13 |
-
"max_position_embeddings": 512,
|
14 |
-
"model_type": "bert",
|
15 |
-
"num_attention_heads": 12,
|
16 |
-
"num_hidden_layers": 12,
|
17 |
-
"pad_token_id": 0,
|
18 |
-
"position_embedding_type": "absolute",
|
19 |
-
"transformers_version": "4.6.0",
|
20 |
-
"type_vocab_size": 2,
|
21 |
-
"use_cache": true,
|
22 |
-
"vocab_size": 21128
|
23 |
-
}
|
|
|
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 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
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 |
+
]
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 512,
|
3 |
+
"do_lower_case": false
|
4 |
+
}
|