ddobokki commited on
Commit
982c4df
1 Parent(s): ccc7662
1_Pooling/config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
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
+ }
README.md ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: sentence-similarity
3
+ tags:
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 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
13
+
14
+ <!--- Describe your model here -->
15
+
16
+ ## Usage (Sentence-Transformers)
17
+
18
+ Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
19
+
20
+ ```
21
+ pip install -U sentence-transformers
22
+ ```
23
+
24
+ Then you can use the model like this:
25
+
26
+ ```python
27
+ from sentence_transformers import SentenceTransformer
28
+ sentences = ["This is an example sentence", "Each sentence is converted"]
29
+
30
+ model = SentenceTransformer('{MODEL_NAME}')
31
+ embeddings = model.encode(sentences)
32
+ print(embeddings)
33
+ ```
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 -->
78
+
79
+ For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
80
+
81
+
82
+ ## Training
83
+ The model was trained with the parameters:
84
+
85
+ **DataLoader**:
86
+
87
+ `torch.utils.data.dataloader.DataLoader` of length 136 with parameters:
88
+ ```
89
+ {'batch_size': 128, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
90
+ ```
91
+
92
+ **Loss**:
93
+
94
+ `sentence_transformers.losses.CosineSimilarityLoss.CosineSimilarityLoss`
95
+
96
+ Parameters of the fit()-Method:
97
+ ```
98
+ {
99
+ "epochs": 4,
100
+ "evaluation_steps": 13,
101
+ "evaluator": "sentence_transformers.evaluation.EmbeddingSimilarityEvaluator.EmbeddingSimilarityEvaluator",
102
+ "max_grad_norm": 1,
103
+ "optimizer_class": "<class 'transformers.optimization.AdamW'>",
104
+ "optimizer_params": {
105
+ "lr": 2e-05
106
+ },
107
+ "scheduler": "WarmupLinear",
108
+ "steps_per_epoch": null,
109
+ "warmup_steps": 14,
110
+ "weight_decay": 0.01
111
+ }
112
+ ```
113
+
114
+
115
+ ## Full Model Architecture
116
+ ```
117
+ SentenceTransformer(
118
+ (0): Transformer({'max_seq_length': 64, 'do_lower_case': False}) with Transformer model: RobertaModel
119
+ (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
120
+ )
121
+ ```
122
+
123
+ ## Citing & Authors
124
+
125
+ <!--- Describe where people can find more information -->
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "2-nli",
3
+ "architectures": [
4
+ "RobertaModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "gradient_checkpointing": false,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "layer_norm_eps": 1e-05,
17
+ "max_position_embeddings": 514,
18
+ "model_type": "roberta",
19
+ "num_attention_heads": 12,
20
+ "num_hidden_layers": 12,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "tokenizer_class": "BertTokenizer",
24
+ "torch_dtype": "float32",
25
+ "transformers_version": "4.19.2",
26
+ "type_vocab_size": 1,
27
+ "use_cache": true,
28
+ "vocab_size": 32000
29
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.2.0",
4
+ "transformers": "4.19.2",
5
+ "pytorch": "1.10.1+cu111"
6
+ }
7
+ }
eval/similarity_evaluation_sts-dev_results.csv ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ epoch,steps,cosine_pearson,cosine_spearman,euclidean_pearson,euclidean_spearman,manhattan_pearson,manhattan_spearman,dot_pearson,dot_spearman
2
+ 0,13,0.840173574575316,0.838095322331488,0.8286651385659133,0.8320831116685604,0.8287316783198648,0.8320954659113529,0.8209369470153028,0.8156436890315599
3
+ 0,26,0.8371863153814791,0.8338717217514832,0.8205183077847656,0.8270253068566726,0.8206636068966722,0.8270476412143913,0.8218082025702487,0.8181354912657327
4
+ 0,39,0.8494196987075502,0.8459726869104756,0.8361844381385505,0.8411977770762317,0.8362236808273045,0.8411626083236909,0.8338617392651451,0.8285164702806552
5
+ 0,52,0.8539708021623097,0.8510609737169117,0.8440597498936332,0.8486884760958173,0.8439456941289454,0.8484418634396012,0.8353826995550104,0.8296580556012464
6
+ 0,65,0.857034797635417,0.8546809474282939,0.8471566068514274,0.852076717339059,0.8470150168083339,0.8517953831470374,0.8372326752968932,0.8319800503562287
7
+ 0,78,0.8570350198661547,0.8548685858784162,0.8478859320899844,0.8522973837631964,0.8476663072888273,0.8519467699625926,0.8360678725387414,0.8304435959976367
8
+ 0,91,0.858982605293718,0.856630837200268,0.8481207766200408,0.8524079696287328,0.8479040508241764,0.8522247232960709,0.8397536762904672,0.8345044420150022
9
+ 0,104,0.8622011175531357,0.8598668454252475,0.8512910025315441,0.8557607236653706,0.8511199333972042,0.8555213819664478,0.8428182501006237,0.8378095143717595
10
+ 0,117,0.8631322488903511,0.8609592791176339,0.8513824873225329,0.8561050283944893,0.8512353982550677,0.8558104471660098,0.843604642067139,0.8391355369435497
11
+ 0,130,0.8629620948497575,0.8612828373581486,0.852445494971362,0.8565417854615515,0.8523066016699872,0.8563477123982908,0.8427909542486722,0.8381035930381442
12
+ 0,-1,0.8649553267658603,0.8631446689809993,0.8529231278104039,0.8581811171513349,0.8527000944780232,0.8579245305141419,0.8450121761999848,0.8406888848384645
13
+ 1,13,0.8652365049435421,0.8634720008606691,0.8530556684685462,0.8594485248278001,0.8528866218151859,0.8591538922367353,0.8466106282903358,0.8426839978732009
14
+ 1,26,0.8658221870903494,0.8642291924403861,0.8555922319515743,0.8613499381091321,0.8553714096939835,0.8610881756162121,0.8471802043805328,0.8427752531033437
15
+ 1,39,0.8640849435779709,0.8631426839423925,0.8543341057098628,0.8598275566997508,0.854131783068022,0.8596191082004716,0.8455129809762828,0.8414975693957001
16
+ 1,52,0.8647356768324745,0.8635269098589013,0.8554223788000532,0.8601752457467844,0.8552987468897215,0.8599974141975133,0.8462126262361407,0.8416740431237697
17
+ 1,65,0.8655821317527608,0.8645587653166551,0.8553563714259382,0.8608527650240532,0.8551425731960431,0.8605676347407091,0.8464758247211841,0.8425899194941123
18
+ 1,78,0.8663588675931928,0.865139228039893,0.8548398829304542,0.8608589967970643,0.8546129659754933,0.8605498984016274,0.8488943602361901,0.8449484398036953
19
+ 1,91,0.8664113286502602,0.8649767609519097,0.854892738711776,0.8610412544834212,0.8546991354495329,0.8607656175535816,0.8483163864834093,0.8443587550395061
20
+ 1,104,0.8650689590005896,0.863699007220169,0.853739446844429,0.8593942020851261,0.8535766806865603,0.8590228569129204,0.8470059732599704,0.8430295060260515
21
+ 1,117,0.8665353934940071,0.8655195689879606,0.8563919180271475,0.8616608609430584,0.8562184790756451,0.8614047281033689,0.8487200126909797,0.8444767870254865
22
+ 1,130,0.8664300690737297,0.865571184540681,0.8566064812934235,0.8622698787194275,0.8564341714044499,0.8620479459290493,0.848061641921869,0.8443784753662604
23
+ 1,-1,0.8661316603825252,0.8653281863876557,0.855974355132375,0.8617937120220726,0.855819750303604,0.8615451390072588,0.8482242785732571,0.8447189993441905
24
+ 2,13,0.866747854861505,0.8661356980991812,0.8554926149864794,0.8616609175182531,0.8553039533899902,0.8614334096251158,0.8503116213796384,0.8473136176565894
25
+ 2,26,0.8671871494707486,0.8659632785633392,0.8563965476688629,0.8619833091462822,0.8561564817437395,0.8616585962291827,0.8499167311251462,0.8460167277130445
26
+ 2,39,0.86664099590433,0.8657897810986168,0.8567740626433016,0.8623064800918516,0.8565247587400275,0.8619395571787992,0.8482763772502576,0.8445900709948548
27
+ 2,52,0.8661675458410681,0.8654086897114864,0.855300918937258,0.8614137784115875,0.8550614873241764,0.8610775391535519,0.84806702154158,0.8448155550112744
28
+ 2,65,0.8667137908801402,0.8657605442941214,0.8564085235807335,0.8620745650336229,0.8561369105364691,0.8616842485299234,0.8484654533845171,0.8446590304749071
29
+ 2,78,0.8667887021729552,0.8657663258563987,0.8571590554412276,0.8620679123860784,0.8568771984862733,0.8617261439955124,0.8474590652558861,0.8429897061242195
30
+ 2,91,0.8670032031443542,0.866119463887954,0.8562101578489287,0.8619238228939545,0.85595873082041,0.8615602331273123,0.8480500913392531,0.8442938371464792
31
+ 2,104,0.8678913054991113,0.8673299130933578,0.8577133769428058,0.8635122841527879,0.8574153221304429,0.8631973618336097,0.8494425222608484,0.8458298695089989
32
+ 2,117,0.8671358053645019,0.8666280822514199,0.8574714220044806,0.8630397601923891,0.8572255231102923,0.8627128342189467,0.8486385992949529,0.8449187712290472
33
+ 2,130,0.867297914835443,0.8666708561512251,0.8576578714178784,0.86301894445677,0.8574616044121085,0.862773208687516,0.848884603769172,0.8448544738055712
34
+ 2,-1,0.8673916283148887,0.8667764112654047,0.8579334843259333,0.86316511720213,0.8577385353887954,0.8629299410955781,0.8486762921510912,0.8445438233788372
35
+ 3,13,0.8670817541775118,0.8662833196729459,0.8566175337791606,0.8623143480256884,0.8564237972397568,0.862079433503667,0.8477453118466537,0.8439407004505581
36
+ 3,26,0.8669752641067601,0.8663749262408468,0.8573202942110567,0.8627991150325515,0.8571217594075893,0.8624854125899885,0.8476216487291267,0.8436838513150303
37
+ 3,39,0.8669746477050544,0.866451197133775,0.8573929864214485,0.862911563426453,0.8571679334029205,0.8625582838901306,0.8479421142878307,0.8441425996596054
38
+ 3,52,0.8674552475904721,0.8669044335087338,0.8575009702790937,0.8631725746180012,0.8572538195675206,0.8628316715389747,0.8484784196502632,0.8448256474303713
39
+ 3,65,0.8677479322415691,0.8673093544730277,0.857652339469569,0.8633947220975304,0.8573923188441335,0.8630705676820345,0.8491329361817883,0.8455323071909955
40
+ 3,78,0.8676935016753708,0.867281290598116,0.8577173125139128,0.8634252883172676,0.8574606251272271,0.8631007502019445,0.8494149123516681,0.8458176608086381
41
+ 3,91,0.8676466999858835,0.8671367312954688,0.8575034335532818,0.8631833810083913,0.8572476403003226,0.8629042768662577,0.8491850838514424,0.845538083718587
42
+ 3,104,0.8676624020164339,0.8670982131310448,0.8574798490713721,0.8631678092802401,0.8572302117472728,0.862856464463703,0.8489483728789051,0.8452803843409546
43
+ 3,117,0.8677311985204097,0.8671904844038181,0.8574431594473895,0.8632114180015596,0.8571926674652525,0.8629112047461654,0.8489009994021832,0.8452732904358602
44
+ 3,130,0.867738471211877,0.8671813679069309,0.857403175257186,0.8631973673735163,0.8571553268250389,0.8628478010674976,0.8488687152552925,0.8452674167102061
45
+ 3,-1,0.8677407616603636,0.8671897071391101,0.8574052391314121,0.8632041920637725,0.857158187185046,0.8628517402577571,0.8488743873752991,0.8452762718553655
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:9a8a5a18745d36e491ec679dc2c8085d3da1ea71f7c2f16fdbe5cd65caf1632b
3
+ size 442541937
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 64,
3
+ "do_lower_case": false
4
+ }
similarity_evaluation_sts-dev_results.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ epoch,steps,cosine_pearson,cosine_spearman,euclidean_pearson,euclidean_spearman,manhattan_pearson,manhattan_spearman,dot_pearson,dot_spearman
2
+ -1,-1,0.8678913054991113,0.8673299130933578,0.8577133769428058,0.8635122841527879,0.8574153221304429,0.8631973618336097,0.8494425222608484,0.8458298695089989
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "[CLS]", "eos_token": "[SEP]", "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "do_basic_tokenize": true, "never_split": null, "bos_token": "[CLS]", "eos_token": "[SEP]", "model_max_length": 512, "special_tokens_map_file": "/home/cleaning/.cache/huggingface/transformers/9d0c87e44b00acfbfbae931b2e4068eb6311a0c3e71e23e5400bdf57cab4bfbf.70c17d6e4d492c8f24f5bb97ab56c7f272e947112c6faf9dd846da42ba13eb23", "name_or_path": "2-nli", "tokenizer_class": "BertTokenizer"}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff