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 |
+
- shunk031/jsnli
|
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": 64,
|
4 |
+
"best-dev": 84.35700372236889
|
5 |
+
}
|
log.csv
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch,step,loss,sts-dev
|
2 |
+
0,0,inf,46.72837224312097
|
3 |
+
0,32,5.49169921875,79.31070160603963
|
4 |
+
0,64,2.51708984375,84.35700372236889
|
5 |
+
0,96,2.013916015625,82.41349585392163
|
6 |
+
0,128,1.83056640625,80.40566982305087
|
7 |
+
0,160,1.715576171875,77.84721366215935
|
8 |
+
0,192,1.650146484375,78.6757653419235
|
9 |
+
0,224,1.568115234375,73.42996624180068
|
10 |
+
0,256,1.55322265625,75.57552162351263
|
11 |
+
1,288,1.490966796875,71.41986682440324
|
12 |
+
1,320,1.37548828125,73.29193104300393
|
13 |
+
1,352,1.33544921875,72.80806281746437
|
14 |
+
1,384,1.350830078125,72.77195292066885
|
15 |
+
1,416,1.353759765625,69.87782142691363
|
16 |
+
1,448,1.33447265625,64.9175102353748
|
17 |
+
1,480,1.309326171875,69.45867633288623
|
18 |
+
1,512,1.31982421875,70.6730909328148
|
19 |
+
1,544,1.29150390625,70.64751383186746
|
20 |
+
2,576,1.212646484375,65.82802791174757
|
21 |
+
2,608,1.11669921875,66.64306435617323
|
22 |
+
2,640,1.14453125,65.48764039746843
|
23 |
+
2,672,1.1185302734375,66.58600028071007
|
24 |
+
2,704,1.123779296875,67.64014437611549
|
25 |
+
2,736,1.103759765625,69.60152425618847
|
26 |
+
2,768,1.141357421875,69.34622506400544
|
27 |
+
2,800,1.270263671875,70.32409725193519
|
28 |
+
2,832,1.221435546875,67.92858244662744
|
29 |
+
3,864,1.0614013671875,66.34717772523808
|
30 |
+
3,896,1.0054931640625,66.87521082007706
|
31 |
+
3,928,1.0040283203125,65.41458032481682
|
32 |
+
3,960,1.0062255859375,65.70913894370779
|
33 |
+
3,992,1.0181884765625,66.46946316417328
|
34 |
+
3,1024,0.996337890625,63.34887069413857
|
35 |
+
3,1056,1.02392578125,65.18104616486384
|
36 |
+
3,1088,0.9970703125,64.49234957916627
|
37 |
+
3,1120,1.0,64.80023992366682
|
38 |
+
4,1152,0.884521484375,65.09789161785304
|
39 |
+
4,1184,0.880615234375,66.50805762020076
|
40 |
+
4,1216,0.886474609375,63.74224407082551
|
41 |
+
4,1248,0.8818359375,63.54117456035738
|
42 |
+
4,1280,0.8819580078125,65.77741134837758
|
43 |
+
4,1312,0.883544921875,66.75449263267615
|
44 |
+
4,1344,0.875732421875,63.99539291809667
|
45 |
+
4,1376,0.9068603515625,64.31698278731722
|
46 |
+
5,1408,0.8865966796875,65.00043435754733
|
47 |
+
5,1440,0.7822265625,64.22602226609517
|
48 |
+
5,1472,0.785400390625,64.0694313946185
|
49 |
+
5,1504,0.7928466796875,63.40049229004234
|
50 |
+
5,1536,0.784912109375,62.86333382743011
|
51 |
+
5,1568,0.794189453125,64.06125094235347
|
52 |
+
5,1600,0.810546875,62.99456391252577
|
53 |
+
5,1632,0.8006591796875,62.3648377584635
|
54 |
+
5,1664,0.7896728515625,64.00460895931644
|
55 |
+
6,1696,0.7900390625,64.12996526496609
|
56 |
+
6,1728,0.720703125,64.04989699764432
|
57 |
+
6,1760,0.7353515625,62.60633883039293
|
58 |
+
6,1792,0.735595703125,62.39235079765329
|
59 |
+
6,1824,0.72314453125,62.836391633071166
|
60 |
+
6,1856,0.7305908203125,63.51677689636537
|
61 |
+
6,1888,0.729248046875,63.40423279523494
|
62 |
+
6,1920,0.7313232421875,63.03712185206447
|
63 |
+
6,1952,0.733154296875,63.04729553320853
|
64 |
+
7,1984,0.699462890625,62.68467625961607
|
65 |
+
7,2016,0.70556640625,62.67148071717765
|
66 |
+
7,2048,0.69970703125,62.75529368448359
|
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:d8484e8d52ac2e6d9a263662ac4d11932518ee09ed7566ee43b9a044971fff71
|
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": 83.05096544584796,
|
3 |
+
"jsts-val": 83.07326084142757,
|
4 |
+
"jsts-train": 79.61292079857638,
|
5 |
+
"avg": 81.91238236195063
|
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
|
|