ighina commited on
Commit
1629104
1 Parent(s): 2e48513

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-nc-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 4606 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.5659107016300496,-0.6686546206474304,0.666981800992673,0.500354609929078,1.0,-0.9341346025466919,0.5446500611927798,0.5714032600992204,554.6317749023438,0.671988388969521,0.5100991553433712,0.9844082211197732,678.4400634765625,0.5736193076124381,0.5605953224663359,32.92254638671875,0.6669029894836346,0.5002659102995922,1.0,39.592018127441406,0.5456958977256563,0.5659107016300496,-221.24856567382812,0.6668242524524288,0.5002660046107466,0.9996456413890857,-357.8712158203125,0.5428045754967663
3
+ 1,-1,0.5566973777462793,-0.6645435094833374,0.671627460393663,0.5078039927404718,0.9914953933380581,-0.8910321593284607,0.5672812901309461,0.5797306874557052,592.9730834960938,0.6691647528103468,0.5077967345441203,0.9808646350106307,665.9468994140625,0.593597203103118,0.5427002126151665,29.355512619018555,0.6666666666666666,0.5000886367665307,0.9996456413890857,38.558555603027344,0.5607687398360608,0.5496102055279943,-241.33578491210938,0.6676276276276276,0.504997274214065,0.9847625797306875,-308.189208984375,0.5646671147104413
4
+ 2,-1,0.5675053153791637,-0.5427221059799194,0.6735738664066308,0.5133779264214047,0.9790928419560595,-0.8839776515960693,0.5656458174973282,0.5590007087172219,592.638916015625,0.6807833537331701,0.5200074794315632,0.9854712969525159,630.5596313476562,0.5695937409906966,0.5384479092841956,21.428802490234375,0.6678048780487805,0.5091111937523243,0.9702338766832034,36.24639129638672,0.550923871782314,0.556343019135365,-225.4939422607422,0.6768856447688565,0.5153760652093368,0.9858256555634302,-288.78167724609375,0.5629060738546662
5
+ 3,-1,0.5687455705173635,-0.6343153715133667,0.6769080712021459,0.5159851301115241,0.9836995038979447,-0.8767246603965759,0.5640362927499809,0.5545712260807938,559.5557250976562,0.6791671739924511,0.517343721016509,0.9883061658398299,614.196533203125,0.565253521073003,0.5386250885896527,27.961509704589844,0.6675349277764623,0.5012446657183499,0.9989369241672572,36.62339782714844,0.5468354131040102,0.5561658398299079,-210.171875,0.6769192298074519,0.5229907264296755,0.9592487597448618,-262.146484375,0.5608718023878443
6
+ 4,-1,0.5644932671863926,-0.7109887599945068,0.6789505796217206,0.5177740554624977,0.9858256555634302,-0.8839871883392334,0.5634706487611837,0.5552799433026222,506.94378662109375,0.6796999877044142,0.520429297684052,0.9794472005669738,557.572509765625,0.5664915981519962,0.5377391920623671,32.85962677001953,0.6736462093862816,0.5100218658892128,0.9918497519489724,35.07088851928711,0.5454788515677766,0.5552799433026222,-204.6407470703125,0.6776052104208417,0.5240216970166602,0.9585400425230333,-247.803955078125,0.5592167506487625
7
+ 5,-1,0.5630758327427356,-0.7119669318199158,0.6736765772298768,0.5111885546588408,0.9875974486180015,-0.8984476923942566,0.560269045272406,0.5614812189936216,403.95635986328125,0.6809357889497263,0.5247410817031071,0.969525159461375,499.15191650390625,0.5670963457011828,0.5377391920623671,30.92110252380371,0.6702496118476053,0.5054945054945055,0.9943302622253721,33.7685546875,0.5445519322133844,0.5600637845499645,-176.61325073242188,0.6753870154806193,0.5106151333696244,0.997165131112686,-248.7664031982422,0.5607022192122023
8
+ 6,-1,0.5652019844082211,-0.7176129221916199,0.6740947075208913,0.5120515179392824,0.9861800141743444,-0.9070214033126831,0.5609452452303537,0.5527994330262226,461.8663330078125,0.680982352215229,0.5224389320204507,0.9776754075124026,499.11627197265625,0.5633489085665988,0.5352586817859674,23.152297973632812,0.67265226886678,0.5114391143911439,0.9822820694542878,32.897403717041016,0.544441497071623,0.5503189227498229,-194.8746337890625,0.6761548667229526,0.5125251417078076,0.9932671863926293,-239.06666564941406,0.5618864624331712
9
+ 7,-1,0.5584691708008505,-0.7199252247810364,0.6727272727272726,0.5112380250552689,0.9833451452870304,-0.9231226444244385,0.5583668403280241,0.5597094259390503,411.75408935546875,0.6818354190367842,0.5299665946158381,0.9557051736357194,440.1401062011719,0.5604679319419067,0.5350815024805102,30.50345230102539,0.6726446676231467,0.5075784915193071,0.9968107725017717,32.867401123046875,0.5428254410520476,0.5478384124734231,-180.131591796875,0.6750030058915474,0.510828025477707,0.9946846208362863,-233.63894653320312,0.5593979028405777
10
+ 8,-1,0.56218993621545,-0.7214729189872742,0.6718544235603975,0.5073223648526487,0.9943302622253721,-0.933113157749176,0.5552267345464037,0.5522678951098512,436.1517028808594,0.6818409204602301,0.5268650947042907,0.9659815733522324,454.7770690917969,0.5558508636302701,0.5331325301204819,23.592975616455078,0.673398244981368,0.5095506639985447,0.9925584691708008,32.856590270996094,0.5387306896194584,0.5494330262225372,-181.05267333984375,0.6755158682273439,0.5121683440073193,0.9918497519489724,-231.68380737304688,0.5560685446522544
11
+ 9,-1,0.5616583982990787,-0.714284360408783,0.6714645555955379,0.5075249320036265,0.9918497519489724,-0.9334131479263306,0.5553396983321912,0.5529766123316796,415.49835205078125,0.6800844825444156,0.5236273196862445,0.9698795180722891,455.8302001953125,0.5573477995247809,0.531715095676825,23.39046859741211,0.6738947114805446,0.510494615805804,0.9911410347271439,32.32262420654297,0.5394646680848874,0.5474840538625089,-178.5483856201172,0.6753434562545191,0.5116873630387144,0.9929128277817151,-228.9132537841797,0.5566476167676327
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:ec70b241fa802b45b3b5377a29508cf664cf1aa9a097eb56e0f0952f2b19cedf
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