Update README.md
Browse files
README.md
CHANGED
|
@@ -34,12 +34,27 @@ pip install -U sentence-transformers
|
|
| 34 |
Then you can use the model like this:
|
| 35 |
|
| 36 |
```python
|
|
|
|
| 37 |
from sentence_transformers import SentenceTransformer
|
| 38 |
-
|
| 39 |
|
|
|
|
| 40 |
model = SentenceTransformer('FractalGPT/SberDistil')
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
```
|
| 44 |
|
| 45 |
## Training
|
|
|
|
| 34 |
Then you can use the model like this:
|
| 35 |
|
| 36 |
```python
|
| 37 |
+
import numpy as np
|
| 38 |
from sentence_transformers import SentenceTransformer
|
| 39 |
+
```
|
| 40 |
|
| 41 |
+
```python
|
| 42 |
model = SentenceTransformer('FractalGPT/SberDistil')
|
| 43 |
+
|
| 44 |
+
def cos(x, y):
|
| 45 |
+
return np.dot(x, y)/(np.linalg.norm(x)*np.linalg.norm(y))
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
text_1 = "Кто такой большой кот?"
|
| 50 |
+
text_2 = "Who is kitty?"
|
| 51 |
+
a = model.encode(text_1)
|
| 52 |
+
b = model.encode(text_2)
|
| 53 |
+
cos(a, b)
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
```
|
| 57 |
+
>>> 0.8072159157330788
|
| 58 |
```
|
| 59 |
|
| 60 |
## Training
|