Instructions to use microsoft/harrier-oss-v1-27b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use microsoft/harrier-oss-v1-27b with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("microsoft/harrier-oss-v1-27b") 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 microsoft/harrier-oss-v1-27b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="microsoft/harrier-oss-v1-27b")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("microsoft/harrier-oss-v1-27b") model = AutoModel.from_pretrained("microsoft/harrier-oss-v1-27b") - Notebooks
- Google Colab
- Kaggle
Add a default "query" prompt for `model.encode_query`
Hello!
Pull Request overview
- Add a default "query" prompt for
model.encode_query
Details
Since the Sentence Transformers v5.0.0 release, I've added encode_document and encode_query helper methods alongside encode, which are essentially shorthands for model.encode(..., prompt_name="query") (or "document") with a bit of checking if these prompts exist, so that third party libraries like LangChain or PydanticAI can rely on these methods directly for their retrieval-related inference. Because of that, I think it might be useful to additionally add a "query" prompt that just mirrors the "web_search_query". We don't have to update the README, but with this PR, model.encode_query(...) immediately uses a generic retrieval query instead of no query. It's still always recommended to use a custom prompt if you're not working with simple web search queries, at which point users can use e.g. model.encode_query(..., prompt="...") or model.encode(..., prompt="...") (they'll be equivalent).
Overall, this is a very minor change as you've done great with the integration already, nicely done!
See also https://huggingface.co/microsoft/harrier-oss-v1-270m/discussions/1 as this PR mirrors it.
- Tom Aarsen