Skip to content
Snippets Groups Projects
Unverified Commit 13c68c9a authored by Logan's avatar Logan Committed by GitHub
Browse files

let huggingface embeddings load (#8119)

parent 6cb2a851
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ from llama_index.embeddings.huggingface_utils import (
get_query_instruct_for_model_name,
get_text_instruct_for_model_name,
)
from llama_index.utils import get_cache_dir
class HuggingFaceEmbedding(BaseEmbedding):
......@@ -60,6 +61,8 @@ class HuggingFaceEmbedding(BaseEmbedding):
device = "cpu"
self._device = device
cache_folder = cache_folder or get_cache_dir()
if model is None:
model_name = model_name or DEFAULT_HUGGINGFACE_EMBEDDING_MODEL
self._model = AutoModel.from_pretrained(
......
......@@ -2,6 +2,8 @@ from typing import Dict, Type
from llama_index.embeddings.base import BaseEmbedding
from llama_index.embeddings.google import GoogleUnivSentEncoderEmbedding
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.embeddings.huggingface_optimum import OptimumEmbedding
from llama_index.embeddings.langchain import LangchainEmbedding
from llama_index.embeddings.openai import OpenAIEmbedding
from llama_index.embeddings.utils import resolve_embed_model
......@@ -12,6 +14,8 @@ RECOGNIZED_EMBEDDINGS: Dict[str, Type[BaseEmbedding]] = {
OpenAIEmbedding.class_name(): OpenAIEmbedding,
LangchainEmbedding.class_name(): LangchainEmbedding,
MockEmbedding.class_name(): MockEmbedding,
HuggingFaceEmbedding.class_name(): HuggingFaceEmbedding,
OpenAIEmbedding.class_name(): OpenAIEmbedding,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment