| # GLuCoSE-base-ja-v2.py | |
| from sentence_transformers import SentenceTransformer | |
| # Download from the 🤗 Hub | |
| model = SentenceTransformer("pkshatech/GLuCoSE-base-ja-v2") | |
| # Run inference | |
| sentences = [ | |
| 'The weather is lovely today.', | |
| "It's so sunny outside!", | |
| 'He drove to the stadium.', | |
| ] | |
| embeddings = model.encode(sentences) | |
| print(embeddings.shape) | |
| # [3, 768] | |
| # Get the similarity scores for the embeddings | |
| similarities = model.similarity(embeddings, embeddings) | |
| print(similarities.shape) | |
| # [3, 3] | |