Instructions to use hku-nlp/instructor-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use hku-nlp/instructor-base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("hku-nlp/instructor-base") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Transformers
How to use hku-nlp/instructor-base with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("hku-nlp/instructor-base") model = AutoModel.from_pretrained("hku-nlp/instructor-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -23,7 +23,7 @@ Then you can use the model like this:
|
|
| 23 |
from sentence_transformers import SentenceTransformer
|
| 24 |
sentence = "3D ActionSLAM: wearable person tracking in multi-floor environments"
|
| 25 |
instruction = "Represent the Science title; Input:"
|
| 26 |
-
model = SentenceTransformer('instructor-
|
| 27 |
embeddings = model.encode([[instruction,sentence,0]])
|
| 28 |
print(embeddings)
|
| 29 |
```
|
|
|
|
| 23 |
from sentence_transformers import SentenceTransformer
|
| 24 |
sentence = "3D ActionSLAM: wearable person tracking in multi-floor environments"
|
| 25 |
instruction = "Represent the Science title; Input:"
|
| 26 |
+
model = SentenceTransformer('instructor-base')
|
| 27 |
embeddings = model.encode([[instruction,sentence,0]])
|
| 28 |
print(embeddings)
|
| 29 |
```
|