Find answers from the community

Updated 7 months ago

hey guys! I'm trying to use Milvus

At a glance

The community member is trying to use the Milvus vector store with hybrid retrieval, but is having issues with the BGEM3F embedding model. They have installed the FlagEmbedding package, but are still unable to import the BGEM3FlagModel. The community members have suggested trying to run the import directly, as well as updating the FlagEmbedding package, but the issue persists. There is no explicitly marked answer in the comments.

hey guys! I'm trying to use Milvus vector store with hybrid retrieval and I having issues with BGEM3F embedding model:
Plain Text
pip install FlagEmbedding

I create my vector store:
Plain Text
        vector_store = MilvusVectorStore(
            collection_name=app_settings.milvus_collection,
            dim=app_settings.vector_dim,
            overwrite=app_settings.overwrite,
            token=app_settings.milvus_token,
            uri=app_settings.milvus_uri,
            enable_sparse=app_settings.enable_sparse,
            hybrid_ranker=app_settings.hybrid_ranker,
            hybrid_ranker_params=app_settings.hybrid_ranker_params,            
        )

and then I have this in my terminal:
Plain Text
DEBUG:pymilvus.milvus_client.milvus_client:Created new connection using: d28ca022b4884f4ab606408820a88944
WARNING:llama_index.vector_stores.milvus.base:Sparse embedding function is not provided, using default.
INFO:datasets:PyTorch version 2.4.0 available.
CRITICAL:llama_index.vector_stores.milvus.utils:Cannot import BGEM3FlagModel from FlagEmbedding. It seems it is not installed. Please install it using:
pip install FlagEmbedding


but in fact it has already been installed
L
Y
10 comments
Are you running in a notebook? You'll have to restart that if so
This is the codeblock raising this error, if you wanted to try it on its own

Plain Text
        try:
            from FlagEmbedding import BGEM3FlagModel

            self.model = BGEM3FlagModel("BAAI/bge-m3", use_fp16=False)
        except Exception as ImportError:
            error_info = (
                "Cannot import BGEM3FlagModel from FlagEmbedding. It seems it is not installed. "
                "Please install it using:\n"
                "pip install FlagEmbedding\n"
            )
            logger.fatal(error_info)
            sys.exit(1)
I'm running it in a python file
not sure. Try running the above import and see if it actually works I guess? Maybe you need pip install -U BGEM3FlagModel
it doesn't work πŸ˜•
Attachment
image.png
oh whoops, I suck at typing lol
pip install -U FlagEmbedding
BGEM3FlagModel is the import πŸ˜…
haha, that one ran well but same message as above

CRITICAL:llama_index.vector_stores.milvus.utils:Cannot import BGEM3FlagModel from FlagEmbedding. It seems it is not installed. Please install it using:
pip install FlagEmbedding
Add a reply
Sign up and join the conversation on Discord