Upload 12 files
Browse files- 1_Pooling/config.json +2 -2
- README.md +45 -6
- config.json +1 -1
- eval/mse_evaluation_TED2020-en-fr-dev.tsv.gz_results.csv +7 -54
- eval/translation_evaluation_TED2020-en-fr-dev.tsv.gz_results.csv +7 -54
- modules.json +2 -2
- pytorch_model.bin +1 -1
- tokenizer_config.json +1 -1
1_Pooling/config.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
{
|
2 |
"word_embedding_dimension": 1024,
|
3 |
"pooling_mode_cls_token": false,
|
4 |
-
"pooling_mode_mean_tokens":
|
5 |
"pooling_mode_max_tokens": false,
|
6 |
"pooling_mode_mean_sqrt_len_tokens": false,
|
7 |
-
"pooling_mode_weightedmean_tokens":
|
8 |
"pooling_mode_lasttoken": false
|
9 |
}
|
|
|
1 |
{
|
2 |
"word_embedding_dimension": 1024,
|
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 |
+
"pooling_mode_weightedmean_tokens": false,
|
8 |
"pooling_mode_lasttoken": false
|
9 |
}
|
README.md
CHANGED
@@ -4,11 +4,12 @@ tags:
|
|
4 |
- sentence-transformers
|
5 |
- feature-extraction
|
6 |
- sentence-similarity
|
|
|
7 |
---
|
8 |
|
9 |
# {MODEL_NAME}
|
10 |
|
11 |
-
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a
|
12 |
|
13 |
<!--- Describe your model here -->
|
14 |
|
@@ -33,6 +34,44 @@ print(embeddings)
|
|
33 |
|
34 |
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
## Evaluation Results
|
37 |
|
38 |
<!--- Describe how your model was evaluated -->
|
@@ -45,7 +84,7 @@ The model was trained with the parameters:
|
|
45 |
|
46 |
**DataLoader**:
|
47 |
|
48 |
-
`torch.utils.data.dataloader.DataLoader` of length
|
49 |
```
|
50 |
{'batch_size': 16, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
51 |
```
|
@@ -57,8 +96,8 @@ The model was trained with the parameters:
|
|
57 |
Parameters of the fit()-Method:
|
58 |
```
|
59 |
{
|
60 |
-
"epochs":
|
61 |
-
"evaluation_steps":
|
62 |
"evaluator": "sentence_transformers.evaluation.SequentialEvaluator.SequentialEvaluator",
|
63 |
"max_grad_norm": 1,
|
64 |
"optimizer_class": "<class 'transformers.optimization.AdamW'>",
|
@@ -69,7 +108,7 @@ Parameters of the fit()-Method:
|
|
69 |
},
|
70 |
"scheduler": "WarmupLinear",
|
71 |
"steps_per_epoch": null,
|
72 |
-
"warmup_steps":
|
73 |
"weight_decay": 0.01
|
74 |
}
|
75 |
```
|
@@ -79,7 +118,7 @@ Parameters of the fit()-Method:
|
|
79 |
```
|
80 |
SentenceTransformer(
|
81 |
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: BloomModel
|
82 |
-
(1):
|
83 |
)
|
84 |
```
|
85 |
|
|
|
4 |
- sentence-transformers
|
5 |
- feature-extraction
|
6 |
- sentence-similarity
|
7 |
+
- transformers
|
8 |
---
|
9 |
|
10 |
# {MODEL_NAME}
|
11 |
|
12 |
+
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.
|
13 |
|
14 |
<!--- Describe your model here -->
|
15 |
|
|
|
34 |
|
35 |
|
36 |
|
37 |
+
## Usage (HuggingFace Transformers)
|
38 |
+
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.
|
39 |
+
|
40 |
+
```python
|
41 |
+
from transformers import AutoTokenizer, AutoModel
|
42 |
+
import torch
|
43 |
+
|
44 |
+
|
45 |
+
#Mean Pooling - Take attention mask into account for correct averaging
|
46 |
+
def mean_pooling(model_output, attention_mask):
|
47 |
+
token_embeddings = model_output[0] #First element of model_output contains all token embeddings
|
48 |
+
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
|
49 |
+
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
|
50 |
+
|
51 |
+
|
52 |
+
# Sentences we want sentence embeddings for
|
53 |
+
sentences = ['This is an example sentence', 'Each sentence is converted']
|
54 |
+
|
55 |
+
# Load model from HuggingFace Hub
|
56 |
+
tokenizer = AutoTokenizer.from_pretrained('{MODEL_NAME}')
|
57 |
+
model = AutoModel.from_pretrained('{MODEL_NAME}')
|
58 |
+
|
59 |
+
# Tokenize sentences
|
60 |
+
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
61 |
+
|
62 |
+
# Compute token embeddings
|
63 |
+
with torch.no_grad():
|
64 |
+
model_output = model(**encoded_input)
|
65 |
+
|
66 |
+
# Perform pooling. In this case, mean pooling.
|
67 |
+
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
|
68 |
+
|
69 |
+
print("Sentence embeddings:")
|
70 |
+
print(sentence_embeddings)
|
71 |
+
```
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
## Evaluation Results
|
76 |
|
77 |
<!--- Describe how your model was evaluated -->
|
|
|
84 |
|
85 |
**DataLoader**:
|
86 |
|
87 |
+
`torch.utils.data.dataloader.DataLoader` of length 3074 with parameters:
|
88 |
```
|
89 |
{'batch_size': 16, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
90 |
```
|
|
|
96 |
Parameters of the fit()-Method:
|
97 |
```
|
98 |
{
|
99 |
+
"epochs": 1,
|
100 |
+
"evaluation_steps": 500,
|
101 |
"evaluator": "sentence_transformers.evaluation.SequentialEvaluator.SequentialEvaluator",
|
102 |
"max_grad_norm": 1,
|
103 |
"optimizer_class": "<class 'transformers.optimization.AdamW'>",
|
|
|
108 |
},
|
109 |
"scheduler": "WarmupLinear",
|
110 |
"steps_per_epoch": null,
|
111 |
+
"warmup_steps": 1000,
|
112 |
"weight_decay": 0.01
|
113 |
}
|
114 |
```
|
|
|
118 |
```
|
119 |
SentenceTransformer(
|
120 |
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: BloomModel
|
121 |
+
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False})
|
122 |
)
|
123 |
```
|
124 |
|
config.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "
|
3 |
"apply_residual_connection_post_layernorm": false,
|
4 |
"architectures": [
|
5 |
"BloomModel"
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "output/make-multilingual-sys-2023-02-02_16-23-11",
|
3 |
"apply_residual_connection_post_layernorm": false,
|
4 |
"architectures": [
|
5 |
"BloomModel"
|
eval/mse_evaluation_TED2020-en-fr-dev.tsv.gz_results.csv
CHANGED
@@ -1,55 +1,8 @@
|
|
1 |
epoch,steps,MSE
|
2 |
-
0,
|
3 |
-
0,
|
4 |
-
0,
|
5 |
-
0,
|
6 |
-
0,
|
7 |
-
0,
|
8 |
-
0,
|
9 |
-
0,8000,1277.3436546325684
|
10 |
-
0,9000,1263.1890296936035
|
11 |
-
0,10000,1308.1955909729004
|
12 |
-
0,11000,1283.3735466003418
|
13 |
-
0,12000,1262.7530097961426
|
14 |
-
0,13000,1260.5589866638184
|
15 |
-
0,14000,1253.4588813781738
|
16 |
-
0,15000,1239.389419555664
|
17 |
-
0,16000,1284.862232208252
|
18 |
-
0,17000,1215.8602714538574
|
19 |
-
0,18000,1208.6514472961426
|
20 |
-
0,19000,1207.7702522277832
|
21 |
-
0,20000,1203.3350944519043
|
22 |
-
0,21000,1202.7355194091797
|
23 |
-
0,22000,1193.0546760559082
|
24 |
-
0,23000,1168.9787864685059
|
25 |
-
0,24000,1169.53125
|
26 |
-
0,25000,1167.289161682129
|
27 |
-
0,26000,1183.1158638000488
|
28 |
-
0,27000,1167.3190116882324
|
29 |
-
0,28000,1135.9935760498047
|
30 |
-
0,29000,1140.6807899475098
|
31 |
-
0,30000,1136.8371963500977
|
32 |
-
0,-1,1127.4292945861816
|
33 |
-
1,31000,1103.3071517944336
|
34 |
-
1,32000,1101.201057434082
|
35 |
-
1,33000,1093.484878540039
|
36 |
-
1,34000,1085.3593826293945
|
37 |
-
1,35000,1087.46919631958
|
38 |
-
1,36000,1088.6981964111328
|
39 |
-
1,37000,1085.8448028564453
|
40 |
-
1,38000,1079.0802955627441
|
41 |
-
1,39000,1078.3958435058594
|
42 |
-
1,40000,1067.711067199707
|
43 |
-
1,41000,1070.4686164855957
|
44 |
-
1,42000,1062.2697830200195
|
45 |
-
1,43000,1062.1541023254395
|
46 |
-
1,44000,1061.3683700561523
|
47 |
-
1,45000,1068.0513381958008
|
48 |
-
1,46000,1060.914134979248
|
49 |
-
1,47000,1047.8565216064453
|
50 |
-
1,48000,1049.0880012512207
|
51 |
-
1,49000,1041.7594909667969
|
52 |
-
1,50000,1047.9501724243164
|
53 |
-
1,51000,1041.0179138183594
|
54 |
-
1,52000,1047.9998588562012
|
55 |
-
1,53000,1035.096263885498
|
|
|
1 |
epoch,steps,MSE
|
2 |
+
0,500,1047.9930877685547
|
3 |
+
0,1000,1094.466781616211
|
4 |
+
0,1500,1080.2101135253906
|
5 |
+
0,2000,1067.1212196350098
|
6 |
+
0,2500,1034.5897674560547
|
7 |
+
0,3000,1019.6515083312988
|
8 |
+
0,-1,1017.3401832580566
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eval/translation_evaluation_TED2020-en-fr-dev.tsv.gz_results.csv
CHANGED
@@ -1,55 +1,8 @@
|
|
1 |
epoch,steps,src2trg,trg2src
|
2 |
-
0,
|
3 |
-
0,
|
4 |
-
0,
|
5 |
-
0,
|
6 |
-
0,
|
7 |
-
0,
|
8 |
-
0,
|
9 |
-
0,8000,0.968,0.966
|
10 |
-
0,9000,0.974,0.964
|
11 |
-
0,10000,0.969,0.96
|
12 |
-
0,11000,0.972,0.965
|
13 |
-
0,12000,0.969,0.956
|
14 |
-
0,13000,0.962,0.957
|
15 |
-
0,14000,0.97,0.963
|
16 |
-
0,15000,0.969,0.967
|
17 |
-
0,16000,0.967,0.959
|
18 |
-
0,17000,0.971,0.962
|
19 |
-
0,18000,0.97,0.964
|
20 |
-
0,19000,0.965,0.962
|
21 |
-
0,20000,0.968,0.965
|
22 |
-
0,21000,0.972,0.967
|
23 |
-
0,22000,0.968,0.965
|
24 |
-
0,23000,0.972,0.966
|
25 |
-
0,24000,0.967,0.957
|
26 |
-
0,25000,0.972,0.961
|
27 |
-
0,26000,0.97,0.959
|
28 |
-
0,27000,0.969,0.962
|
29 |
-
0,28000,0.967,0.968
|
30 |
-
0,29000,0.968,0.963
|
31 |
-
0,30000,0.969,0.965
|
32 |
-
0,-1,0.968,0.961
|
33 |
-
1,31000,0.968,0.964
|
34 |
-
1,32000,0.969,0.967
|
35 |
-
1,33000,0.971,0.966
|
36 |
-
1,34000,0.972,0.965
|
37 |
-
1,35000,0.973,0.968
|
38 |
-
1,36000,0.973,0.97
|
39 |
-
1,37000,0.973,0.966
|
40 |
-
1,38000,0.971,0.967
|
41 |
-
1,39000,0.972,0.969
|
42 |
-
1,40000,0.973,0.967
|
43 |
-
1,41000,0.972,0.967
|
44 |
-
1,42000,0.97,0.967
|
45 |
-
1,43000,0.968,0.967
|
46 |
-
1,44000,0.97,0.96
|
47 |
-
1,45000,0.969,0.965
|
48 |
-
1,46000,0.972,0.964
|
49 |
-
1,47000,0.97,0.967
|
50 |
-
1,48000,0.972,0.965
|
51 |
-
1,49000,0.971,0.969
|
52 |
-
1,50000,0.973,0.969
|
53 |
-
1,51000,0.971,0.969
|
54 |
-
1,52000,0.973,0.967
|
55 |
-
1,53000,0.972,0.967
|
|
|
1 |
epoch,steps,src2trg,trg2src
|
2 |
+
0,500,0.972,0.966
|
3 |
+
0,1000,0.971,0.97
|
4 |
+
0,1500,0.97,0.967
|
5 |
+
0,2000,0.968,0.964
|
6 |
+
0,2500,0.964,0.964
|
7 |
+
0,3000,0.968,0.962
|
8 |
+
0,-1,0.968,0.963
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules.json
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
{
|
9 |
"idx": 1,
|
10 |
"name": "1",
|
11 |
-
"path": "
|
12 |
-
"type": "sentence_transformers.models.
|
13 |
}
|
14 |
]
|
|
|
8 |
{
|
9 |
"idx": 1,
|
10 |
"name": "1",
|
11 |
+
"path": "1_Pooling",
|
12 |
+
"type": "sentence_transformers.models.Pooling"
|
13 |
}
|
14 |
]
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 2236953889
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2cf41e3b230fd7cc8cf0b7223177864d8dcdcd20a199f7243ef86b563b884e8f
|
3 |
size 2236953889
|
tokenizer_config.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
"bos_token": "<s>",
|
4 |
"eos_token": "</s>",
|
5 |
"model_max_length": 1000000000000000019884624838656,
|
6 |
-
"name_or_path": "
|
7 |
"pad_token": "<pad>",
|
8 |
"padding_side": "left",
|
9 |
"special_tokens_map_file": null,
|
|
|
3 |
"bos_token": "<s>",
|
4 |
"eos_token": "</s>",
|
5 |
"model_max_length": 1000000000000000019884624838656,
|
6 |
+
"name_or_path": "output/make-multilingual-sys-2023-02-02_16-23-11",
|
7 |
"pad_token": "<pad>",
|
8 |
"padding_side": "left",
|
9 |
"special_tokens_map_file": null,
|