Add new SentenceTransformer model.
Browse files- .gitattributes +2 -0
- 0_WordEmbeddings/pytorch_model.bin +3 -0
- 0_WordEmbeddings/whitespacetokenizer_config.json +0 -0
- 0_WordEmbeddings/wordembedding_config.json +5 -0
- 1_LSTM/lstm_config.json +7 -0
- 1_LSTM/pytorch_model.bin +3 -0
- 2_Pooling/config.json +9 -0
- README.md +95 -0
- config_sentence_transformers.json +7 -0
- modules.json +20 -0
.gitattributes
CHANGED
@@ -32,3 +32,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
1_LSTM/pytorch_model.bin filter=lfs diff=lfs merge=lfs -text
|
36 |
+
0_WordEmbeddings/pytorch_model.bin filter=lfs diff=lfs merge=lfs -text
|
0_WordEmbeddings/pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7998e908ee896b834bb9a5cf5b69e39c75804fd7447ceb6b6cd2b12d3f982f96
|
3 |
+
size 480002045
|
0_WordEmbeddings/whitespacetokenizer_config.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
0_WordEmbeddings/wordembedding_config.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"tokenizer_class": "sentence_transformers.models.tokenizer.WhitespaceTokenizer.WhitespaceTokenizer",
|
3 |
+
"update_embeddings": false,
|
4 |
+
"max_seq_length": 1000000
|
5 |
+
}
|
1_LSTM/lstm_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 300,
|
3 |
+
"hidden_dim": 1024,
|
4 |
+
"num_layers": 1,
|
5 |
+
"dropout": 0,
|
6 |
+
"bidirectional": true
|
7 |
+
}
|
1_LSTM/pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4c201af6ec1e5161279a3a94fdde299ea882a069ccafead8fa0580d2cc3b5b4b
|
3 |
+
size 43451901
|
2_Pooling/config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 2048,
|
3 |
+
"pooling_mode_cls_token": false,
|
4 |
+
"pooling_mode_mean_tokens": false,
|
5 |
+
"pooling_mode_max_tokens": true,
|
6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
7 |
+
"pooling_mode_weightedmean_tokens": false,
|
8 |
+
"pooling_mode_lasttoken": false
|
9 |
+
}
|
README.md
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: sentence-similarity
|
3 |
+
tags:
|
4 |
+
- sentence-transformers
|
5 |
+
- feature-extraction
|
6 |
+
- sentence-similarity
|
7 |
+
|
8 |
+
---
|
9 |
+
|
10 |
+
# hli/lstm-qqp-scomp-sentence-transformer
|
11 |
+
|
12 |
+
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 2048 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('hli/lstm-qqp-scomp-sentence-transformer')
|
31 |
+
embeddings = model.encode(sentences)
|
32 |
+
print(embeddings)
|
33 |
+
```
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
## Evaluation Results
|
38 |
+
|
39 |
+
<!--- Describe how your model was evaluated -->
|
40 |
+
|
41 |
+
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name=hli/lstm-qqp-scomp-sentence-transformer)
|
42 |
+
|
43 |
+
|
44 |
+
## Training
|
45 |
+
The model was trained with the parameters:
|
46 |
+
|
47 |
+
**DataLoader**:
|
48 |
+
|
49 |
+
`torch.utils.data.dataloader.DataLoader` of length 2813 with parameters:
|
50 |
+
```
|
51 |
+
{'batch_size': 64, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
52 |
+
```
|
53 |
+
|
54 |
+
**Loss**:
|
55 |
+
|
56 |
+
`sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss` with parameters:
|
57 |
+
```
|
58 |
+
{'scale': 20.0, 'similarity_fct': 'cos_sim'}
|
59 |
+
```
|
60 |
+
|
61 |
+
Parameters of the fit()-Method:
|
62 |
+
```
|
63 |
+
{
|
64 |
+
"epochs": 10,
|
65 |
+
"evaluation_steps": 0,
|
66 |
+
"evaluator": "NoneType",
|
67 |
+
"max_grad_norm": 1,
|
68 |
+
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
|
69 |
+
"optimizer_params": {
|
70 |
+
"lr": 2e-05
|
71 |
+
},
|
72 |
+
"scheduler": "WarmupLinear",
|
73 |
+
"steps_per_epoch": null,
|
74 |
+
"warmup_steps": 2813,
|
75 |
+
"weight_decay": 0.01
|
76 |
+
}
|
77 |
+
```
|
78 |
+
|
79 |
+
|
80 |
+
## Full Model Architecture
|
81 |
+
```
|
82 |
+
SentenceTransformer(
|
83 |
+
(0): WordEmbeddings(
|
84 |
+
(emb_layer): Embedding(400001, 300)
|
85 |
+
)
|
86 |
+
(1): LSTM(
|
87 |
+
(encoder): LSTM(300, 1024, batch_first=True, bidirectional=True)
|
88 |
+
)
|
89 |
+
(2): Pooling({'word_embedding_dimension': 2048, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': True, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False})
|
90 |
+
)
|
91 |
+
```
|
92 |
+
|
93 |
+
## Citing & Authors
|
94 |
+
|
95 |
+
<!--- Describe where people can find more information -->
|
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": "2.0.0+cu118"
|
6 |
+
}
|
7 |
+
}
|
modules.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"idx": 0,
|
4 |
+
"name": "0",
|
5 |
+
"path": "0_WordEmbeddings",
|
6 |
+
"type": "sentence_transformers.models.WordEmbeddings"
|
7 |
+
},
|
8 |
+
{
|
9 |
+
"idx": 1,
|
10 |
+
"name": "1",
|
11 |
+
"path": "1_LSTM",
|
12 |
+
"type": "sentence_transformers.models.LSTM"
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"idx": 2,
|
16 |
+
"name": "2",
|
17 |
+
"path": "2_Pooling",
|
18 |
+
"type": "sentence_transformers.models.Pooling"
|
19 |
+
}
|
20 |
+
]
|