ncoop57
commited on
Commit
·
cc029d5
1
Parent(s):
6907966
Updating with freshly trained model
Browse files- .gitattributes +1 -0
- README.md +5 -40
- modules.json +6 -0
- pytorch_model.bin +1 -1
.gitattributes
CHANGED
|
@@ -29,3 +29,4 @@ pytorch_model.bin filter=lfs diff=lfs merge=lfs -text
|
|
| 29 |
.git/lfs/objects/60/ce/60ce79a96d7a41a207e79cfea9d5b62876b04591c19495178bedc5ff7c475311 filter=lfs diff=lfs merge=lfs -text
|
| 30 |
.git/lfs/objects/f5/74/f5743ce637a953ee1776d97a870a26a646ffc332a295a4492acc2be2fe54daa3 filter=lfs diff=lfs merge=lfs -text
|
| 31 |
.git/lfs/objects/32/58/32585d7934eb60f052d5f63f7c6ba6159183bccc30cde299785c25177df7c884 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 29 |
.git/lfs/objects/60/ce/60ce79a96d7a41a207e79cfea9d5b62876b04591c19495178bedc5ff7c475311 filter=lfs diff=lfs merge=lfs -text
|
| 30 |
.git/lfs/objects/f5/74/f5743ce637a953ee1776d97a870a26a646ffc332a295a4492acc2be2fe54daa3 filter=lfs diff=lfs merge=lfs -text
|
| 31 |
.git/lfs/objects/32/58/32585d7934eb60f052d5f63f7c6ba6159183bccc30cde299785c25177df7c884 filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
.git/lfs/objects/6c/33/6c338abd9c702b3be95cec15e23c96cf0d8c2e3b7c45df8d48de354f048e1d00 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -4,7 +4,6 @@ tags:
|
|
| 4 |
- sentence-transformers
|
| 5 |
- feature-extraction
|
| 6 |
- sentence-similarity
|
| 7 |
-
- transformers
|
| 8 |
---
|
| 9 |
|
| 10 |
# {MODEL_NAME}
|
|
@@ -34,41 +33,6 @@ print(embeddings)
|
|
| 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, max 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 -->
|
|
@@ -81,9 +45,9 @@ The model was trained with the parameters:
|
|
| 81 |
|
| 82 |
**DataLoader**:
|
| 83 |
|
| 84 |
-
`torch.utils.data.dataloader.DataLoader` of length
|
| 85 |
```
|
| 86 |
-
{'batch_size':
|
| 87 |
```
|
| 88 |
|
| 89 |
**Loss**:
|
|
@@ -97,7 +61,7 @@ Parameters of the fit()-Method:
|
|
| 97 |
```
|
| 98 |
{
|
| 99 |
"callback": null,
|
| 100 |
-
"epochs":
|
| 101 |
"evaluation_steps": 0,
|
| 102 |
"evaluator": "NoneType",
|
| 103 |
"max_grad_norm": 1,
|
|
@@ -115,9 +79,10 @@ Parameters of the fit()-Method:
|
|
| 115 |
|
| 116 |
## Full Model Architecture
|
| 117 |
```
|
| 118 |
-
|
| 119 |
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: RobertaModel
|
| 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 |
|
|
|
|
| 4 |
- sentence-transformers
|
| 5 |
- feature-extraction
|
| 6 |
- sentence-similarity
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
# {MODEL_NAME}
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
## Evaluation Results
|
| 37 |
|
| 38 |
<!--- Describe how your model was evaluated -->
|
|
|
|
| 45 |
|
| 46 |
**DataLoader**:
|
| 47 |
|
| 48 |
+
`torch.utils.data.dataloader.DataLoader` of length 14202 with parameters:
|
| 49 |
```
|
| 50 |
+
{'batch_size': 32, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
|
| 51 |
```
|
| 52 |
|
| 53 |
**Loss**:
|
|
|
|
| 61 |
```
|
| 62 |
{
|
| 63 |
"callback": null,
|
| 64 |
+
"epochs": 1,
|
| 65 |
"evaluation_steps": 0,
|
| 66 |
"evaluator": "NoneType",
|
| 67 |
"max_grad_norm": 1,
|
|
|
|
| 79 |
|
| 80 |
## Full Model Architecture
|
| 81 |
```
|
| 82 |
+
SentenceTransformer(
|
| 83 |
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: RobertaModel
|
| 84 |
(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})
|
| 85 |
+
(2): Normalize()
|
| 86 |
)
|
| 87 |
```
|
| 88 |
|
modules.json
CHANGED
|
@@ -10,5 +10,11 @@
|
|
| 10 |
"name": "1",
|
| 11 |
"path": "1_Pooling",
|
| 12 |
"type": "sentence_transformers.models.Pooling"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
}
|
| 14 |
]
|
|
|
|
| 10 |
"name": "1",
|
| 11 |
"path": "1_Pooling",
|
| 12 |
"type": "sentence_transformers.models.Pooling"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.models.Normalize"
|
| 19 |
}
|
| 20 |
]
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 498669047
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a5cefdac3bc73a3594dc32faf749f08773a4189f881d245531a9798d513125b
|
| 3 |
size 498669047
|