Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: pymilvus.exceptions.MilvusException: <MilvusException: (code=65535, message=fail to search on QueryNode 7: worker(7) query failed: metric type not match: invalid parameter[expected=L2][actual=IP])> #31565

Closed
1 task done
CyanMystery opened this issue Mar 25, 2024 · 6 comments
Assignees
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@CyanMystery
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Environment

pymilvus                      2.4.0
milvusdb/milvus:v2.4.0-rc.1  docker

Current Behavior

docs = self.milvus.similarity_search_with_score_by_vector(embeddings, top_k, param=kbs_config.get("milvus_kwargs")["search_params"])
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\langchain_community\vectorstores\milvus.py", line 747, in similarity_search_with_score_by_vector
res = self.col.search(
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\orm\collection.py", line 792, in search
resp = conn.search(
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\decorators.py", line 147, in handler
raise e from e
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\decorators.py", line 143, in handler
return func(*args, **kwargs)
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\decorators.py", line 182, in handler
return func(self, *args, **kwargs)
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\decorators.py", line 122, in handler
raise e from e
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\decorators.py", line 87, in handler
return func(*args, **kwargs)
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\client\grpc_handler.py", line 794, in search
return self._execute_search(request, timeout, round_decimal=round_decimal, **kwargs)
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\client\grpc_handler.py", line 735, in _execute_search
raise e from e
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\client\grpc_handler.py", line 728, in _execute_search
check_status(response.status)
File "F:\Program Files\anaconda3\envs\chat\lib\site-packages\pymilvus\client\utils.py", line 60, in check_status
raise MilvusException(status.code, status.reason, status.error_code)
pymilvus.exceptions.MilvusException: <MilvusException: (code=65535, message=fail to search on QueryNode 7: worker(7) query failed: metric type not match: invalid parameter[expected=L2][actual=IP])>

Expected Behavior

No response

Steps To Reproduce

from langchain.vectorstores.milvus import Milvus

self.milvus = Milvus(embedding_function=EmbeddingsFunAdapter(self.embed_model),
                             collection_name=self.kb_name,
                             connection_args=kbs_config.get("milvus"),
                             index_params=kbs_config.get("milvus_kwargs")["index_params"],
                             search_params=kbs_config.get("milvus_kwargs")["search_params"],
                             auto_id=True
                             )

Milvus Log

No response

Anything else?

index_params and search_params The configuration file is IP (or COSINE),Only two metric L2 will work.

@CyanMystery CyanMystery added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 25, 2024
@yanliang567
Copy link
Contributor

/assign @wxywb
/unassign

@sre-ci-robot
Copy link
Contributor

@yanliang567: GitHub didn't allow me to assign the following users: wxywb.

Note that only milvus-io members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @wxywb
/unassign

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 25, 2024
@yanliang567 yanliang567 added this to the 2.4.0 milestone Mar 25, 2024
@yanliang567
Copy link
Contributor

/assign @wxyucs

@wuqi930907
Copy link

Has this bug been fixed?I had the same problem.
pymilvus 2.4.8
milvusdb/milvus:v2.4.5 docker

@zc277584121
Copy link

@wuqi930907
from langchain.vectorstores.milvus import Milvus is outdated,
you can use the langchain_milvus to get the latest langchain milvus integration update

pip install -U langchain-milvus
from langchain_milvus import Milvus

@wuqi930907
Copy link

@zc277584121
Thanks, but I still have problems.
Following is my code:

`from langchain_milvus import Milvus
from langchain_huggingface import HuggingFaceEmbeddings

embedding = HuggingFaceEmbeddings(model_name="./TencentBAC/Conan-embedding-v1")

vecs = Milvus(embedding_function=embedding,
connection_args={"host": "127.0.0.1", "port": 19530, "db_name": "default"},
collection_name="AI")

search_parameters = {
"metric_type": "COSINE",
"params": {
'nprobe': 10,
'level': 1
}
}

query = "llama3中做了哪些模型架构方面的修改"
data = vecs.similarity_search_with_score(query, 4, param=search_parameters)
print(data[0][1])`

File "/home/gtgpu/.conda/envs/RAG_demo/lib/python3.10/site-packages/pymilvus/client/utils.py", line 63, in check_status
raise MilvusException(status.code, status.reason, status.error_code)
pymilvus.exceptions.MilvusException: <MilvusException: (code=65535, message=fail to search on QueryNode 3: worker(3) query failed: metric type not match: invalid parameter[expected=L2][actual=COSINE])>

Environment:
milvusdb/milvus:v2.4.5 docker
accelerate 0.34.2
aiohappyeyeballs 2.4.2
aiohttp 3.10.8
aiosignal 1.3.1
annotated-types 0.7.0
anyio 4.6.0
async-timeout 4.0.3
attrs 24.2.0
bitsandbytes 0.42.0
certifi 2024.8.30
charset-normalizer 3.3.2
click 8.1.7
cloudpickle 3.0.0
dataclasses-json 0.6.7
datasets 3.0.1
dill 0.3.8
diskcache 5.6.3
distro 1.9.0
docx2txt 0.8
einops 0.8.0
environs 9.5.0
exceptiongroup 1.2.2
fastapi 0.115.0
filelock 3.16.1
frozenlist 1.4.1
fsspec 2024.6.1
gguf 0.10.0
greenlet 3.1.1
grpcio 1.66.2
h11 0.14.0
httpcore 1.0.5
httptools 0.6.1
httpx 0.27.2
huggingface-hub 0.25.1
idna 3.10
importlib_metadata 8.5.0
interegular 0.3.3
Jinja2 3.1.4
jiter 0.5.0
joblib 1.4.2
jsonpatch 1.33
jsonpointer 3.0.0
jsonschema 4.23.0
jsonschema-specifications 2023.12.1
langchain 0.3.1
langchain-community 0.3.1
langchain-core 0.3.6
langchain-huggingface 0.1.0
langchain-milvus 0.1.6rc2
langchain-text-splitters 0.3.0
langsmith 0.1.129
lark 1.2.2
llvmlite 0.43.0
lm-format-enforcer 0.10.6
loguru 0.7.2
MarkupSafe 2.1.5
marshmallow 3.22.0
milvus-lite 2.4.10
mistral_common 1.4.4
modelscope 1.18.1
mpmath 1.3.0
msgpack 1.1.0
msgspec 0.18.6
multidict 6.1.0
multiprocess 0.70.16
mypy-extensions 1.0.0
nest-asyncio 1.6.0
networkx 3.3
numba 0.60.0
numpy 1.26.4
nvidia-cublas-cu12 12.1.3.1
nvidia-cuda-cupti-cu12 12.1.105
nvidia-cuda-nvrtc-cu12 12.1.105
nvidia-cuda-runtime-cu12 12.1.105
nvidia-cudnn-cu12 9.1.0.70
nvidia-cufft-cu12 11.0.2.54
nvidia-curand-cu12 10.3.2.106
nvidia-cusolver-cu12 11.4.5.107
nvidia-cusparse-cu12 12.1.0.106
nvidia-ml-py 12.560.30
nvidia-nccl-cu12 2.20.5
nvidia-nvjitlink-cu12 12.6.68
nvidia-nvtx-cu12 12.1.105
openai 1.50.2
orjson 3.10.7
outlines 0.0.46
packaging 24.1
pandas 2.2.3
partial-json-parser 0.2.1.1.post4
pillow 10.4.0
pip 24.2
prometheus_client 0.21.0
prometheus-fastapi-instrumentator 7.0.0
protobuf 5.28.2
psutil 6.0.0
py-cpuinfo 9.0.0
pyairports 2.1.1
pyarrow 17.0.0
pycountry 24.6.1
pydantic 2.9.2
pydantic_core 2.23.4
pydantic-settings 2.5.2
pymilvus 2.4.8
pypdf 5.0.0
python-dateutil 2.9.0.post0
python-dotenv 1.0.1
pytz 2024.2
PyYAML 6.0.2
pyzmq 26.2.0
ray 2.37.0
referencing 0.35.1
regex 2024.9.11
requests 2.32.3
rpds-py 0.20.0
safetensors 0.4.5
scikit-learn 1.5.2
scipy 1.14.1
sentence-transformers 3.1.1
sentencepiece 0.2.0
setuptools 75.1.0
six 1.16.0
sniffio 1.3.1
SQLAlchemy 2.0.35
starlette 0.38.6
sympy 1.13.3
tenacity 8.5.0
threadpoolctl 3.5.0
tiktoken 0.7.0
tokenizers 0.20.0
torch 2.4.0
torchvision 0.19.0
tqdm 4.66.5
transformers 4.45.1
triton 3.0.0
typing_extensions 4.12.2
typing-inspect 0.9.0
tzdata 2024.2
ujson 5.10.0
urllib3 2.2.3
uvicorn 0.31.0
uvloop 0.20.0
vllm 0.6.2
watchfiles 0.24.0
websockets 13.1
wheel 0.44.0
xformers 0.0.27.post2
xxhash 3.5.0
yarl 1.13.1
zipp 3.20.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

6 participants