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
|
@@ -16,7 +16,7 @@ It takes customized instructions and text inputs, and generates task-specific em
|
|
| 16 |
```
|
| 17 |
git clone https://github.com/HKUNLP/instructor-embedding
|
| 18 |
cd sentence-transformers
|
| 19 |
-
pip
|
| 20 |
```
|
| 21 |
Then you can use the model like this:
|
| 22 |
```python
|
|
|
|
| 16 |
```
|
| 17 |
git clone https://github.com/HKUNLP/instructor-embedding
|
| 18 |
cd sentence-transformers
|
| 19 |
+
pip install -e .
|
| 20 |
```
|
| 21 |
Then you can use the model like this:
|
| 22 |
```python
|