mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 20:12:55 +01:00
added max_length for embedding models. Some models crash if not provided, see https://huggingface.co/T-Systems-onsite/cross-en-de-roberta-sentence-transformer/discussions/7#65ce1ca0102df4e9e00ff823
This commit is contained in:
parent
94712824d6
commit
757a8c79fd
3 changed files with 6 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ class EmbeddingComponent:
|
|||
self.embedding_model = HuggingFaceEmbedding(
|
||||
model_name=settings.huggingface.embedding_hf_model_name,
|
||||
cache_folder=str(models_cache_path),
|
||||
max_length=settings.huggingface.embedding_hf_max_length,
|
||||
)
|
||||
case "sagemaker":
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -151,6 +151,10 @@ class HuggingFaceSettings(BaseModel):
|
|||
embedding_hf_model_name: str = Field(
|
||||
description="Name of the HuggingFace model to use for embeddings"
|
||||
)
|
||||
embedding_hf_max_length: int = Field(
|
||||
None,
|
||||
description="Some embedding models have a maximum length for input, provide here for not crashing"
|
||||
)
|
||||
access_token: str = Field(
|
||||
None,
|
||||
description="Huggingface access token, required to download some models",
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ embedding:
|
|||
|
||||
huggingface:
|
||||
embedding_hf_model_name: BAAI/bge-small-en-v1.5
|
||||
embedding_hf_max_length: 512 # some models have a maximum length for input
|
||||
access_token: ${HUGGINGFACE_TOKEN:}
|
||||
|
||||
vectorstore:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue