mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-29 16:36:34 +00:00
update sentence transformers import error message (#7906)
This commit is contained in:
parent
4c59000c21
commit
d80e01492b
@ -9,7 +9,7 @@ import numpy as np
|
||||
from haystack.lazy_imports import LazyImport
|
||||
from haystack.utils.auth import Secret
|
||||
|
||||
with LazyImport(message="Run 'pip install \"sentence-transformers>=2.2.0\"'") as sentence_transformers_import:
|
||||
with LazyImport(message="Run 'pip install \"sentence-transformers>=2.3.0\"'") as sentence_transformers_import:
|
||||
from sentence_transformers import SentenceTransformer
|
||||
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ from haystack.lazy_imports import LazyImport
|
||||
from haystack.utils import ComponentDevice, expit
|
||||
from haystack.utils.auth import Secret, deserialize_secrets_inplace
|
||||
|
||||
with LazyImport(message="Run 'pip install scikit-learn \"sentence-transformers>=2.2.0\"'") as sas_import:
|
||||
with LazyImport(message="Run 'pip install \"sentence-transformers>=2.3.0\"'") as sas_import:
|
||||
from sentence_transformers import CrossEncoder, SentenceTransformer, util
|
||||
from transformers import AutoConfig
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ from haystack.utils import ComponentDevice, Secret, deserialize_secrets_inplace
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
with LazyImport(message="Run 'pip install \"sentence-transformers>=2.2.0\"'") as torch_and_sentence_transformers_import:
|
||||
with LazyImport(message="Run 'pip install \"sentence-transformers>=2.3.0\"'") as torch_and_sentence_transformers_import:
|
||||
import torch
|
||||
from sentence_transformers import SentenceTransformer
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ format-check = "ruff format --check {args}"
|
||||
extra-dependencies = [
|
||||
"transformers[torch,sentencepiece]==4.41.2", # ExtractiveReader, TransformersSimilarityRanker, LocalWhisperTranscriber, HFGenerators...
|
||||
"huggingface_hub>=0.23.0", # Hugging Face API Generators and Embedders
|
||||
"sentence-transformers>=2.2.0", # SentenceTransformersTextEmbedder and SentenceTransformersDocumentEmbedder
|
||||
"sentence-transformers>=2.3.0", # SentenceTransformersTextEmbedder and SentenceTransformersDocumentEmbedder
|
||||
"langdetect", # TextLanguageRouter and DocumentLanguageClassifier
|
||||
"openai-whisper>=20231106", # LocalWhisperTranscriber
|
||||
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
---
|
||||
enhancements:
|
||||
- |
|
||||
Update the error message when the `sentence-transformers` library is not installed
|
||||
and the used component requires it.
|
||||
Loading…
x
Reference in New Issue
Block a user