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]: Sparse vector insertion not working #34063

Closed
1 task done
skarot2 opened this issue Jun 21, 2024 · 10 comments
Closed
1 task done

[Bug]: Sparse vector insertion not working #34063

skarot2 opened this issue Jun 21, 2024 · 10 comments
Assignees
Labels
kind/bug Issues or changes related a bug triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@skarot2
Copy link

skarot2 commented Jun 21, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: 2.4.0
- Deployment mode(standalone or cluster): cluster
- MQ type(rocksmq, pulsar or kafka): kafka    
- SDK version(e.g. pymilvus v2.0.0rc2): Pymilvus 2.4.0 and above
- OS(Ubuntu or CentOS): Mac
- CPU/Memory: 32gb/1TB
- GPU: -
- Others: -

Current Behavior

When i run hello_sparse.py script, the get the error saying :
"MilvusException: <MilvusException: (code=65535, message=%!s() is not supported now)>"

This error occurs right after I start inserting into collection.

Expected Behavior

Daya should be inserted into the collection.

Steps To Reproduce

I am using python3.12.3 on MAC, with Milvus and pymilvus version 2.4.0
I am running python3 hello_sparse.py from VS code.
Script can be found here:
https://github.com/milvus-io/pymilvus/blob/2.4/examples/hello_sparse.py

Milvus Log

2024-06-21 13:59:34 === start connecting to Milvus ===
2024-06-21 13:59:35 Does collection hello_sparse exist in Milvus: True. Dropping
2024-06-21 13:59:35 === Create collection hello_sparse ===
2024-06-21 13:59:37 hello_sparse has 0 entities(0.0M), indexed False
2024-06-21 13:59:37 === Start creating entities to insert ===
2024-06-21 13:59:37 === Start inserting entities ===
RPC error: [batch_insert], <MilvusException: (code=65535, message=%!s() is not supported now)>, <Time:{'RPC start': '2024-06-21 13:59:37.289951', 'RPC error': '2024-06-21 13:59:39.011264'}>

MilvusException Traceback (most recent call last)
[... skipping hidden 1 frame]

Cell In[200], line 76
75 log(fmt.format("Start inserting entities"))
---> 76 insert_result = hello_sparse.insert(entities)
78 # -----------------------------------------------------------------------------
79 # create index

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/orm/collection.py:513, in Collection.insert(self, data, partition_name, timeout, **kwargs)
512 entities = Prepare.prepare_insert_data(data, self.schema)
--> 513 return conn.batch_insert(
514 self._name,
515 entities,
516 partition_name,
517 timeout=timeout,
518 schema=self._schema_dict,
519 **kwargs,
520 )

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:147, in error_handler..wrapper..handler(*args, **kwargs)
146 LOGGER.error(f"RPC error: [{inner_name}], {e}, Time:{record_dict}")
--> 147 raise e from e
148 except grpc.FutureTimeoutError as e:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:143, in error_handler..wrapper..handler(*args, **kwargs)
142 record_dict["RPC start"] = str(datetime.datetime.now())
--> 143 return func(*args, **kwargs)
144 except MilvusException as e:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:182, in tracing_request..wrapper..handler(self, *args, **kwargs)
181 self.set_onetime_request_id(req_id)
--> 182 return func(self, *args, **kwargs)

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:122, in retry_on_rpc_failure..wrapper..handler(*args, **kwargs)
121 else:
--> 122 raise e from e
123 except Exception as e:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:87, in retry_on_rpc_failure..wrapper..handler(*args, **kwargs)
86 try:
---> 87 return func(*args, **kwargs)
88 except grpc.RpcError as e:
89 # Do not retry on these codes

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:582, in GrpcHandler.batch_insert(self, collection_name, entities, partition_name, timeout, **kwargs)
581 return MutationFuture(None, None, err)
--> 582 raise err from err
583 else:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:576, in GrpcHandler.batch_insert(self, collection_name, entities, partition_name, timeout, **kwargs)
575 response = rf.result()
--> 576 check_status(response.status)
577 m = MutationResult(response)

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/utils.py:63, in check_status(status)
62 if status.code != 0 or status.error_code != 0:
---> 63 raise MilvusException(status.code, status.reason, status.error_code)

MilvusException: <MilvusException: (code=65535, message=%!s() is not supported now)>

The above exception was the direct cause of the following exception:

MilvusException Traceback (most recent call last)
[... skipping hidden 1 frame]

Cell In[200], line 76
75 log(fmt.format("Start inserting entities"))
---> 76 insert_result = hello_sparse.insert(entities)
78 # -----------------------------------------------------------------------------
79 # create index

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/orm/collection.py:513, in Collection.insert(self, data, partition_name, timeout, **kwargs)
512 entities = Prepare.prepare_insert_data(data, self.schema)
--> 513 return conn.batch_insert(
514 self._name,
515 entities,
516 partition_name,
517 timeout=timeout,
518 schema=self._schema_dict,
519 **kwargs,
520 )

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:147, in error_handler..wrapper..handler(*args, **kwargs)
146 LOGGER.error(f"RPC error: [{inner_name}], {e}, Time:{record_dict}")
--> 147 raise e from e
148 except grpc.FutureTimeoutError as e:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:143, in error_handler..wrapper..handler(*args, **kwargs)
142 record_dict["RPC start"] = str(datetime.datetime.now())
--> 143 return func(*args, **kwargs)
144 except MilvusException as e:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:182, in tracing_request..wrapper..handler(self, *args, **kwargs)
181 self.set_onetime_request_id(req_id)
--> 182 return func(self, *args, **kwargs)

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:122, in retry_on_rpc_failure..wrapper..handler(*args, **kwargs)
121 else:
--> 122 raise e from e
123 except Exception as e:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:87, in retry_on_rpc_failure..wrapper..handler(*args, **kwargs)
86 try:
---> 87 return func(*args, **kwargs)
88 except grpc.RpcError as e:
89 # Do not retry on these codes

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:582, in GrpcHandler.batch_insert(self, collection_name, entities, partition_name, timeout, **kwargs)
581 return MutationFuture(None, None, err)
--> 582 raise err from err
583 else:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:576, in GrpcHandler.batch_insert(self, collection_name, entities, partition_name, timeout, **kwargs)
575 response = rf.result()
--> 576 check_status(response.status)
577 m = MutationResult(response)

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/utils.py:63, in check_status(status)
62 if status.code != 0 or status.error_code != 0:
---> 63 raise MilvusException(status.code, status.reason, status.error_code)

MilvusException: <MilvusException: (code=65535, message=%!s() is not supported now)>

The above exception was the direct cause of the following exception:

MilvusException Traceback (most recent call last)
Cell In[200], line 76
70 entities = [
71 rng.random(num_entities).tolist(),
72 [generate_sparse_vector(dim, nnz) for _ in range(num_entities)],
73 ]
75 log(fmt.format("Start inserting entities"))
---> 76 insert_result = hello_sparse.insert(entities)
78 # -----------------------------------------------------------------------------
79 # create index
80 if not hello_sparse.has_index():

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/orm/collection.py:513, in Collection.insert(self, data, partition_name, timeout, **kwargs)
511 check_insert_schema(self.schema, data)
512 entities = Prepare.prepare_insert_data(data, self.schema)
--> 513 return conn.batch_insert(
514 self._name,
515 entities,
516 partition_name,
517 timeout=timeout,
518 schema=self._schema_dict,
519 **kwargs,
520 )

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:147, in error_handler..wrapper..handler(*args, **kwargs)
145 record_dict["RPC error"] = str(datetime.datetime.now())
146 LOGGER.error(f"RPC error: [{inner_name}], {e}, Time:{record_dict}")
--> 147 raise e from e
148 except grpc.FutureTimeoutError as e:
149 record_dict["gRPC timeout"] = str(datetime.datetime.now())

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:143, in error_handler..wrapper..handler(*args, **kwargs)
141 try:
142 record_dict["RPC start"] = str(datetime.datetime.now())
--> 143 return func(*args, **kwargs)
144 except MilvusException as e:
145 record_dict["RPC error"] = str(datetime.datetime.now())

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:182, in tracing_request..wrapper..handler(self, *args, **kwargs)
180 if req_id:
181 self.set_onetime_request_id(req_id)
--> 182 return func(self, *args, **kwargs)

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:122, in retry_on_rpc_failure..wrapper..handler(*args, **kwargs)
120 back_off = min(back_off * back_off_multiplier, max_back_off)
121 else:
--> 122 raise e from e
123 except Exception as e:
124 raise e from e

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/decorators.py:87, in retry_on_rpc_failure..wrapper..handler(*args, **kwargs)
85 while True:
86 try:
---> 87 return func(*args, **kwargs)
88 except grpc.RpcError as e:
89 # Do not retry on these codes
90 if e.code() in IGNORE_RETRY_CODES:

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:582, in GrpcHandler.batch_insert(self, collection_name, entities, partition_name, timeout, **kwargs)
580 if kwargs.get("_async", False):
581 return MutationFuture(None, None, err)
--> 582 raise err from err
583 else:
584 return m

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:576, in GrpcHandler.batch_insert(self, collection_name, entities, partition_name, timeout, **kwargs)
573 return f
575 response = rf.result()
--> 576 check_status(response.status)
577 m = MutationResult(response)
578 ts_utils.update_collection_ts(collection_name, m.timestamp)

File ~/Downloads/milvus/myenv/lib/python3.12/site-packages/pymilvus/client/utils.py:63, in check_status(status)
61 def check_status(status: Status):
62 if status.code != 0 or status.error_code != 0:
---> 63 raise MilvusException(status.code, status.reason, status.error_code)

MilvusException: <MilvusException: (code=65535, message=%!s() is not supported now)>

Anything else?

No response

@skarot2 skarot2 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 Jun 21, 2024
@xiaofan-luan
Copy link
Contributor

what is the milvus server version?
could you upgrade to 2.4.5 and try? I didn't search for " is not supported now" on current code.

@xiaofan-luan
Copy link
Contributor

if you can get milvus log we can take a deep look

@yanliang567
Copy link
Contributor

/assign @skarot2
please refer this doc to export the whole Milvus logs for investigation. For Milvus installed with docker-compose, you can use docker-compose logs > milvus.log to export the logs.

/unassign

@sre-ci-robot sre-ci-robot assigned skarot2 and unassigned yanliang567 Jun 22, 2024
@yanliang567 yanliang567 added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 22, 2024
@louis-sanna-eki
Copy link

@xiaofan-luan

I have exactly the same error on milvus 2.4.1 when inserting a sparse vector.

id_field = FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=False)
vector = FieldSchema(name="vector", dtype=DataType.FLOAT_VECTOR, dim=768)
bm25_vector = FieldSchema(name="bm25_vector", dtype=DataType.SPARSE_FLOAT_VECTOR)

# Create schema
schema = CollectionSchema(fields=[id_field, vector, bm25_vector], enable_dynamic_field=True)

mv_client.create_collection(collection_name="documents", schema=schema)
# Creation du dictionnaire de points
uniq_id = 0
data = []

unique_package_names = set()

def csr_to_tuples(csr):
    return [(int(i), float(v)) for i, v in zip(csr.indices, csr.data)]

for path in PATHS[:1]:
    df_docs = pd.read_parquet(path)
    for index, row in df_docs.iterrows():
        if index > 0:
            break
        docs_embeddings = bm25_ef.encode_documents([row["content"]])
        bm25_vector = list(docs_embeddings)[0]
        sparse_iterable = csr_to_tuples(bm25_vector)
        
        print("bm25_vector", bm25_vector)
        print("sparse_iterable", sparse_iterable)
        
        uniq_id += 1
        data.append({
            "id": uniq_id,
            "content": row["content"],
            "vector": row["semantic_vector"],
            "bm25_vector": sparse_iterable,
            "page_number": row["page_number"],
            "file_name": row["file_name"],
            "source_file": row["file_path"], # dossier is not a correct value
            "dossier": row["dossier"],
            "type": row["type"],
            "numero": row["numero"],
            "package_name": row["package_name"],
        })
        unique_package_names.add(row["package_name"])

# Chargement
import tqdm

def batch_generator(lst, batch_size):
    for i in range(0, len(lst), batch_size):
        yield lst[i : i + batch_size]

for batch in tqdm.tqdm(batch_generator(data, 1000)):
    mv_client.insert(collection_name="documents", data=batch)

sparse_iterable [(0, 1.7123764753341675), (1, 1.7123764753341675), (2, 1.3021384477615356), (3, 1.3021384477615356), (4, 1.3021384477615356), (5, 1.3021384477615356), (6, 1.3021384477615356), (7, 1.3021384477615356), (8, 1.3021384477615356), (9, 1.3021384477615356), (10, 1.3021384477615356), (11, 1.3021384477615356), (12, 1.3021384477615356), (13, 1.3021384477615356), (14, 1.7123764753341675), (15, 1.3021384477615356), (16, 1.3021384477615356), (17, 1.7123764753341675), (18, 1.3021384477615356), (19, 1.3021384477615356), (20, 1.3021384477615356), (21, 1.3021384477615356), (22, 1.3021384477615356)]

0it [00:00, ?it/s]RPC error: [insert_rows], <MilvusException: (code=65535, message=%!s(<nil>) is not supported now)>, <Time:{'RPC start': '2024-06-27 14:20:04.892501', 'RPC error': '2024-06-27 14:20:04.896958'}>
0it [00:00, ?it/s]
---------------------------------------------------------------------------
MilvusException                           Traceback (most recent call last)
    [... skipping hidden 1 frame]

Cell In[17], line 46
     45 for batch in tqdm.tqdm(batch_generator(data, 1000)):
---> 46     mv_client.insert(collection_name="documents", data=batch)

File /opt/conda/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py:218, in MilvusClient.insert(self, collection_name, data, timeout, partition_name, **kwargs)
    217 except Exception as ex:
--> 218     raise ex from ex
    219 return {"insert_count": res.insert_count, "ids": res.primary_keys}

File /opt/conda/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py:214, in MilvusClient.insert(self, collection_name, data, timeout, partition_name, **kwargs)
    213 try:
--> 214     res = conn.insert_rows(
    215         collection_name, data, partition_name=partition_name, timeout=timeout
    216     )
    217 except Exception as ex:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:147, in error_handler.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    146     LOGGER.error(f"RPC error: [{inner_name}], {e}, <Time:{record_dict}>")
--> 147     raise e from e
    148 except grpc.FutureTimeoutError as e:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:143, in error_handler.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    142     record_dict["RPC start"] = str(datetime.datetime.now())
--> 143     return func(*args, **kwargs)
    144 except MilvusException as e:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:182, in tracing_request.<locals>.wrapper.<locals>.handler(self, *args, **kwargs)
    181     self.set_onetime_request_id(req_id)
--> 182 return func(self, *args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:122, in retry_on_rpc_failure.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    121     else:
--> 122         raise e from e
    123 except Exception as e:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:87, in retry_on_rpc_failure.<locals>.wrapper.<locals>.handler(*args, **kwargs)
     86 try:
---> 87     return func(*args, **kwargs)
     88 except grpc.RpcError as e:
     89     # Do not retry on these codes

File /opt/conda/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py:514, in GrpcHandler.insert_rows(self, collection_name, entities, partition_name, timeout, **kwargs)
    513 response = rf.result()
--> 514 check_status(response.status)
    515 m = MutationResult(response)

File /opt/conda/lib/python3.10/site-packages/pymilvus/client/utils.py:60, in check_status(status)
     59 if status.code != 0 or status.error_code != 0:
---> 60     raise MilvusException(status.code, status.reason, status.error_code)

MilvusException: <MilvusException: (code=65535, message=%!s(<nil>) is not supported now)>

The above exception was the direct cause of the following exception:

MilvusException                           Traceback (most recent call last)
    [... skipping hidden 1 frame]

Cell In[17], line 46
     45 for batch in tqdm.tqdm(batch_generator(data, 1000)):
---> 46     mv_client.insert(collection_name="documents", data=batch)

File /opt/conda/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py:218, in MilvusClient.insert(self, collection_name, data, timeout, partition_name, **kwargs)
    217 except Exception as ex:
--> 218     raise ex from ex
    219 return {"insert_count": res.insert_count, "ids": res.primary_keys}

File /opt/conda/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py:214, in MilvusClient.insert(self, collection_name, data, timeout, partition_name, **kwargs)
    213 try:
--> 214     res = conn.insert_rows(
    215         collection_name, data, partition_name=partition_name, timeout=timeout
    216     )
    217 except Exception as ex:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:147, in error_handler.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    146     LOGGER.error(f"RPC error: [{inner_name}], {e}, <Time:{record_dict}>")
--> 147     raise e from e
    148 except grpc.FutureTimeoutError as e:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:143, in error_handler.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    142     record_dict["RPC start"] = str(datetime.datetime.now())
--> 143     return func(*args, **kwargs)
    144 except MilvusException as e:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:182, in tracing_request.<locals>.wrapper.<locals>.handler(self, *args, **kwargs)
    181     self.set_onetime_request_id(req_id)
--> 182 return func(self, *args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:122, in retry_on_rpc_failure.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    121     else:
--> 122         raise e from e
    123 except Exception as e:

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:87, in retry_on_rpc_failure.<locals>.wrapper.<locals>.handler(*args, **kwargs)
     86 try:
---> 87     return func(*args, **kwargs)
     88 except grpc.RpcError as e:
     89     # Do not retry on these codes

File /opt/conda/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py:514, in GrpcHandler.insert_rows(self, collection_name, entities, partition_name, timeout, **kwargs)
    513 response = rf.result()
--> 514 check_status(response.status)
    515 m = MutationResult(response)

File /opt/conda/lib/python3.10/site-packages/pymilvus/client/utils.py:60, in check_status(status)
     59 if status.code != 0 or status.error_code != 0:
---> 60     raise MilvusException(status.code, status.reason, status.error_code)

MilvusException: <MilvusException: (code=65535, message=%!s(<nil>) is not supported now)>

The above exception was the direct cause of the following exception:

MilvusException                           Traceback (most recent call last)
Cell In[17], line 46
     43         yield lst[i : i + batch_size]
     45 for batch in tqdm.tqdm(batch_generator(data, 1000)):
---> 46     mv_client.insert(collection_name="documents", data=batch)

File /opt/conda/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py:218, in MilvusClient.insert(self, collection_name, data, timeout, partition_name, **kwargs)
    214     res = conn.insert_rows(
    215         collection_name, data, partition_name=partition_name, timeout=timeout
    216     )
    217 except Exception as ex:
--> 218     raise ex from ex
    219 return {"insert_count": res.insert_count, "ids": res.primary_keys}

File /opt/conda/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py:214, in MilvusClient.insert(self, collection_name, data, timeout, partition_name, **kwargs)
    212 # Insert into the collection.
    213 try:
--> 214     res = conn.insert_rows(
    215         collection_name, data, partition_name=partition_name, timeout=timeout
    216     )
    217 except Exception as ex:
    218     raise ex from ex

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:147, in error_handler.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    145     record_dict["RPC error"] = str(datetime.datetime.now())
    146     LOGGER.error(f"RPC error: [{inner_name}], {e}, <Time:{record_dict}>")
--> 147     raise e from e
    148 except grpc.FutureTimeoutError as e:
    149     record_dict["gRPC timeout"] = str(datetime.datetime.now())

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:143, in error_handler.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    141 try:
    142     record_dict["RPC start"] = str(datetime.datetime.now())
--> 143     return func(*args, **kwargs)
    144 except MilvusException as e:
    145     record_dict["RPC error"] = str(datetime.datetime.now())

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:182, in tracing_request.<locals>.wrapper.<locals>.handler(self, *args, **kwargs)
    180 if req_id:
    181     self.set_onetime_request_id(req_id)
--> 182 return func(self, *args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:122, in retry_on_rpc_failure.<locals>.wrapper.<locals>.handler(*args, **kwargs)
    120         back_off = min(back_off * back_off_multiplier, max_back_off)
    121     else:
--> 122         raise e from e
    123 except Exception as e:
    124     raise e from e

File /opt/conda/lib/python3.10/site-packages/pymilvus/decorators.py:87, in retry_on_rpc_failure.<locals>.wrapper.<locals>.handler(*args, **kwargs)
     85 while True:
     86     try:
---> 87         return func(*args, **kwargs)
     88     except grpc.RpcError as e:
     89         # Do not retry on these codes
     90         if e.code() in IGNORE_RETRY_CODES:

File /opt/conda/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py:514, in GrpcHandler.insert_rows(self, collection_name, entities, partition_name, timeout, **kwargs)
    512 rf = self._stub.Insert.future(request, timeout=timeout)
    513 response = rf.result()
--> 514 check_status(response.status)
    515 m = MutationResult(response)
    516 ts_utils.update_collection_ts(collection_name, m.timestamp)

File /opt/conda/lib/python3.10/site-packages/pymilvus/client/utils.py:60, in check_status(status)
     58 def check_status(status: Status):
     59     if status.code != 0 or status.error_code != 0:
---> 60         raise MilvusException(status.code, status.reason, status.error_code)

MilvusException: <MilvusException: (code=65535, message=%!s(<nil>) is not supported now)>

@louis-sanna-eki
Copy link

If i insert directly the csr_array I get.

ParamError: <ParamError: (code=1, message=invalid input for sparse float vector: expect 1 row)>

@yanliang567
Copy link
Contributor

I tried to reproduce the issue on milvus 2.4.5 and pymilvus 2.4.4, but no luck. could you please upgrade the milvus and pymilvus and retry? Here is the code that hard coded a few lines with yours:

sparse = [(0, 1.7123764753341675), (1, 1.7123764753341675), (2, 1.3021384477615356), (3, 1.3021384477615356), (4, 1.3021384477615356), (5, 1.3021384477615356), (6, 1.3021384477615356), (7, 1.3021384477615356), (8, 1.3021384477615356), (9, 1.3021384477615356), (10, 1.3021384477615356), (11, 1.3021384477615356), (12, 1.3021384477615356), (13, 1.3021384477615356), (14, 1.7123764753341675), (15, 1.3021384477615356), (16, 1.3021384477615356), (17, 1.7123764753341675), (18, 1.3021384477615356), (19, 1.3021384477615356), (20, 1.3021384477615356), (21, 1.3021384477615356), (22, 1.3021384477615356)]
rng = np.random.default_rng(seed=19530)
vector = rng.random((1, 768))[0]
batch = [{
    "id": 1,
    "content": "content",
    "vector": vector,
    "bm25_vector": sparse,
    "page_number": 1,
    "file_name": "file_name",
    "source_file": "file_path",  # dossier is not a correct value
    "dossier": "dossier",
    "type": "type",
    "numero": "numero",
    "package_name": "package_name",
    }
]

mv_client.insert(collection_name="documents", data=batch)

@yanliang567
Copy link
Contributor

/assign @louis-sanna-eki
/unassign

@xiaofan-luan
Copy link
Contributor

I thought this is saying some field to be inserted is nil .
Maybe it's not sparse vector that is nil?

@louis-sanna-eki
Copy link

After upgrading to 2.4.5 the bug has disappeared. Thanks you all!

@yanliang567
Copy link
Contributor

great to hear that, thank you for updates. @louis-sanna-eki
I'd close this issue, and free to file new issues if you met anything else

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/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants