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": 768,
|
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 768 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': 768, '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-base-japanese-v3",
|
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": 768,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 3072,
|
13 |
+
"layer_norm_eps": 1e-12,
|
14 |
+
"max_position_embeddings": 512,
|
15 |
+
"model_type": "bert",
|
16 |
+
"num_attention_heads": 12,
|
17 |
+
"num_hidden_layers": 12,
|
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": 2816,
|
4 |
+
"best-dev": 79.14925054212402
|
5 |
+
}
|
log.csv
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch,step,loss,sts-dev
|
2 |
+
0,0,inf,51.37411795900895
|
3 |
+
0,256,0.0375348776578903,55.5997536647364
|
4 |
+
0,512,0.0017691701650619,58.32817940768812
|
5 |
+
0,768,0.0006307438015937,59.3974185060456
|
6 |
+
0,1024,0.0003144387155771,60.754689631552935
|
7 |
+
0,1280,0.0004976624622941,67.08745072940616
|
8 |
+
0,1536,0.0002566464245319,68.1524768645118
|
9 |
+
0,1792,0.0002705361694097,69.40357586993056
|
10 |
+
0,2048,0.0001239106059074,70.00059301214966
|
11 |
+
0,2304,0.0003662584349513,75.31010320876732
|
12 |
+
0,2560,0.0009017521515488,76.00143228736593
|
13 |
+
0,2816,0.000157325528562,79.14925054212402
|
14 |
+
0,3072,7.141055539250374e-05,79.03881731254904
|
15 |
+
0,3328,6.363820284605026e-05,78.44641639262007
|
16 |
+
0,3584,0.0003677839413285,69.92161167599382
|
17 |
+
0,3840,0.0001026871614158,68.42750644636237
|
18 |
+
0,4096,9.204680100083352e-05,70.72705620298922
|
19 |
+
0,4352,0.0001523927785456,71.94724540351626
|
20 |
+
0,4608,5.27617521584034e-05,73.47894342360826
|
21 |
+
0,4864,0.0004469738341867,66.93028259965841
|
22 |
+
0,5120,0.0005747117102146,62.61976106536561
|
23 |
+
0,5376,9.74196009337902e-05,64.04559706437584
|
24 |
+
0,5632,0.0015562903136014,69.92255616122571
|
25 |
+
0,5888,0.0010261721909046,61.98660674368782
|
26 |
+
0,6144,0.0001530339941382,63.50736446491301
|
27 |
+
0,6400,8.464325219392776e-05,65.00607265185072
|
28 |
+
0,6656,0.0001220507547259,64.11445092781186
|
29 |
+
0,6912,7.890071719884872e-05,66.22976181708123
|
30 |
+
0,7168,9.68356616795063e-05,65.92655281556975
|
31 |
+
0,7424,8.580600842833519e-05,65.17092915065315
|
32 |
+
0,7680,0.0001265667378902,65.30866918870973
|
33 |
+
0,7936,6.173737347126007e-05,66.90631113844152
|
34 |
+
0,8192,0.0001264261081814,66.40594180975687
|
35 |
+
0,8448,0.0001129913143813,65.82487123637435
|
36 |
+
0,8704,6.541237235069275e-05,66.07900519557332
|
37 |
+
0,8960,3.945222124457359e-05,66.91985335070422
|
38 |
+
0,9216,0.0003336034715175,60.87154559005693
|
39 |
+
0,9472,6.768666207790375e-05,62.93127257528387
|
40 |
+
0,9728,5.523348227143288e-05,62.83898335246322
|
41 |
+
0,9984,0.0001294771209359,63.87235436545296
|
42 |
+
0,10240,0.0001297239214181,71.55534428591778
|
43 |
+
0,10496,5.560088902711868e-05,72.26094985542503
|
44 |
+
0,10752,0.0002071415074169,67.9768502124699
|
45 |
+
0,11008,7.525458931922913e-05,70.44867140163949
|
46 |
+
0,11264,0.0001133475452661,73.38390697765232
|
47 |
+
0,11520,8.798344060778618e-05,73.5864667379101
|
48 |
+
0,11776,4.829838871955872e-05,73.398043540928
|
49 |
+
0,12032,3.966083750128746e-05,73.17604312647413
|
50 |
+
0,12288,0.000146017409861,73.03065062945811
|
51 |
+
0,12544,0.0001280489377677,73.41318767441048
|
52 |
+
0,12800,3.561563789844513e-05,72.99900370616899
|
53 |
+
0,13056,3.670249134302139e-05,73.3663132648536
|
54 |
+
0,13312,3.159511834383011e-05,73.28953413824371
|
55 |
+
0,13568,3.014621324837208e-05,73.1532624579162
|
56 |
+
0,13824,6.573181599378586e-05,72.19940893582316
|
57 |
+
0,14080,2.860999666154385e-05,72.19998744238026
|
58 |
+
0,14336,4.158122465014458e-05,71.95310234208006
|
59 |
+
0,14592,2.8798123821616173e-05,72.24484132141129
|
60 |
+
0,14848,6.46631233394146e-05,71.71260103237086
|
61 |
+
0,15104,2.8088223189115524e-05,72.05196625094614
|
62 |
+
0,15360,2.8930604457855225e-05,72.30732956907381
|
63 |
+
0,15616,2.897414378821849e-05,72.5329350302894
|
64 |
+
1,15872,2.837018109858036e-05,72.58699593041659
|
65 |
+
1,16128,8.221296593546867e-05,72.68198072076807
|
66 |
+
1,16384,2.6318710297346115e-05,72.70427711066239
|
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:b51be3aac3b2f84cc5fec4632604eec977c8a6c152a72d46368fed9e336f8110
|
3 |
+
size 444897069
|
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.01221347847088,
|
3 |
+
"jsts-val": 78.94769808578855,
|
4 |
+
"jsts-train": 74.47873985273404,
|
5 |
+
"avg": 77.47955047233116
|
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
|
|