|
--- |
|
pipeline_tag: sentence-similarity |
|
tags: |
|
- sentence-transformers |
|
- feature-extraction |
|
- sentence-similarity |
|
- transformers |
|
|
|
--- |
|
ํ๊ตญ์ด์ ์์ด์ nli, sts๋ฐ์ดํฐ๋ฅผ klue/roberta-base์ ํ์ต์ํจ ๋ชจ๋ธ์
๋๋ค. |
|
|
|
```python |
|
from sentence_transformers import SentenceTransformer |
|
from sklearn.metrics.pairwise import cosine_similarity |
|
query = ['๊ทธ๋ ๊ทธ๋
๋ฅผ ์ข์ํ๋ค.'] |
|
sentences = ["he love her", "he hate her", '๊ทธ๋
๋ ๊ทธ๋ฅผ ์ซ์ดํ๋ค.','attention is all you need'] |
|
|
|
emb1 = model.encode(query) |
|
emb2 = model.encode(sentences) |
|
print(cosine_similarity(emb1,emb2)) |
|
-> array([[0.62751913, 0.23996451, 0.30788696, 0.08123618]], dtype=float32) |
|
``` |
|
|
|
|