upload
Browse filesThis view is limited to 50 files because it contains too many changes. Β
See raw diff
- {qgen-tasb/1_Pooling β 1_Pooling}/config.json +0 -0
- qgen-tasb/README.md β README.md +5 -10
- qgen-tsdae/config.json β config.json +1 -1
- qgen-tasb/config_sentence_transformers.json β config_sentence_transformers.json +0 -0
- gpl +0 -1
- gpl-tasb/1_Pooling/config.json +0 -7
- gpl-tasb/README.md +0 -122
- gpl-tasb/config.json +0 -24
- gpl-tasb/config_sentence_transformers.json +0 -7
- gpl-tasb/tokenizer_config.json +0 -1
- gpl-tsdae +0 -1
- gpl-tasb/modules.json β modules.json +0 -0
- gpl-tasb/pytorch_model.bin β pytorch_model.bin +1 -1
- qgen-tasb/config.json +0 -24
- qgen-tasb/modules.json +0 -14
- qgen-tasb/pytorch_model.bin +0 -3
- qgen-tasb/sentence_bert_config.json +0 -4
- qgen-tasb/special_tokens_map.json +0 -1
- qgen-tasb/tokenizer.json +0 -0
- qgen-tasb/tokenizer_config.json +0 -1
- qgen-tasb/vocab.txt +0 -0
- qgen-tsdae/1_Pooling/config.json +0 -7
- qgen-tsdae/README.md +0 -130
- qgen-tsdae/config_sentence_transformers.json +0 -7
- qgen-tsdae/modules.json +0 -14
- qgen-tsdae/pytorch_model.bin +0 -3
- qgen-tsdae/sentence_bert_config.json +0 -4
- qgen-tsdae/special_tokens_map.json +0 -1
- qgen-tsdae/tokenizer.json +0 -0
- qgen-tsdae/vocab.txt +0 -0
- qgen/1_Pooling/config.json +0 -7
- qgen/README.md +0 -130
- qgen/config.json +0 -24
- qgen/config_sentence_transformers.json +0 -7
- qgen/modules.json +0 -14
- qgen/pytorch_model.bin +0 -3
- qgen/sentence_bert_config.json +0 -4
- qgen/special_tokens_map.json +0 -1
- qgen/tokenizer.json +0 -0
- qgen/tokenizer_config.json +0 -1
- qgen/vocab.txt +0 -0
- gpl-tasb/sentence_bert_config.json β sentence_bert_config.json +0 -0
- gpl-tasb/special_tokens_map.json β special_tokens_map.json +0 -0
- gpl-tasb/tokenizer.json β tokenizer.json +0 -0
- qgen-tsdae/tokenizer_config.json β tokenizer_config.json +1 -1
- tsdae/config.json +0 -24
- tsdae/pytorch_model.bin +0 -3
- tsdae/sentence_bert_config.json +0 -4
- tsdae/special_tokens_map.json +0 -1
- tsdae/tokenizer.json +0 -0
{qgen-tasb/1_Pooling β 1_Pooling}/config.json
RENAMED
File without changes
|
qgen-tasb/README.md β README.md
RENAMED
@@ -84,17 +84,14 @@ The model was trained with the parameters:
|
|
84 |
|
85 |
**DataLoader**:
|
86 |
|
87 |
-
`torch.utils.data.dataloader.DataLoader` of length
|
88 |
```
|
89 |
-
{'batch_size':
|
90 |
```
|
91 |
|
92 |
**Loss**:
|
93 |
|
94 |
-
`
|
95 |
-
```
|
96 |
-
{'scale': 20.0, 'similarity_fct': 'cos_sim'}
|
97 |
-
```
|
98 |
|
99 |
Parameters of the fit()-Method:
|
100 |
```
|
@@ -105,13 +102,11 @@ Parameters of the fit()-Method:
|
|
105 |
"max_grad_norm": 1,
|
106 |
"optimizer_class": "<class 'transformers.optimization.AdamW'>",
|
107 |
"optimizer_params": {
|
108 |
-
"correct_bias": false,
|
109 |
-
"eps": 1e-06,
|
110 |
"lr": 2e-05
|
111 |
},
|
112 |
"scheduler": "WarmupLinear",
|
113 |
-
"steps_per_epoch":
|
114 |
-
"warmup_steps":
|
115 |
"weight_decay": 0.01
|
116 |
}
|
117 |
```
|
|
|
84 |
|
85 |
**DataLoader**:
|
86 |
|
87 |
+
`torch.utils.data.dataloader.DataLoader` of length 140000 with parameters:
|
88 |
```
|
89 |
+
{'batch_size': 32, 'sampler': 'torch.utils.data.sampler.SequentialSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
90 |
```
|
91 |
|
92 |
**Loss**:
|
93 |
|
94 |
+
`gpl.toolkit.loss.MarginDistillationLoss`
|
|
|
|
|
|
|
95 |
|
96 |
Parameters of the fit()-Method:
|
97 |
```
|
|
|
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": 140000,
|
109 |
+
"warmup_steps": 1000,
|
110 |
"weight_decay": 0.01
|
111 |
}
|
112 |
```
|
qgen-tsdae/config.json β config.json
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"_name_or_path": "/ukp-storage-1/kwang/date-exps/results/adaptation/distilbert-base-uncased/
|
3 |
"activation": "gelu",
|
4 |
"architectures": [
|
5 |
"DistilBertModel"
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "/ukp-storage-1/kwang/date-exps/results/adaptation/distilbert-base-uncased/fever/tsdae2mdl-msv3-70k-nes-@100K/seed1/70000/0_Transformer",
|
3 |
"activation": "gelu",
|
4 |
"architectures": [
|
5 |
"DistilBertModel"
|
qgen-tasb/config_sentence_transformers.json β config_sentence_transformers.json
RENAMED
File without changes
|
gpl
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 98a7c075f0ee63f12d63e3bfdf311858dec34603
|
|
|
|
gpl-tasb/1_Pooling/config.json
DELETED
@@ -1,7 +0,0 @@
|
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gpl-tasb/README.md
DELETED
@@ -1,122 +0,0 @@
|
|
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 140000 with parameters:
|
85 |
-
```
|
86 |
-
{'batch_size': 32, 'sampler': 'torch.utils.data.sampler.SequentialSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
87 |
-
```
|
88 |
-
|
89 |
-
**Loss**:
|
90 |
-
|
91 |
-
`gpl.toolkit.loss.MarginDistillationLoss`
|
92 |
-
|
93 |
-
Parameters of the fit()-Method:
|
94 |
-
```
|
95 |
-
{
|
96 |
-
"epochs": 1,
|
97 |
-
"evaluation_steps": 0,
|
98 |
-
"evaluator": "NoneType",
|
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": 140000,
|
106 |
-
"warmup_steps": 1000,
|
107 |
-
"weight_decay": 0.01
|
108 |
-
}
|
109 |
-
```
|
110 |
-
|
111 |
-
|
112 |
-
## Full Model Architecture
|
113 |
-
```
|
114 |
-
SentenceTransformer(
|
115 |
-
(0): Transformer({'max_seq_length': 350, 'do_lower_case': False}) with Transformer model: DistilBertModel
|
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 -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gpl-tasb/config.json
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_name_or_path": "/ukp-storage-1/kwang/.cache/torch/sentence_transformers/sentence-transformers_msmarco-distilbert-base-tas-b/",
|
3 |
-
"activation": "gelu",
|
4 |
-
"architectures": [
|
5 |
-
"DistilBertModel"
|
6 |
-
],
|
7 |
-
"attention_dropout": 0.1,
|
8 |
-
"dim": 768,
|
9 |
-
"dropout": 0.1,
|
10 |
-
"hidden_dim": 3072,
|
11 |
-
"initializer_range": 0.02,
|
12 |
-
"max_position_embeddings": 512,
|
13 |
-
"model_type": "distilbert",
|
14 |
-
"n_heads": 12,
|
15 |
-
"n_layers": 6,
|
16 |
-
"pad_token_id": 0,
|
17 |
-
"qa_dropout": 0.1,
|
18 |
-
"seq_classif_dropout": 0.2,
|
19 |
-
"sinusoidal_pos_embds": false,
|
20 |
-
"tie_weights_": true,
|
21 |
-
"torch_dtype": "float32",
|
22 |
-
"transformers_version": "4.15.0",
|
23 |
-
"vocab_size": 30522
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gpl-tasb/config_sentence_transformers.json
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"__version__": {
|
3 |
-
"sentence_transformers": "2.0.0",
|
4 |
-
"transformers": "4.7.0",
|
5 |
-
"pytorch": "1.9.0+cu102"
|
6 |
-
}
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gpl-tasb/tokenizer_config.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"do_lower_case": true, "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, "model_max_length": 512, "name_or_path": "/ukp-storage-1/kwang/.cache/torch/sentence_transformers/sentence-transformers_msmarco-distilbert-base-tas-b/", "special_tokens_map_file": "/home/ukp-reimers/.cache/huggingface/transformers/ba1a276969ccad7ea2344196e7b8561b36292db74bff940ee316dadc05d005d3.dd8bd9bfd3664b530ea4e645105f557769387b3da9f79bdb55ed556bdd80611d", "tokenizer_class": "DistilBertTokenizer"}
|
|
|
|
gpl-tsdae
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 799bc403f77c354a5a46a676e6c79f9c6e434b11
|
|
|
|
gpl-tasb/modules.json β modules.json
RENAMED
File without changes
|
gpl-tasb/pytorch_model.bin β pytorch_model.bin
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 265488185
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:930679790896f04ea4ffd7776a7a3652f3c07e21bdacf90f76f2cad79db768fd
|
3 |
size 265488185
|
qgen-tasb/config.json
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_name_or_path": "sentence-transformers/msmarco-distilbert-base-tas-b",
|
3 |
-
"activation": "gelu",
|
4 |
-
"architectures": [
|
5 |
-
"DistilBertModel"
|
6 |
-
],
|
7 |
-
"attention_dropout": 0.1,
|
8 |
-
"dim": 768,
|
9 |
-
"dropout": 0.1,
|
10 |
-
"hidden_dim": 3072,
|
11 |
-
"initializer_range": 0.02,
|
12 |
-
"max_position_embeddings": 512,
|
13 |
-
"model_type": "distilbert",
|
14 |
-
"n_heads": 12,
|
15 |
-
"n_layers": 6,
|
16 |
-
"pad_token_id": 0,
|
17 |
-
"qa_dropout": 0.1,
|
18 |
-
"seq_classif_dropout": 0.2,
|
19 |
-
"sinusoidal_pos_embds": false,
|
20 |
-
"tie_weights_": true,
|
21 |
-
"torch_dtype": "float32",
|
22 |
-
"transformers_version": "4.15.0",
|
23 |
-
"vocab_size": 30522
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen-tasb/modules.json
DELETED
@@ -1,14 +0,0 @@
|
|
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 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen-tasb/pytorch_model.bin
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:48cf65420beee522ee91c8728f5f3f4ee6983be5256dbecf89da1d167d15be5d
|
3 |
-
size 265488185
|
|
|
|
|
|
|
|
qgen-tasb/sentence_bert_config.json
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"max_seq_length": 350,
|
3 |
-
"do_lower_case": false
|
4 |
-
}
|
|
|
|
|
|
|
|
|
|
qgen-tasb/special_tokens_map.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
|
|
|
qgen-tasb/tokenizer.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
qgen-tasb/tokenizer_config.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"do_lower_case": true, "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, "model_max_length": 512, "name_or_path": "sentence-transformers/msmarco-distilbert-base-tas-b", "special_tokens_map_file": "/home/ukp-reimers/.cache/huggingface/transformers/ba1a276969ccad7ea2344196e7b8561b36292db74bff940ee316dadc05d005d3.dd8bd9bfd3664b530ea4e645105f557769387b3da9f79bdb55ed556bdd80611d", "tokenizer_class": "DistilBertTokenizer"}
|
|
|
|
qgen-tasb/vocab.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
qgen-tsdae/1_Pooling/config.json
DELETED
@@ -1,7 +0,0 @@
|
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen-tsdae/README.md
DELETED
@@ -1,130 +0,0 @@
|
|
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 2998 with parameters:
|
88 |
-
```
|
89 |
-
{'batch_size': 75, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
90 |
-
```
|
91 |
-
|
92 |
-
**Loss**:
|
93 |
-
|
94 |
-
`sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss` with parameters:
|
95 |
-
```
|
96 |
-
{'scale': 20.0, 'similarity_fct': 'cos_sim'}
|
97 |
-
```
|
98 |
-
|
99 |
-
Parameters of the fit()-Method:
|
100 |
-
```
|
101 |
-
{
|
102 |
-
"epochs": 1,
|
103 |
-
"evaluation_steps": 0,
|
104 |
-
"evaluator": "NoneType",
|
105 |
-
"max_grad_norm": 1,
|
106 |
-
"optimizer_class": "<class 'transformers.optimization.AdamW'>",
|
107 |
-
"optimizer_params": {
|
108 |
-
"correct_bias": false,
|
109 |
-
"eps": 1e-06,
|
110 |
-
"lr": 2e-05
|
111 |
-
},
|
112 |
-
"scheduler": "WarmupLinear",
|
113 |
-
"steps_per_epoch": null,
|
114 |
-
"warmup_steps": 299,
|
115 |
-
"weight_decay": 0.01
|
116 |
-
}
|
117 |
-
```
|
118 |
-
|
119 |
-
|
120 |
-
## Full Model Architecture
|
121 |
-
```
|
122 |
-
SentenceTransformer(
|
123 |
-
(0): Transformer({'max_seq_length': 350, 'do_lower_case': False}) with Transformer model: DistilBertModel
|
124 |
-
(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})
|
125 |
-
)
|
126 |
-
```
|
127 |
-
|
128 |
-
## Citing & Authors
|
129 |
-
|
130 |
-
<!--- Describe where people can find more information -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen-tsdae/config_sentence_transformers.json
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"__version__": {
|
3 |
-
"sentence_transformers": "2.1.0",
|
4 |
-
"transformers": "4.15.0",
|
5 |
-
"pytorch": "1.10.1+cu102"
|
6 |
-
}
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen-tsdae/modules.json
DELETED
@@ -1,14 +0,0 @@
|
|
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 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen-tsdae/pytorch_model.bin
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:3d46d056badcac5fd4ef6729df023d01cc5db0c4bebd3f91f3074943833cae08
|
3 |
-
size 265488185
|
|
|
|
|
|
|
|
qgen-tsdae/sentence_bert_config.json
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"max_seq_length": 350,
|
3 |
-
"do_lower_case": false
|
4 |
-
}
|
|
|
|
|
|
|
|
|
|
qgen-tsdae/special_tokens_map.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
|
|
|
qgen-tsdae/tokenizer.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
qgen-tsdae/vocab.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
qgen/1_Pooling/config.json
DELETED
@@ -1,7 +0,0 @@
|
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen/README.md
DELETED
@@ -1,130 +0,0 @@
|
|
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 2998 with parameters:
|
88 |
-
```
|
89 |
-
{'batch_size': 75, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
90 |
-
```
|
91 |
-
|
92 |
-
**Loss**:
|
93 |
-
|
94 |
-
`sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss` with parameters:
|
95 |
-
```
|
96 |
-
{'scale': 20.0, 'similarity_fct': 'cos_sim'}
|
97 |
-
```
|
98 |
-
|
99 |
-
Parameters of the fit()-Method:
|
100 |
-
```
|
101 |
-
{
|
102 |
-
"epochs": 1,
|
103 |
-
"evaluation_steps": 0,
|
104 |
-
"evaluator": "NoneType",
|
105 |
-
"max_grad_norm": 1,
|
106 |
-
"optimizer_class": "<class 'transformers.optimization.AdamW'>",
|
107 |
-
"optimizer_params": {
|
108 |
-
"correct_bias": false,
|
109 |
-
"eps": 1e-06,
|
110 |
-
"lr": 2e-05
|
111 |
-
},
|
112 |
-
"scheduler": "WarmupLinear",
|
113 |
-
"steps_per_epoch": null,
|
114 |
-
"warmup_steps": 299,
|
115 |
-
"weight_decay": 0.01
|
116 |
-
}
|
117 |
-
```
|
118 |
-
|
119 |
-
|
120 |
-
## Full Model Architecture
|
121 |
-
```
|
122 |
-
SentenceTransformer(
|
123 |
-
(0): Transformer({'max_seq_length': 350, 'do_lower_case': False}) with Transformer model: DistilBertModel
|
124 |
-
(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})
|
125 |
-
)
|
126 |
-
```
|
127 |
-
|
128 |
-
## Citing & Authors
|
129 |
-
|
130 |
-
<!--- Describe where people can find more information -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen/config.json
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_name_or_path": "GPL/msmarco-distilbert-margin-mse",
|
3 |
-
"activation": "gelu",
|
4 |
-
"architectures": [
|
5 |
-
"DistilBertModel"
|
6 |
-
],
|
7 |
-
"attention_dropout": 0.1,
|
8 |
-
"dim": 768,
|
9 |
-
"dropout": 0.1,
|
10 |
-
"hidden_dim": 3072,
|
11 |
-
"initializer_range": 0.02,
|
12 |
-
"max_position_embeddings": 512,
|
13 |
-
"model_type": "distilbert",
|
14 |
-
"n_heads": 12,
|
15 |
-
"n_layers": 6,
|
16 |
-
"pad_token_id": 0,
|
17 |
-
"qa_dropout": 0.1,
|
18 |
-
"seq_classif_dropout": 0.2,
|
19 |
-
"sinusoidal_pos_embds": false,
|
20 |
-
"tie_weights_": true,
|
21 |
-
"torch_dtype": "float32",
|
22 |
-
"transformers_version": "4.15.0",
|
23 |
-
"vocab_size": 30522
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen/config_sentence_transformers.json
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"__version__": {
|
3 |
-
"sentence_transformers": "2.1.0",
|
4 |
-
"transformers": "4.15.0",
|
5 |
-
"pytorch": "1.10.1+cu102"
|
6 |
-
}
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen/modules.json
DELETED
@@ -1,14 +0,0 @@
|
|
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 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qgen/pytorch_model.bin
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:56ec0c86359e95c3bee8f08824c8fa8a8f9ad6f44033762572e16dbf08f794dd
|
3 |
-
size 265488185
|
|
|
|
|
|
|
|
qgen/sentence_bert_config.json
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"max_seq_length": 350,
|
3 |
-
"do_lower_case": false
|
4 |
-
}
|
|
|
|
|
|
|
|
|
|
qgen/special_tokens_map.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
|
|
|
qgen/tokenizer.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
qgen/tokenizer_config.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "GPL/msmarco-distilbert-margin-mse", "tokenizer_class": "DistilBertTokenizer"}
|
|
|
|
qgen/vocab.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
gpl-tasb/sentence_bert_config.json β sentence_bert_config.json
RENAMED
File without changes
|
gpl-tasb/special_tokens_map.json β special_tokens_map.json
RENAMED
File without changes
|
gpl-tasb/tokenizer.json β tokenizer.json
RENAMED
File without changes
|
qgen-tsdae/tokenizer_config.json β tokenizer_config.json
RENAMED
@@ -1 +1 @@
|
|
1 |
-
{"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "/ukp-storage-1/kwang/date-exps/results/adaptation/distilbert-base-uncased/
|
|
|
1 |
+
{"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "/ukp-storage-1/kwang/date-exps/results/adaptation/distilbert-base-uncased/fever/tsdae2mdl-msv3-70k-nes-@100K/seed1/70000/0_Transformer", "tokenizer_class": "DistilBertTokenizer"}
|
tsdae/config.json
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_name_or_path": "results/unsupervised/distilbert-base-uncased/arguana/tsdae/seed1/100000/0_Transformer",
|
3 |
-
"activation": "gelu",
|
4 |
-
"architectures": [
|
5 |
-
"DistilBertModel"
|
6 |
-
],
|
7 |
-
"attention_dropout": 0.1,
|
8 |
-
"dim": 768,
|
9 |
-
"dropout": 0.1,
|
10 |
-
"hidden_dim": 3072,
|
11 |
-
"initializer_range": 0.02,
|
12 |
-
"max_position_embeddings": 512,
|
13 |
-
"model_type": "distilbert",
|
14 |
-
"n_heads": 12,
|
15 |
-
"n_layers": 6,
|
16 |
-
"pad_token_id": 0,
|
17 |
-
"qa_dropout": 0.1,
|
18 |
-
"seq_classif_dropout": 0.2,
|
19 |
-
"sinusoidal_pos_embds": false,
|
20 |
-
"tie_weights_": true,
|
21 |
-
"torch_dtype": "float32",
|
22 |
-
"transformers_version": "4.9.1",
|
23 |
-
"vocab_size": 30522
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tsdae/pytorch_model.bin
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:0a1be8988781c49706c1b7847f25080f1beb505b79eb41f6adb448129279ba0b
|
3 |
-
size 265491187
|
|
|
|
|
|
|
|
tsdae/sentence_bert_config.json
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"max_seq_length": 350,
|
3 |
-
"do_lower_case": false
|
4 |
-
}
|
|
|
|
|
|
|
|
|
|
tsdae/special_tokens_map.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
|
|
|
tsdae/tokenizer.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|