Sentence Similarity
sentence-transformers
PyTorch
Safetensors
Transformers
Norwegian
bert
feature-extraction
text-embeddings-inference
Instructions to use NbAiLab/nb-sbert-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use NbAiLab/nb-sbert-base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("NbAiLab/nb-sbert-base") sentences = [ "This is a Norwegian boy", "Dette er en norsk gutt", "This is an English boy", "This is a dog" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Transformers
How to use NbAiLab/nb-sbert-base with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("NbAiLab/nb-sbert-base") model = AutoModel.from_pretrained("NbAiLab/nb-sbert-base", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,7 +14,7 @@ This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentence
|
|
| 14 |
|
| 15 |
<!--- Describe your model here -->
|
| 16 |
|
| 17 |
-
## Usage (Sentence-Transformers)
|
| 18 |
|
| 19 |
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
| 20 |
|
|
@@ -35,7 +35,7 @@ print(embeddings)
|
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
-
## Usage (HuggingFace Transformers)
|
| 39 |
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
|
| 40 |
|
| 41 |
```python
|
|
|
|
| 14 |
|
| 15 |
<!--- Describe your model here -->
|
| 16 |
|
| 17 |
+
### Usage (Sentence-Transformers)
|
| 18 |
|
| 19 |
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
| 20 |
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
+
### Usage (HuggingFace Transformers)
|
| 39 |
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
|
| 40 |
|
| 41 |
```python
|