ighina commited on
Commit
ed1d70d
·
1 Parent(s): c3c64a8

Upload 13 files

Browse files
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 CHANGED
@@ -1,3 +1,122 @@
1
  ---
2
- license: cc-by-3.0
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ def cls_pooling(model_output, attention_mask):
46
+ return model_output[0][:,0]
47
+
48
+
49
+ # Sentences we want sentence embeddings for
50
+ sentences = ['This is an example sentence', 'Each sentence is converted']
51
+
52
+ # Load model from HuggingFace Hub
53
+ tokenizer = AutoTokenizer.from_pretrained('{MODEL_NAME}')
54
+ model = AutoModel.from_pretrained('{MODEL_NAME}')
55
+
56
+ # Tokenize sentences
57
+ encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
58
+
59
+ # Compute token embeddings
60
+ with torch.no_grad():
61
+ model_output = model(**encoded_input)
62
+
63
+ # Perform pooling. In this case, cls pooling.
64
+ sentence_embeddings = cls_pooling(model_output, encoded_input['attention_mask'])
65
+
66
+ print("Sentence embeddings:")
67
+ print(sentence_embeddings)
68
+ ```
69
+
70
+
71
+
72
+ ## Evaluation Results
73
+
74
+ <!--- Describe how your model was evaluated -->
75
+
76
+ For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
77
+
78
+
79
+ ## Training
80
+ The model was trained with the parameters:
81
+
82
+ **DataLoader**:
83
+
84
+ `torch.utils.data.dataloader.DataLoader` of length 666 with parameters:
85
+ ```
86
+ {'batch_size': 128, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
87
+ ```
88
+
89
+ **Loss**:
90
+
91
+ `sentence_transformers.losses.CosineSimilarityLoss.CosineSimilarityLoss`
92
+
93
+ Parameters of the fit()-Method:
94
+ ```
95
+ {
96
+ "epochs": 10,
97
+ "evaluation_steps": 0,
98
+ "evaluator": "sentence_transformers.evaluation.BinaryClassificationEvaluator.BinaryClassificationEvaluator",
99
+ "max_grad_norm": 1,
100
+ "optimizer_class": "<class 'transformers.optimization.AdamW'>",
101
+ "optimizer_params": {
102
+ "lr": 2e-05
103
+ },
104
+ "scheduler": "WarmupLinear",
105
+ "steps_per_epoch": null,
106
+ "warmup_steps": 10000,
107
+ "weight_decay": 0.01
108
+ }
109
+ ```
110
+
111
+
112
+ ## Full Model Architecture
113
+ ```
114
+ SentenceTransformer(
115
+ (0): Transformer({'max_seq_length': 32, 'do_lower_case': False}) with Transformer model: RobertaModel
116
+ (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})
117
+ )
118
+ ```
119
+
120
+ ## Citing & Authors
121
+
122
+ <!--- Describe where people can find more information -->
config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "roberta-base",
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
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 768,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_norm_eps": 1e-05,
16
+ "max_position_embeddings": 514,
17
+ "model_type": "roberta",
18
+ "num_attention_heads": 12,
19
+ "num_hidden_layers": 12,
20
+ "pad_token_id": 1,
21
+ "position_embedding_type": "absolute",
22
+ "torch_dtype": "float32",
23
+ "transformers_version": "4.18.0",
24
+ "type_vocab_size": 1,
25
+ "use_cache": true,
26
+ "vocab_size": 50265
27
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.2.0",
4
+ "transformers": "4.18.0",
5
+ "pytorch": "1.11.0"
6
+ }
7
+ }
eval/binary_classification_evaluation_Valid_Topic_Boundaries_results.csv ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ epoch,steps,cossim_accuracy,cossim_accuracy_threshold,cossim_f1,cossim_precision,cossim_recall,cossim_f1_threshold,cossim_ap,manhatten_accuracy,manhatten_accuracy_threshold,manhatten_f1,manhatten_precision,manhatten_recall,manhatten_f1_threshold,manhatten_ap,euclidean_accuracy,euclidean_accuracy_threshold,euclidean_f1,euclidean_precision,euclidean_recall,euclidean_f1_threshold,euclidean_ap,dot_accuracy,dot_accuracy_threshold,dot_f1,dot_precision,dot_recall,dot_f1_threshold,dot_ap
2
+ 0,-1,0.5050505050505051,0.6721808910369873,0.6677908937605397,0.5012658227848101,1.0,0.5831294059753418,0.4180147658699511,0.5,230.74822998046875,0.6644182124789207,0.49873417721518987,0.9949494949494949,276.46044921875,0.41813654848739434,0.5,10.529297828674316,0.6644182124789207,0.49873417721518987,0.9949494949494949,12.651668548583984,0.41718422530513094,0.5126262626262627,101.920654296875,0.6689536878216122,0.5064935064935064,0.9848484848484849,101.920654296875,0.42864075218430864
3
+ 1,-1,0.5277777777777778,0.7455332279205322,0.6677908937605397,0.5012658227848101,1.0,0.6393734216690063,0.4301777071519864,0.5227272727272727,304.761474609375,0.669001751313485,0.5120643431635389,0.9646464646464646,304.761474609375,0.4294415545198942,0.5202020202020202,13.562492370605469,0.6678023850085179,0.5038560411311054,0.98989898989899,14.840049743652344,0.42965376120265525,0.5252525252525253,244.0501708984375,0.6690140845070423,0.5135135135135135,0.9595959595959596,244.0501708984375,0.4485591841285754
4
+ 2,-1,0.5252525252525253,0.5830798149108887,0.6655405405405406,0.5,0.9949494949494949,0.13964873552322388,0.43569629139747384,0.5202020202020202,468.176025390625,0.6666666666666667,0.5052083333333334,0.9797979797979798,541.4262084960938,0.43538784661469143,0.5202020202020202,21.654991149902344,0.6666666666666665,0.5065616797900262,0.9747474747474747,24.71056365966797,0.43578579261255873,0.5227272727272727,230.44944763183594,0.6666666666666667,0.5052083333333334,0.9797979797979798,102.87812042236328,0.44069860594961124
5
+ 3,-1,0.5151515151515151,0.4091978371143341,0.6678023850085179,0.5038560411311054,0.98989898989899,-0.01761770248413086,0.4380277205571407,0.5176767676767676,459.4472961425781,0.6655052264808362,0.5079787234042553,0.9646464646464646,543.1044921875,0.4380960706552328,0.5176767676767676,24.560546875,0.6689189189189189,0.5025380710659898,1.0,26.472187042236328,0.43783542277166554,0.5151515151515151,163.73785400390625,0.6678023850085179,0.5038560411311054,0.98989898989899,-5.370697021484375,0.44176574284550346
6
+ 4,-1,0.5126262626262627,-0.025229811668395996,0.67008547008547,0.5064599483204134,0.98989898989899,-0.025229811668395996,0.43649746771041303,0.5126262626262627,548.0025634765625,0.6677966101694915,0.5025510204081632,0.9949494949494949,599.7081909179688,0.43656370111441356,0.5126262626262627,25.20560073852539,0.6678023850085179,0.5038560411311054,0.98989898989899,27.135974884033203,0.4368280123714071,0.5126262626262627,-8.54666519165039,0.67008547008547,0.5064599483204134,0.98989898989899,-8.54666519165039,0.4461383894828951
7
+ 5,-1,0.5252525252525253,0.7190001010894775,0.6701030927835051,0.5078125,0.9848484848484849,-0.13273566961288452,0.44104127415971517,0.5252525252525253,342.42987060546875,0.6666666666666666,0.5012722646310432,0.9949494949494949,640.6392211914062,0.4408085200037991,0.5252525252525253,15.885638236999512,0.6666666666666666,0.510752688172043,0.9595959595959596,27.103885650634766,0.44174384933413396,0.5176767676767676,-25.043354034423828,0.6701030927835051,0.5078125,0.9848484848484849,-43.96415328979492,0.4543886102448854
8
+ 6,-1,0.5151515151515151,0.18982887268066406,0.6666666666666666,0.5038759689922481,0.9848484848484849,-0.04028373956680298,0.43479033071581386,0.5176767676767676,452.73236083984375,0.673469387755102,0.5076923076923077,1.0,576.8349609375,0.4344446278541142,0.5151515151515151,20.47252655029297,0.673469387755102,0.5076923076923077,1.0,26.367206573486328,0.43419308194856754,0.5151515151515151,128.68301391601562,0.6666666666666666,0.5038759689922481,0.9848484848484849,-12.691802978515625,0.45350760218296393
9
+ 7,-1,0.5151515151515151,0.11680039763450623,0.6689303904923599,0.5038363171355499,0.9949494949494949,0.026958703994750977,0.44193924699322185,0.5176767676767676,462.29180908203125,0.6677908937605397,0.5012658227848101,1.0,559.0025024414062,0.4411904989221734,0.5176767676767676,20.996599197387695,0.6677908937605397,0.5012658227848101,1.0,25.978601455688477,0.4410761744043554,0.5151515151515151,395.0692138671875,0.6689303904923599,0.5038363171355499,0.9949494949494949,8.918832778930664,0.4627600698670268
10
+ 8,-1,0.5252525252525253,-0.020656108856201172,0.6689303904923599,0.5038363171355499,0.9949494949494949,-0.14346981048583984,0.443406783383298,0.5252525252525253,519.9654541015625,0.6712328767123288,0.5077720207253886,0.98989898989899,609.012939453125,0.443243044260339,0.5227272727272727,24.158693313598633,0.6723549488054608,0.5077319587628866,0.9949494949494949,28.680400848388672,0.44288336003859374,0.5252525252525253,-5.8561296463012695,0.6689303904923599,0.5038363171355499,0.9949494949494949,-50.80672073364258,0.4610790665470641
11
+ 9,-1,0.5176767676767676,0.19759947061538696,0.6701208981001727,0.5091863517060368,0.9797979797979798,0.025225400924682617,0.4393570321588329,0.5202020202020202,241.9036407470703,0.6678082191780822,0.5051813471502591,0.9848484848484849,462.50103759765625,0.4380265174858601,0.5202020202020202,8.506769180297852,0.6678082191780822,0.5051813471502591,0.9848484848484849,21.629793167114258,0.43810709406473125,0.5151515151515151,47.508731842041016,0.6689655172413793,0.5078534031413613,0.9797979797979798,3.999281406402588,0.49236699640229314
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
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:d8acec86806dc55ff22201b1db163c8ec807fe9e96df78b9c57d3f6824bd8514
3
+ size 498652017
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 32,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": false}}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"errors": "replace", "bos_token": "<s>", "eos_token": "</s>", "sep_token": "</s>", "cls_token": "<s>", "unk_token": "<unk>", "pad_token": "<pad>", "mask_token": "<mask>", "add_prefix_space": false, "trim_offsets": true, "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "roberta-base", "tokenizer_class": "RobertaTokenizer"}
vocab.json ADDED
The diff for this file is too large to render. See raw diff