DrSebastianK commited on
Commit
0475e6b
1 Parent(s): 9ae7808

Upload folder using huggingface_hub

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
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 1024 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 72 with parameters:
86
+ ```
87
+ {'batch_size': 16, 'sampler': 'torch.utils.data.sampler.SequentialSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
88
+ ```
89
+
90
+ **Loss**:
91
+
92
+ `sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss` with parameters:
93
+ ```
94
+ {'scale': 20.0, 'similarity_fct': 'cos_sim'}
95
+ ```
96
+
97
+ Parameters of the fit()-Method:
98
+ ```
99
+ {
100
+ "epochs": 5,
101
+ "evaluation_steps": 50,
102
+ "evaluator": "sentence_transformers.evaluation.InformationRetrievalEvaluator.InformationRetrievalEvaluator",
103
+ "max_grad_norm": 1,
104
+ "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
105
+ "optimizer_params": {
106
+ "lr": 2e-05
107
+ },
108
+ "scheduler": "WarmupLinear",
109
+ "steps_per_epoch": null,
110
+ "warmup_steps": 36,
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': True}) with Transformer model: BertModel
120
+ (1): Pooling({'word_embedding_dimension': 1024, '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,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/root/.cache/torch/sentence_transformers/BAAI_bge-large-en/",
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": 1024,
12
+ "id2label": {
13
+ "0": "LABEL_0"
14
+ },
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 4096,
17
+ "label2id": {
18
+ "LABEL_0": 0
19
+ },
20
+ "layer_norm_eps": 1e-12,
21
+ "max_position_embeddings": 512,
22
+ "model_type": "bert",
23
+ "num_attention_heads": 16,
24
+ "num_hidden_layers": 24,
25
+ "pad_token_id": 0,
26
+ "position_embedding_type": "absolute",
27
+ "torch_dtype": "float32",
28
+ "transformers_version": "4.32.0",
29
+ "type_vocab_size": 2,
30
+ "use_cache": true,
31
+ "vocab_size": 30522
32
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.2.2",
4
+ "transformers": "4.28.1",
5
+ "pytorch": "1.13.0+cu117"
6
+ }
7
+ }
eval/Information-Retrieval_evaluation_results.csv ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ epoch,steps,cos_sim-Accuracy@1,cos_sim-Accuracy@3,cos_sim-Accuracy@5,cos_sim-Accuracy@10,cos_sim-Precision@1,cos_sim-Recall@1,cos_sim-Precision@3,cos_sim-Recall@3,cos_sim-Precision@5,cos_sim-Recall@5,cos_sim-Precision@10,cos_sim-Recall@10,cos_sim-MRR@10,cos_sim-NDCG@10,cos_sim-MAP@100,dot_score-Accuracy@1,dot_score-Accuracy@3,dot_score-Accuracy@5,dot_score-Accuracy@10,dot_score-Precision@1,dot_score-Recall@1,dot_score-Precision@3,dot_score-Recall@3,dot_score-Precision@5,dot_score-Recall@5,dot_score-Precision@10,dot_score-Recall@10,dot_score-MRR@10,dot_score-NDCG@10,dot_score-MAP@100
2
+ 0,50,0.6081730769230769,0.7938701923076923,0.8461538461538461,0.9074519230769231,0.6081730769230769,0.6081730769230769,0.26462339743589747,0.7938701923076923,0.1692307692307692,0.8461538461538461,0.0907451923076923,0.9074519230769231,0.7124537355006105,0.7599136059887392,0.7163682276631231,0.5126201923076923,0.7061298076923077,0.7734375,0.8599759615384616,0.5126201923076923,0.5126201923076923,0.23537660256410253,0.7061298076923077,0.15468749999999998,0.7734375,0.08599759615384614,0.8599759615384616,0.6254008795024423,0.6819525774506686,0.6306251799664965
3
+ 0,-1,0.6105769230769231,0.7890625,0.8389423076923077,0.8966346153846154,0.6105769230769231,0.6105769230769231,0.26302083333333337,0.7890625,0.16778846153846153,0.8389423076923077,0.08966346153846153,0.8966346153846154,0.7097637171855928,0.7552469394737877,0.7145315970660311,0.5336538461538461,0.7193509615384616,0.7962740384615384,0.8713942307692307,0.5336538461538461,0.5336538461538461,0.23978365384615385,0.7193509615384616,0.15925480769230768,0.7962740384615384,0.08713942307692307,0.8713942307692307,0.644545320131258,0.6993270175587629,0.6497556906011526
4
+ 1,50,0.6195913461538461,0.7914663461538461,0.8431490384615384,0.9074519230769231,0.6195913461538461,0.6195913461538461,0.26382211538461536,0.7914663461538461,0.1686298076923077,0.8431490384615384,0.0907451923076923,0.9074519230769231,0.7167487026862029,0.7629727380141442,0.7209494648483585,0.5534855769230769,0.7421875,0.8040865384615384,0.8756009615384616,0.5534855769230769,0.5534855769230769,0.24739583333333331,0.7421875,0.16081730769230768,0.8040865384615384,0.08756009615384615,0.8756009615384616,0.6609346382783889,0.7129244951020051,0.6665464633131659
5
+ 1,-1,0.6189903846153846,0.7902644230769231,0.8473557692307693,0.9128605769230769,0.6189903846153846,0.6189903846153846,0.26342147435897434,0.7902644230769231,0.16947115384615385,0.8473557692307693,0.09128605769230767,0.9128605769230769,0.7182642227564103,0.7654080593715242,0.7220171124997765,0.5643028846153846,0.7560096153846154,0.8143028846153846,0.8816105769230769,0.5643028846153846,0.5643028846153846,0.2520032051282051,0.7560096153846154,0.16286057692307693,0.8143028846153846,0.08816105769230768,0.8816105769230769,0.6723164205586086,0.7231312646398366,0.6776206269561222
6
+ 2,50,0.6147836538461539,0.7854567307692307,0.8359375,0.9056490384615384,0.6147836538461539,0.6147836538461539,0.26181891025641024,0.7854567307692307,0.1671875,0.8359375,0.09056490384615384,0.9056490384615384,0.7129266349969476,0.7595673772208932,0.7171652344684236,0.5727163461538461,0.7542067307692307,0.8131009615384616,0.8834134615384616,0.5727163461538461,0.5727163461538461,0.2514022435897436,0.7542067307692307,0.16262019230769229,0.8131009615384616,0.08834134615384616,0.8834134615384616,0.6773985996642249,0.7272634315591003,0.6826863252174622
7
+ 2,-1,0.6165865384615384,0.7866586538461539,0.8413461538461539,0.9068509615384616,0.6165865384615384,0.6165865384615384,0.2622195512820513,0.7866586538461539,0.16826923076923078,0.8413461538461539,0.09068509615384614,0.9068509615384616,0.7140214819902317,0.7607244108996156,0.7182427359181963,0.5745192307692307,0.7572115384615384,0.8173076923076923,0.8864182692307693,0.5745192307692307,0.5745192307692307,0.25240384615384615,0.7572115384615384,0.16346153846153846,0.8173076923076923,0.08864182692307693,0.8864182692307693,0.6799178685897439,0.7299317179912086,0.685055857595429
8
+ 3,50,0.6123798076923077,0.7866586538461539,0.8455528846153846,0.9032451923076923,0.6123798076923077,0.6123798076923077,0.26221955128205127,0.7866586538461539,0.1691105769230769,0.8455528846153846,0.09032451923076922,0.9032451923076923,0.7125722584706966,0.758907408078944,0.717026353335261,0.5697115384615384,0.7584134615384616,0.8185096153846154,0.8834134615384616,0.5697115384615384,0.5697115384615384,0.25280448717948717,0.7584134615384616,0.16370192307692305,0.8185096153846154,0.08834134615384616,0.8834134615384616,0.6765579689407819,0.726822057531119,0.6819265688840795
9
+ 3,-1,0.6165865384615384,0.7896634615384616,0.8473557692307693,0.9044471153846154,0.6165865384615384,0.6165865384615384,0.26322115384615385,0.7896634615384616,0.1694711538461538,0.8473557692307693,0.09044471153846154,0.9044471153846154,0.7155339018620275,0.7614143192282937,0.7199914954659398,0.5775240384615384,0.7596153846153846,0.8185096153846154,0.8864182692307693,0.5775240384615384,0.5775240384615384,0.2532051282051282,0.7596153846153846,0.16370192307692305,0.8185096153846154,0.08864182692307693,0.8864182692307693,0.6817660637973142,0.7313744017708624,0.6869485002205052
10
+ 4,50,0.6141826923076923,0.7866586538461539,0.8413461538461539,0.9032451923076923,0.6141826923076923,0.6141826923076923,0.2622195512820513,0.7866586538461539,0.16826923076923078,0.8413461538461539,0.09032451923076922,0.9032451923076923,0.7128112122252751,0.7589936781660029,0.7171473478827901,0.5787259615384616,0.7578125,0.8155048076923077,0.8816105769230769,0.5787259615384616,0.5787259615384616,0.2526041666666667,0.7578125,0.16310096153846151,0.8155048076923077,0.08816105769230768,0.8816105769230769,0.6798885359432236,0.7287577875025248,0.6852618749385033
11
+ 4,-1,0.6147836538461539,0.7872596153846154,0.8407451923076923,0.9026442307692307,0.6147836538461539,0.6147836538461539,0.2624198717948718,0.7872596153846154,0.16814903846153845,0.8407451923076923,0.09026442307692308,0.9026442307692307,0.7127861721611725,0.7588164638107243,0.7171789909383394,0.5769230769230769,0.7572115384615384,0.8161057692307693,0.8810096153846154,0.5769230769230769,0.5769230769230769,0.25240384615384615,0.7572115384615384,0.16322115384615382,0.8161057692307693,0.08810096153846153,0.8810096153846154,0.6787433703449329,0.727781754220395,0.6841511674030697
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:c225817c6b0047ab6838352cfc33b2aa08ea91783a989d92eaa7d3e628de9417
3
+ size 1340699369
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 512,
3
+ "do_lower_case": true
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "clean_up_tokenization_spaces": true,
3
+ "cls_token": "[CLS]",
4
+ "do_basic_tokenize": true,
5
+ "do_lower_case": true,
6
+ "mask_token": "[MASK]",
7
+ "model_max_length": 512,
8
+ "never_split": null,
9
+ "pad_token": "[PAD]",
10
+ "sep_token": "[SEP]",
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "BertTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff