Comments (9)
@laozhu1900 do you happen to have a reprodceable code snippet for sharing, we can try to reproduce it in house.
from milvus.
@laozhu1900 Hello, could you please provide the collection schema?
And, which output fields are specified to search?
from milvus.
PrimaryKey VarChar(218),
10 columns' type is VarChar(218).
one column type is int64.
two columns is int32,
model Dimension is 256.
When I search , output is all columns.
Only model build index.
from milvus.
Hi, @laozhu1900, I am unable to reproduce this issue. Could you please help confirm if my script differs from yours? If there are no differences, could you try running it to see if the issue persists?
import time
import string
import random
import numpy as np
from pymilvus import (
connections,
utility,
FieldSchema, CollectionSchema, DataType,
Collection,
)
fmt = "\n=== {:30} ===\n"
search_latency_fmt = "search latency = {:.4f}s"
num_entities, dim = 1218, 256
str_length = 218
#################################################################################
# connect to Milvus
print(fmt.format("start connecting to Milvus"))
connections.connect("default", host="localhost", port="19530")
has = utility.has_collection("hello_milvus")
print(f"Does collection hello_milvus exist in Milvus: {has}")
###############################################################################
print(fmt.format("Drop collection `hello_milvus`"))
utility.drop_collection("hello_milvus")
#################################################################################
# create collection
fields = [
FieldSchema(name="pk", dtype=DataType.VARCHAR, is_primary=True, auto_id=False, max_length=str_length),
FieldSchema(name="s0", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s1", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s2", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s3", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s4", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s5", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s6", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s7", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s8", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="s9", dtype=DataType.VARCHAR, max_length=str_length),
FieldSchema(name="random0", dtype=DataType.DOUBLE),
FieldSchema(name="random1", dtype=DataType.FLOAT),
FieldSchema(name="embeddings", dtype=DataType.FLOAT_VECTOR, dim=dim)
]
schema = CollectionSchema(fields, "hello_milvus is the simplest demo to introduce the APIs")
print(fmt.format("Create collection `hello_milvus`"))
hello_milvus = Collection("hello_milvus", schema, consistency_level="Strong")
################################################################################
# create index
print(fmt.format("Start Creating index IVF_FLAT"))
index = {
"index_type": "IVF_SQ8",
"metric_type": "L2",
"params": {"nlist": 128},
}
hello_milvus.create_index("embeddings", index)
################################################################################
# load
print(fmt.format("Start loading"))
hello_milvus.load()
################################################################################
# insert data
def randomstr(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(length))
print(fmt.format("Start inserting entities"))
rng = np.random.default_rng(seed=19530)
entities = [
# provide the pk field because `auto_id` is set to False
[str(f'primary_key_{i}') for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
[randomstr(str_length) for i in range(num_entities)],
rng.random(num_entities).tolist(), # field random, only supports list
rng.random(num_entities).tolist(), # field random, only supports list
rng.random((num_entities, dim), np.float32), # field embeddings, supports numpy.ndarray and list
]
insert_result = hello_milvus.upsert(entities)
# hello_milvus.flush()
# print(f"Number of entities in Milvus: {hello_milvus.num_entities}") # check the num_entities
# -----------------------------------------------------------------------------
# search based on vector similarity
print(fmt.format("Start searching based on vector similarity"))
vectors_to_search = entities[-1][-1:]
search_params = {
"metric_type": "L2",
"params": {"nprobe": 10},
}
for i in range(10):
start_time = time.time()
result = hello_milvus.search(vectors_to_search, "embeddings", search_params, limit=1024, output_fields=["*"])
end_time = time.time()
print(search_latency_fmt.format(end_time - start_time))
from milvus.
ok , I try it
from milvus.
/assign @laozhu1900
/unassign
from milvus.
Hi, @laozhu1900, I am unable to reproduce this issue. Could you please help confirm if my script differs from yours? If there are no differences, could you try running it to see if the issue persists?
import time import string import random import numpy as np from pymilvus import ( connections, utility, FieldSchema, CollectionSchema, DataType, Collection, ) fmt = "\n=== {:30} ===\n" search_latency_fmt = "search latency = {:.4f}s" num_entities, dim = 1218, 256 str_length = 218 ################################################################################# # connect to Milvus print(fmt.format("start connecting to Milvus")) connections.connect("default", host="localhost", port="19530") has = utility.has_collection("hello_milvus") print(f"Does collection hello_milvus exist in Milvus: {has}") ############################################################################### print(fmt.format("Drop collection `hello_milvus`")) utility.drop_collection("hello_milvus") ################################################################################# # create collection fields = [ FieldSchema(name="pk", dtype=DataType.VARCHAR, is_primary=True, auto_id=False, max_length=str_length), FieldSchema(name="s0", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s1", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s2", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s3", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s4", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s5", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s6", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s7", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s8", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="s9", dtype=DataType.VARCHAR, max_length=str_length), FieldSchema(name="random0", dtype=DataType.DOUBLE), FieldSchema(name="random1", dtype=DataType.FLOAT), FieldSchema(name="embeddings", dtype=DataType.FLOAT_VECTOR, dim=dim) ] schema = CollectionSchema(fields, "hello_milvus is the simplest demo to introduce the APIs") print(fmt.format("Create collection `hello_milvus`")) hello_milvus = Collection("hello_milvus", schema, consistency_level="Strong") ################################################################################ # create index print(fmt.format("Start Creating index IVF_FLAT")) index = { "index_type": "IVF_SQ8", "metric_type": "L2", "params": {"nlist": 128}, } hello_milvus.create_index("embeddings", index) ################################################################################ # load print(fmt.format("Start loading")) hello_milvus.load() ################################################################################ # insert data def randomstr(length): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(length)) print(fmt.format("Start inserting entities")) rng = np.random.default_rng(seed=19530) entities = [ # provide the pk field because `auto_id` is set to False [str(f'primary_key_{i}') for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], [randomstr(str_length) for i in range(num_entities)], rng.random(num_entities).tolist(), # field random, only supports list rng.random(num_entities).tolist(), # field random, only supports list rng.random((num_entities, dim), np.float32), # field embeddings, supports numpy.ndarray and list ] insert_result = hello_milvus.upsert(entities) # hello_milvus.flush() # print(f"Number of entities in Milvus: {hello_milvus.num_entities}") # check the num_entities # ----------------------------------------------------------------------------- # search based on vector similarity print(fmt.format("Start searching based on vector similarity")) vectors_to_search = entities[-1][-1:] search_params = { "metric_type": "L2", "params": {"nprobe": 10}, } for i in range(10): start_time = time.time() result = hello_milvus.search(vectors_to_search, "embeddings", search_params, limit=1024, output_fields=["*"]) end_time = time.time() print(search_latency_fmt.format(end_time - start_time))
Use this demo, I can't reproduce , In my demo, if the outFields have embeddings, it report error ...
Is this error related to data in collection ?
from milvus.
@laozhu1900 Have you manually set the timeout for the search request?
from milvus.
@laozhu1900 Additionally, could you dump all the upsert data and provide it to us?
from milvus.
Related Issues (20)
- [Bug]: clustering compaction collectionIsCompacting logic is wrong HOT 2
- [Enhancement]: Show stack backtrace info if milvus crashes with signal generated from non-go thread
- [Enhancement]: use the collection id to group msg pack in the msg dispatcher
- [Enhancement]: Optimizing GitHub Cache Usage for Milvus Builds: Reducing Redundancy and Prioritizing Valuable Artifacts
- [Bug]: proxy auth interceptor may fail in first few search requests due to hook initialization logic
- [Bug]: testReduceSearchWithExpr container-overflow HOT 1
- [Bug]: No milvus processes were found on the GPU. HOT 6
- [Bug]: `milvus_proxy_insert_vectors_count` is missing in the monitor metrics HOT 3
- [Bug]: The lower version of IndexNode cannot create vector indexes for the higher version of QueryNode HOT 2
- [Enhancement]: Can we have different weights for each collection while doing a similarity search? HOT 6
- [Feature]: Support EKS Pod Identities (Upgrade minio-client version) HOT 1
- [Enhancement]: gc Import task file if success HOT 2
- [Bug]: fail to insert if auto_id=True HOT 4
- [Feature]: Support IPv6 HOT 1
- [Feature]: Add a null bitmap concatenater
- [Bug]: [major] search results are empty when searching with filter in "key == uuid (vchar)" after major compaction
- [Enhancement]: support l2 single compaction
- [Bug]: memory leak during parse query plan
- [Bug]: [benchmark] test standalone crash because of build index core dump HOT 3
- [Enhancement]: Added csv file support in bulkinsert function. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from milvus.