Commit
•
6b24c05
1
Parent(s):
569f485
Test.
Browse files- README.md +4 -4
- pytorch_model.bin +1 -1
README.md
CHANGED
@@ -26,11 +26,11 @@ pip install -U sentence-transformers
|
|
26 |
|
27 |
Then you can use the model like this:
|
28 |
|
29 |
-
```
|
30 |
from sentence_transformers import SentenceTransformer
|
31 |
sentences = ["This is an example sentence"]
|
32 |
|
33 |
-
model = SentenceTransformer(
|
34 |
embeddings = model.encode(sentences)
|
35 |
print(embeddings)
|
36 |
```
|
@@ -38,7 +38,7 @@ print(embeddings)
|
|
38 |
|
39 |
## Usage (HuggingFace Transformers)
|
40 |
|
41 |
-
```
|
42 |
from transformers import AutoTokenizer, AutoModel
|
43 |
import torch
|
44 |
|
@@ -65,7 +65,7 @@ encoded_input = tokenizer(sentences, padding=True, truncation=True, max_length=1
|
|
65 |
with torch.no_grad():
|
66 |
model_output = model(**encoded_input)
|
67 |
|
68 |
-
#Perform pooling. In this case, max pooling.
|
69 |
sentence_embeddings = max_pooling(model_output, encoded_input['attention_mask'])
|
70 |
|
71 |
print("Sentence embeddings:")
|
|
|
26 |
|
27 |
Then you can use the model like this:
|
28 |
|
29 |
+
```python
|
30 |
from sentence_transformers import SentenceTransformer
|
31 |
sentences = ["This is an example sentence"]
|
32 |
|
33 |
+
model = SentenceTransformer(TODO)
|
34 |
embeddings = model.encode(sentences)
|
35 |
print(embeddings)
|
36 |
```
|
|
|
38 |
|
39 |
## Usage (HuggingFace Transformers)
|
40 |
|
41 |
+
```python
|
42 |
from transformers import AutoTokenizer, AutoModel
|
43 |
import torch
|
44 |
|
|
|
65 |
with torch.no_grad():
|
66 |
model_output = model(**encoded_input)
|
67 |
|
68 |
+
# Perform pooling. In this case, max pooling.
|
69 |
sentence_embeddings = max_pooling(model_output, encoded_input['attention_mask'])
|
70 |
|
71 |
print("Sentence embeddings:")
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 328519167
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d13c7df0aabbec3134ae5c033ab5a3d1490c3725e6d89452549d83bc9afef84e
|
3 |
size 328519167
|