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") - Notebooks
- Google Colab
- Kaggle
__init__() got an unexpected keyword argument 'pooling_mode_weightedmean_tokens'
#2
by p4rsimony - opened
This error is getting raised when following the installation steps or demoing the model inference widget.
I have the same error
Try:
pip show sentence-transformers
& then modify the file
sentence_transformers/models/Pooling.py
to look exactly like
https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/models/Pooling.py
Reference:
https://github.com/Muennighoff/sgpt/issues/14#issuecomment-1405205453