Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
OurBuilding Ambient Agents with LangGraph course is now available on LangChain Academy!
Open In ColabOpen on GitHub

BGE on Hugging Face

BGE models on the HuggingFace are one ofthe best open-source embedding models.BGE model is created by theBeijing Academy of Artificial Intelligence (BAAI).BAAI is a private non-profit organization engaged in AI research and development.

This notebook shows how to useBGE Embeddings throughHugging Face

%pip install--upgrade--quiet  sentence_transformers
from langchain_community.embeddingsimport HuggingFaceBgeEmbeddings

model_name="BAAI/bge-small-en"
model_kwargs={"device":"cpu"}
encode_kwargs={"normalize_embeddings":True}
hf= HuggingFaceBgeEmbeddings(
model_name=model_name, model_kwargs=model_kwargs, encode_kwargs=encode_kwargs
)

Note that you need to passquery_instruction="" formodel_name="BAAI/bge-m3" seeFAQ BGE M3.

embedding= hf.embed_query("hi this is harrison")
len(embedding)
384

Related


[8]ページ先頭

©2009-2025 Movatter.jp