Giter VIP home page Giter VIP logo

Comments (10)

xiaofan-luan avatar xiaofan-luan commented on August 16, 2024

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.

from milvus.

xiaofan-luan avatar xiaofan-luan commented on August 16, 2024

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

from milvus.

yanliang567 avatar yanliang567 commented on August 16, 2024

/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

from milvus.

louis-sanna-eki avatar louis-sanna-eki commented on August 16, 2024

@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)>

from milvus.

louis-sanna-eki avatar louis-sanna-eki commented on August 16, 2024

If i insert directly the csr_array I get.

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

from milvus.

yanliang567 avatar yanliang567 commented on August 16, 2024

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)

from milvus.

yanliang567 avatar yanliang567 commented on August 16, 2024

/assign @louis-sanna-eki
/unassign

from milvus.

xiaofan-luan avatar xiaofan-luan commented on August 16, 2024

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

from milvus.

louis-sanna-eki avatar louis-sanna-eki commented on August 16, 2024

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

from milvus.

yanliang567 avatar yanliang567 commented on August 16, 2024

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

from milvus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.