carinnew commited on
Commit
4725e0e
·
verified ·
1 Parent(s): 9be4319

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ vocab.txt filter=lfs diff=lfs merge=lfs -text
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 ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: sentence-similarity
3
+ tags:
4
+ - sentence-transformers
5
+ - feature-extraction
6
+ - sentence-similarity
7
+ - transformers
8
+
9
+ ---
10
+
11
+ # {MODEL_NAME}
12
+
13
+ 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.
14
+
15
+ <!--- Describe your model here -->
16
+
17
+ ## Usage (Sentence-Transformers)
18
+
19
+ Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
20
+
21
+ ```
22
+ pip install -U sentence-transformers
23
+ ```
24
+
25
+ Then you can use the model like this:
26
+
27
+ ```python
28
+ from sentence_transformers import SentenceTransformer
29
+ sentences = ["This is an example sentence", "Each sentence is converted"]
30
+
31
+ model = SentenceTransformer('{MODEL_NAME}')
32
+ embeddings = model.encode(sentences)
33
+ print(embeddings)
34
+ ```
35
+
36
+
37
+
38
+ ## Usage (HuggingFace Transformers)
39
+ 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.
40
+
41
+ ```python
42
+ from transformers import AutoTokenizer, AutoModel
43
+ import torch
44
+
45
+
46
+ def cls_pooling(model_output, attention_mask):
47
+ return model_output[0][:,0]
48
+
49
+
50
+ # Sentences we want sentence embeddings for
51
+ sentences = ['This is an example sentence', 'Each sentence is converted']
52
+
53
+ # Load model from HuggingFace Hub
54
+ tokenizer = AutoTokenizer.from_pretrained('{MODEL_NAME}')
55
+ model = AutoModel.from_pretrained('{MODEL_NAME}')
56
+
57
+ # Tokenize sentences
58
+ encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
59
+
60
+ # Compute token embeddings
61
+ with torch.no_grad():
62
+ model_output = model(**encoded_input)
63
+
64
+ # Perform pooling. In this case, cls pooling.
65
+ sentence_embeddings = cls_pooling(model_output, encoded_input['attention_mask'])
66
+
67
+ print("Sentence embeddings:")
68
+ print(sentence_embeddings)
69
+ ```
70
+
71
+
72
+
73
+ ## Evaluation Results
74
+
75
+ <!--- Describe how your model was evaluated -->
76
+
77
+ For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
78
+
79
+
80
+ ## Training
81
+ The model was trained with the parameters:
82
+
83
+ **DataLoader**:
84
+
85
+ `torch.utils.data.dataloader.DataLoader` of length 1229 with parameters:
86
+ ```
87
+ {'batch_size': 16, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
88
+ ```
89
+
90
+ **Loss**:
91
+
92
+ `sentence_transformers.losses.TripletLoss.TripletLoss` with parameters:
93
+ ```
94
+ {'distance_metric': 'TripletDistanceMetric.EUCLIDEAN', 'triplet_margin': 5}
95
+ ```
96
+
97
+ Parameters of the fit()-Method:
98
+ ```
99
+ {
100
+ "epochs": 3,
101
+ "evaluation_steps": 500,
102
+ "evaluator": "sentence_transformers.evaluation.BinaryClassificationEvaluator.BinaryClassificationEvaluator",
103
+ "max_grad_norm": 1,
104
+ "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
105
+ "optimizer_params": {
106
+ "lr": 3e-05
107
+ },
108
+ "scheduler": "WarmupLinear",
109
+ "steps_per_epoch": null,
110
+ "warmup_steps": 50,
111
+ "weight_decay": 0.01
112
+ }
113
+ ```
114
+
115
+
116
+ ## Full Model Architecture
117
+ ```
118
+ SentenceTransformer(
119
+ (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
120
+ (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})
121
+ )
122
+ ```
123
+
124
+ ## Citing & Authors
125
+
126
+ <!--- Describe where people can find more information -->
config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "dicta-il/dictabert",
3
+ "architectures": [
4
+ "BertModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "newmodern": true,
18
+ "num_attention_heads": 12,
19
+ "num_hidden_layers": 12,
20
+ "pad_token_id": 0,
21
+ "position_embedding_type": "absolute",
22
+ "torch_dtype": "float32",
23
+ "transformers_version": "4.36.2",
24
+ "type_vocab_size": 2,
25
+ "use_cache": true,
26
+ "vocab_size": 128000
27
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.2.2",
4
+ "transformers": "4.36.2",
5
+ "pytorch": "2.1.2+cu121"
6
+ }
7
+ }
epoch_losses.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"log_history": [{"epoch": 0, "loss": 0.5552091079576894}, {"epoch": 1, "loss": 0.14668889793562054}, {"epoch": 2, "loss": 0.03926950940472795}]}
eval/binary_classification_evaluation_results.csv ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ epoch,steps,cossim_accuracy,cossim_accuracy_threshold,cossim_f1,cossim_precision,cossim_recall,cossim_f1_threshold,cossim_ap,manhattan_accuracy,manhattan_accuracy_threshold,manhattan_f1,manhattan_precision,manhattan_recall,manhattan_f1_threshold,manhattan_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,500,0.9357277882797732,0.5196293592453003,0.9356060606060606,0.9285714285714286,0.9427480916030534,0.5196293592453003,0.9742855284077233,0.9357277882797732,343.64703369140625,0.9354838709677419,0.930188679245283,0.9408396946564885,348.995361328125,0.9764954223498737,0.9357277882797732,16.496044158935547,0.9356060606060606,0.9285714285714286,0.9427480916030534,16.496044158935547,0.976002940633654,0.9310018903591682,144.704345703125,0.9313264346190029,0.9183673469387755,0.9446564885496184,144.704345703125,0.9657047063732095
3
+ 0,1000,0.9328922495274102,0.4960457980632782,0.9334582942830365,0.9171270718232044,0.950381679389313,0.4960457980632782,0.9775104352100861,0.9347826086956522,352.5271911621094,0.9355742296918768,0.9159049360146252,0.9561068702290076,364.15960693359375,0.9798455746293088,0.9385633270321361,17.329761505126953,0.9390815370196813,0.9226519337016574,0.9561068702290076,17.329761505126953,0.9795656100996063,0.9262759924385633,145.15023803710938,0.9273229070837167,0.8952042628774423,0.9618320610687023,134.46905517578125,0.9704276692608728
4
+ 0,-1,0.9366729678638941,0.4899904131889343,0.9370892018779342,0.922365988909427,0.9522900763358778,0.4899904131889343,0.9743229436211243,0.9385633270321361,361.84490966796875,0.9398704902867715,0.9120287253141831,0.9694656488549618,381.13848876953125,0.9768196593404925,0.9404536862003781,17.394351959228516,0.94062205466541,0.9292364990689013,0.9522900763358778,17.394351959228516,0.9770181914372765,0.9347826086956522,147.9871368408203,0.9352112676056338,0.9205175600739371,0.950381679389313,147.9871368408203,0.9621333877078682
5
+ 1,500,0.9404536862003781,0.4546582102775574,0.941066417212348,0.9229357798165138,0.9599236641221374,0.4546582102775574,0.979020052998192,0.943289224952741,382.796875,0.9443413729128015,0.9187725631768953,0.9713740458015268,384.9874572753906,0.9809352479972135,0.941398865784499,18.785140991210938,0.9431192660550459,0.9081272084805654,0.9809160305343512,19.05669403076172,0.9805054188156175,0.9376181474480151,129.74554443359375,0.9388888888888889,0.9118705035971223,0.9675572519083969,129.74554443359375,0.9727834883885278
6
+ 1,1000,0.94234404536862,0.4975280463695526,0.9419600380589915,0.9392789373814042,0.9446564885496184,0.48240917921066284,0.9842468127351804,0.946124763705104,362.0586242675781,0.9455587392550143,0.9464627151051626,0.9446564885496184,362.0586242675781,0.9857615586624637,0.947069943289225,17.691368103027344,0.9465648854961832,0.9465648854961832,0.9465648854961832,17.691368103027344,0.9857418511931075,0.9385633270321361,147.11984252929688,0.9386213408876298,0.9289719626168225,0.9484732824427481,141.555908203125,0.9795327664680187
7
+ 1,-1,0.9489603024574669,0.42314964532852173,0.949438202247191,0.9319852941176471,0.9675572519083969,0.42314964532852173,0.9872732814993084,0.9508506616257089,380.796630859375,0.9508506616257089,0.9419475655430711,0.9599236641221374,380.796630859375,0.9885179108890427,0.9499054820415879,18.473026275634766,0.9501411100658514,0.9369202226345084,0.9637404580152672,18.539331436157227,0.988287040911294,0.947069943289225,124.73574829101562,0.9478584729981377,0.9254545454545454,0.9713740458015268,123.55701446533203,0.9840364744375375
8
+ 2,500,0.941398865784499,0.37280166149139404,0.9431192660550459,0.9081272084805654,0.9809160305343512,0.37280166149139404,0.9846145262965152,0.944234404536862,396.7467041015625,0.9456221198156682,0.9144385026737968,0.9790076335877863,396.7467041015625,0.9864332319474167,0.945179584120983,19.376388549804688,0.9464944649446494,0.9160714285714285,0.9790076335877863,19.376388549804688,0.9859387719578248,0.941398865784499,121.46650695800781,0.9429097605893185,0.9110320284697508,0.9770992366412213,121.46650695800781,0.9793170511018084
9
+ 2,1000,0.941398865784499,0.4293143153190613,0.9421641791044776,0.9215328467153284,0.9637404580152672,0.4272366762161255,0.9833760894408956,0.946124763705104,376.1376037597656,0.946073793755913,0.9380863039399625,0.9541984732824428,376.1376037597656,0.9856706557044219,0.943289224952741,18.11858558654785,0.9436749769159742,0.9141323792486583,0.9751908396946565,19.424821853637695,0.985209911755514,0.9366729678638941,132.0089111328125,0.9375582479030755,0.9162112932604736,0.9599236641221374,132.0089111328125,0.9767609071017523
10
+ 2,-1,0.944234404536862,0.4578818082809448,0.9444967074317969,0.9313543599257885,0.9580152671755725,0.4498842656612396,0.9848264672647637,0.946124763705104,370.8468322753906,0.9464788732394366,0.9316081330868762,0.9618320610687023,382.0978698730469,0.9868899736668068,0.945179584120983,17.448890686035156,0.9458218549127639,0.911504424778761,0.982824427480916,19.76630210876465,0.9863880902389214,0.9404536862003781,138.0528564453125,0.9407337723424272,0.9276437847866419,0.9541984732824428,138.0528564453125,0.9790914146121825
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d4df38204b69dd9d31b93c7de767af4d650fb61d5ae820826e98fd3958a3fef
3
+ size 737403752
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
+ ]
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,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[UNK]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[CLS]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[SEP]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[PAD]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "5": {
44
+ "content": "[BLANK]",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ }
51
+ },
52
+ "clean_up_tokenization_spaces": true,
53
+ "cls_token": "[CLS]",
54
+ "do_lower_case": true,
55
+ "mask_token": "[MASK]",
56
+ "model_max_length": 512,
57
+ "pad_token": "[PAD]",
58
+ "sep_token": "[SEP]",
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "BertTokenizer",
62
+ "unk_token": "[UNK]"
63
+ }
vocab.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fb90bfa35244d26f0065d1fcd0b5becc3da3d44d616a7e2aacaf6320b9fa2d0
3
+ size 1500244