Sentence Similarity
sentence-transformers
PyTorch
Safetensors
Transformers
Polish
roberta
feature-extraction
text-embeddings-inference
Instructions to use radlab/polish-bi-encoder-mean with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use radlab/polish-bi-encoder-mean with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("radlab/polish-bi-encoder-mean") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use radlab/polish-bi-encoder-mean with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("radlab/polish-bi-encoder-mean") model = AutoModel.from_pretrained("radlab/polish-bi-encoder-mean", device_map="auto") - Notebooks
- Google Colab
- Kaggle
updated model path in the examples
Browse files
README.md
CHANGED
|
@@ -38,7 +38,7 @@ Then you can use the model like this:
|
|
| 38 |
from sentence_transformers import SentenceTransformer
|
| 39 |
sentences = ['Ala ma kota i psa, widzi dzisiaj też śnieg', 'Ewa ma białe zęby']
|
| 40 |
|
| 41 |
-
model = SentenceTransformer('
|
| 42 |
embeddings = model.encode(sentences)
|
| 43 |
print(embeddings)
|
| 44 |
```
|
|
@@ -64,8 +64,8 @@ def mean_pooling(model_output, attention_mask):
|
|
| 64 |
sentences = ['Ala ma kota i psa, widzi dzisiaj też śnieg', 'Ewa ma białe zęby']
|
| 65 |
|
| 66 |
# Load model from HuggingFace Hub
|
| 67 |
-
tokenizer = AutoTokenizer.from_pretrained('
|
| 68 |
-
model = AutoModel.from_pretrained('
|
| 69 |
|
| 70 |
# Tokenize sentences
|
| 71 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
|
|
| 38 |
from sentence_transformers import SentenceTransformer
|
| 39 |
sentences = ['Ala ma kota i psa, widzi dzisiaj też śnieg', 'Ewa ma białe zęby']
|
| 40 |
|
| 41 |
+
model = SentenceTransformer('radlab/polish-bi-encoder-mean')
|
| 42 |
embeddings = model.encode(sentences)
|
| 43 |
print(embeddings)
|
| 44 |
```
|
|
|
|
| 64 |
sentences = ['Ala ma kota i psa, widzi dzisiaj też śnieg', 'Ewa ma białe zęby']
|
| 65 |
|
| 66 |
# Load model from HuggingFace Hub
|
| 67 |
+
tokenizer = AutoTokenizer.from_pretrained('radlab/polish-bi-encoder-mean')
|
| 68 |
+
model = AutoModel.from_pretrained('radlab/polish-bi-encoder-mean')
|
| 69 |
|
| 70 |
# Tokenize sentences
|
| 71 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|