Upload folder using huggingface_hub
Browse files- 1_Pooling/config.json +7 -0
- README.md +92 -0
- config.json +25 -0
- config_sentence_transformers.json +7 -0
- dev-metrics.json +5 -0
- log.csv +66 -0
- modules.json +14 -0
- pytorch_model.bin +3 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +7 -0
- sts-metrics.json +6 -0
- tokenizer_config.json +21 -0
- vocab.txt +0 -0
1_Pooling/config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 1024,
|
3 |
+
"pooling_mode_cls_token": true,
|
4 |
+
"pooling_mode_mean_tokens": false,
|
5 |
+
"pooling_mode_max_tokens": false,
|
6 |
+
"pooling_mode_mean_sqrt_len_tokens": false
|
7 |
+
}
|
README.md
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: sentence-similarity
|
3 |
+
tags:
|
4 |
+
- sentence-transformers
|
5 |
+
- feature-extraction
|
6 |
+
- sentence-similarity
|
7 |
+
- transformers
|
8 |
+
datasets:
|
9 |
+
- wiki40b
|
10 |
+
---
|
11 |
+
|
12 |
+
# {MODEL_NAME}
|
13 |
+
|
14 |
+
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 1024 dimensional dense vector space and can be used for tasks like clustering or semantic search.
|
15 |
+
|
16 |
+
<!--- Describe your model here -->
|
17 |
+
|
18 |
+
## Usage (Sentence-Transformers)
|
19 |
+
|
20 |
+
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
21 |
+
|
22 |
+
```
|
23 |
+
pip install -U sentence-transformers
|
24 |
+
```
|
25 |
+
|
26 |
+
Then you can use the model like this:
|
27 |
+
|
28 |
+
```python
|
29 |
+
from sentence_transformers import SentenceTransformer
|
30 |
+
sentences = ["This is an example sentence", "Each sentence is converted"]
|
31 |
+
|
32 |
+
model = SentenceTransformer('{MODEL_NAME}')
|
33 |
+
embeddings = model.encode(sentences)
|
34 |
+
print(embeddings)
|
35 |
+
```
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
## Usage (HuggingFace Transformers)
|
40 |
+
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.
|
41 |
+
|
42 |
+
```python
|
43 |
+
from transformers import AutoTokenizer, AutoModel
|
44 |
+
import torch
|
45 |
+
|
46 |
+
|
47 |
+
def cls_pooling(model_output, attention_mask):
|
48 |
+
return model_output[0][:,0]
|
49 |
+
|
50 |
+
|
51 |
+
# Sentences we want sentence embeddings for
|
52 |
+
sentences = ['This is an example sentence', 'Each sentence is converted']
|
53 |
+
|
54 |
+
# Load model from HuggingFace Hub
|
55 |
+
tokenizer = AutoTokenizer.from_pretrained('{MODEL_NAME}')
|
56 |
+
model = AutoModel.from_pretrained('{MODEL_NAME}')
|
57 |
+
|
58 |
+
# Tokenize sentences
|
59 |
+
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
60 |
+
|
61 |
+
# Compute token embeddings
|
62 |
+
with torch.no_grad():
|
63 |
+
model_output = model(**encoded_input)
|
64 |
+
|
65 |
+
# Perform pooling. In this case, cls pooling.
|
66 |
+
sentence_embeddings = cls_pooling(model_output, encoded_input['attention_mask'])
|
67 |
+
|
68 |
+
print("Sentence embeddings:")
|
69 |
+
print(sentence_embeddings)
|
70 |
+
```
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
## Evaluation Results
|
75 |
+
|
76 |
+
<!--- Describe how your model was evaluated -->
|
77 |
+
|
78 |
+
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
## Full Model Architecture
|
83 |
+
```
|
84 |
+
SentenceTransformer(
|
85 |
+
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
|
86 |
+
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
|
87 |
+
)
|
88 |
+
```
|
89 |
+
|
90 |
+
## Citing & Authors
|
91 |
+
|
92 |
+
<!--- Describe where people can find more information -->
|
config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "cl-tohoku/bert-large-japanese-v2",
|
3 |
+
"architectures": [
|
4 |
+
"BertModel"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"classifier_dropout": null,
|
8 |
+
"hidden_act": "gelu",
|
9 |
+
"hidden_dropout_prob": 0.1,
|
10 |
+
"hidden_size": 1024,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 4096,
|
13 |
+
"layer_norm_eps": 1e-12,
|
14 |
+
"max_position_embeddings": 512,
|
15 |
+
"model_type": "bert",
|
16 |
+
"num_attention_heads": 16,
|
17 |
+
"num_hidden_layers": 24,
|
18 |
+
"pad_token_id": 0,
|
19 |
+
"position_embedding_type": "absolute",
|
20 |
+
"torch_dtype": "float32",
|
21 |
+
"transformers_version": "4.28.1",
|
22 |
+
"type_vocab_size": 2,
|
23 |
+
"use_cache": true,
|
24 |
+
"vocab_size": 32768
|
25 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "2.2.2",
|
4 |
+
"transformers": "4.28.1",
|
5 |
+
"pytorch": "2.0.1+cu118"
|
6 |
+
}
|
7 |
+
}
|
dev-metrics.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best-epoch": 0,
|
3 |
+
"best-step": 14848,
|
4 |
+
"best-dev": 79.89326362092076
|
5 |
+
}
|
log.csv
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch,step,loss,sts-dev
|
2 |
+
0,0,inf,46.70784718045186
|
3 |
+
0,256,0.1804292798042297,52.72027437941158
|
4 |
+
0,512,0.0020474940538406,54.16706057378039
|
5 |
+
0,768,0.0009167678654193,54.97971089516359
|
6 |
+
0,1024,0.000422166660428,55.25231988293338
|
7 |
+
0,1280,0.0003259554505348,57.31856344751787
|
8 |
+
0,1536,0.0002286350354552,58.87054645225247
|
9 |
+
0,1792,0.0001499559730291,60.728810953166615
|
10 |
+
0,2048,0.0001791073009371,61.57247985363832
|
11 |
+
0,2304,0.0001186188310384,64.60548209276658
|
12 |
+
0,2560,0.0001095095649361,63.10229448214084
|
13 |
+
0,2816,0.0001485776156187,64.8266343938356
|
14 |
+
0,3072,5.192495882511139e-05,64.93407974180886
|
15 |
+
0,3328,5.085254088044167e-05,65.81752870539546
|
16 |
+
0,3584,4.379916936159134e-05,67.45208926863944
|
17 |
+
0,3840,4.599476233124733e-05,68.05788327988445
|
18 |
+
0,4096,4.309089854359627e-05,69.45097516603441
|
19 |
+
0,4352,3.668293356895447e-05,68.1476778494779
|
20 |
+
0,4608,9.581120684742928e-05,69.92317914058378
|
21 |
+
0,4864,2.981838770210743e-05,70.9661656639272
|
22 |
+
0,5120,2.7928035706281665e-05,70.94022380977198
|
23 |
+
0,5376,2.4954788386821747e-05,71.95443935736876
|
24 |
+
0,5632,0.0002523055300116,64.31970216926345
|
25 |
+
0,5888,8.713500574231148e-05,69.52938449247287
|
26 |
+
0,6144,0.0014079879038035,70.47003750847361
|
27 |
+
0,6400,0.000243455171585,71.59856983457301
|
28 |
+
0,6656,0.000127900391817,74.68453275823876
|
29 |
+
0,6912,0.0001000803895294,75.77340285188441
|
30 |
+
0,7168,4.809629172086716e-05,76.39808954543045
|
31 |
+
0,7424,7.226737216114998e-05,77.21090146846127
|
32 |
+
0,7680,5.386536940932274e-05,77.35177080166082
|
33 |
+
0,7936,6.202561780810356e-05,78.88216498082295
|
34 |
+
0,8192,4.967162385582924e-05,78.44234060894145
|
35 |
+
0,8448,8.730334229767323e-05,77.11248318696224
|
36 |
+
0,8704,3.610621206462383e-05,77.38938397378755
|
37 |
+
0,8960,3.122887574136257e-05,77.82144371150366
|
38 |
+
0,9216,2.6472844183444977e-05,77.64439577421061
|
39 |
+
0,9472,3.739865496754646e-05,77.82867263629335
|
40 |
+
0,9728,6.275856867432594e-05,77.78532545057863
|
41 |
+
0,9984,0.0001052424777299,77.68747091778894
|
42 |
+
0,10240,6.868503987789154e-05,78.50513744745713
|
43 |
+
0,10496,2.1886546164751053e-05,78.41693329853474
|
44 |
+
0,10752,2.1351734176278114e-05,78.40869491745303
|
45 |
+
0,11008,6.39175996184349e-05,77.34029669023184
|
46 |
+
0,11264,2.041761763393879e-05,77.46689545708392
|
47 |
+
0,11520,1.9822735339403152e-05,77.56863484544071
|
48 |
+
0,11776,0.0001011767890304,76.97902467846677
|
49 |
+
0,12032,1.891795545816421e-05,77.33079748604983
|
50 |
+
0,12288,2.008024603128433e-05,77.43681879408709
|
51 |
+
0,12544,1.6340520232915878e-05,77.87685933905435
|
52 |
+
0,12800,1.8035294488072395e-05,78.98472505927285
|
53 |
+
0,13056,1.5516066923737526e-05,79.37901670816368
|
54 |
+
0,13312,1.7801765352487564e-05,79.09891287263548
|
55 |
+
0,13568,1.2751086615025995e-05,79.24946296985583
|
56 |
+
0,13824,2.7165631763637062e-05,79.63705481260891
|
57 |
+
0,14080,9.27936052903533e-05,79.62363077978016
|
58 |
+
0,14336,1.8229475244879723e-05,79.80480156914284
|
59 |
+
0,14592,1.4328979887068272e-05,79.78896480741983
|
60 |
+
0,14848,1.1875061318278313e-05,79.89326362092076
|
61 |
+
0,15104,1.981784589588642e-05,79.06084666759766
|
62 |
+
0,15360,1.3236538507044315e-05,79.40354417627844
|
63 |
+
0,15616,4.09658532589674e-05,79.15875606571835
|
64 |
+
1,15872,1.979898661375045e-05,79.18473415613285
|
65 |
+
1,16128,4.3475418351590633e-05,79.22740284079154
|
66 |
+
1,16384,1.6250647604465485e-05,79.1942526682348
|
modules.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
]
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:16a74528fe4d664be1b409f3143180d40a61f9b854875fcfd193dc5e5bf3aee0
|
3 |
+
size 1349897965
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 512,
|
3 |
+
"do_lower_case": false
|
4 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"mask_token": "[MASK]",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"sep_token": "[SEP]",
|
6 |
+
"unk_token": "[UNK]"
|
7 |
+
}
|
sts-metrics.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"jsick": 79.61770842846016,
|
3 |
+
"jsts-val": 81.40370972668754,
|
4 |
+
"jsts-train": 77.77128665725087,
|
5 |
+
"avg": 79.59756827079953
|
6 |
+
}
|
tokenizer_config.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"clean_up_tokenization_spaces": true,
|
3 |
+
"cls_token": "[CLS]",
|
4 |
+
"do_lower_case": false,
|
5 |
+
"do_subword_tokenize": true,
|
6 |
+
"do_word_tokenize": true,
|
7 |
+
"jumanpp_kwargs": null,
|
8 |
+
"mask_token": "[MASK]",
|
9 |
+
"mecab_kwargs": {
|
10 |
+
"mecab_dic": "unidic_lite"
|
11 |
+
},
|
12 |
+
"model_max_length": 512,
|
13 |
+
"never_split": null,
|
14 |
+
"pad_token": "[PAD]",
|
15 |
+
"sep_token": "[SEP]",
|
16 |
+
"subword_tokenizer_type": "wordpiece",
|
17 |
+
"sudachi_kwargs": null,
|
18 |
+
"tokenizer_class": "BertJapaneseTokenizer",
|
19 |
+
"unk_token": "[UNK]",
|
20 |
+
"word_tokenizer_type": "mecab"
|
21 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|