未验证 提交 51cfc897 编写于 作者: D del-zhenwu 提交者: GitHub

enable nsg case (#1670)

Signed-off-by: Nzhenwu <zw@zilliz.com>
上级 332de079
......@@ -896,7 +896,8 @@ class TestGPUResourceConfig:
if str(connect._cmd("mode")[1]) == "CPU":
pytest.skip("Only support GPU mode")
self.reset_configs(connect)
for i in [-1, "10", "1\n", "1\t"]:
for i in [-1, "1\n", "1\t"]:
logging.getLogger().info(i)
status, reply = connect.set_config("gpu_resource_config", "cache_capacity", i)
assert not status.OK()
......
......@@ -689,6 +689,8 @@ class TestIndexIP:
if str(connect._cmd("mode")[1]) == "GPU":
if request.param["index_type"] == IndexType.IVF_PQ:
pytest.skip("ivfpq not support in GPU mode")
if request.param["index_type"] == IndexType.RNSG:
pytest.skip("rnsg not support in ip")
return request.param
@pytest.fixture(
......@@ -702,6 +704,8 @@ class TestIndexIP:
if str(connect._cmd("mode")[1]) == "GPU":
if request.param["index_type"] == IndexType.IVF_PQ:
pytest.skip("ivfpq not support in GPU mode")
if request.param["index_type"] == IndexType.RNSG:
pytest.skip("rnsg not support in ip")
return request.param
"""
******************************************************************
......@@ -719,8 +723,6 @@ class TestIndexIP:
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
logging.getLogger().info(get_simple_index)
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
status, ids = connect.add_vectors(ip_collection, vectors)
status = connect.create_index(ip_collection, index_type, index_param)
assert status.OK()
......@@ -734,8 +736,6 @@ class TestIndexIP:
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
logging.getLogger().info(get_simple_index)
status = connect.create_partition(ip_collection, tag)
status, ids = connect.add_vectors(ip_collection, vectors, partition_tag=tag)
......@@ -765,8 +765,6 @@ class TestIndexIP:
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
logging.getLogger().info(get_simple_index)
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
status, ids = connect.add_vectors(ip_collection, vectors)
status = connect.create_index(ip_collection, index_type, index_param)
logging.getLogger().info(connect.describe_index(ip_collection))
......@@ -888,8 +886,6 @@ class TestIndexIP:
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
status = connect.create_index(ip_collection, index_type, index_param)
status, ids = connect.add_vectors(ip_collection, vectors)
assert status.OK()
......@@ -951,9 +947,7 @@ class TestIndexIP:
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
logging.getLogger().info(get_simple_index)
if index_type in [IndexType.RNSG]:
pytest.skip()
# status, ids = connect.add_vectors(ip_collection, vectors[:5000])
# status, ids = connect.add_vectors(ip_collection, vectors[:5000])
status = connect.create_index(ip_collection, index_type, index_param)
status, result = connect.describe_index(ip_collection)
logging.getLogger().info(result)
......@@ -974,8 +968,6 @@ class TestIndexIP:
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
logging.getLogger().info(get_simple_index)
status = connect.create_partition(ip_collection, tag)
status, ids = connect.add_vectors(ip_collection, vectors, partition_tag=tag)
......@@ -995,8 +987,6 @@ class TestIndexIP:
new_tag = "new_tag"
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
logging.getLogger().info(get_simple_index)
status = connect.create_partition(ip_collection, tag)
status = connect.create_partition(ip_collection, new_tag)
......@@ -1028,8 +1018,6 @@ class TestIndexIP:
connect.create_collection(param)
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
logging.getLogger().info(get_simple_index)
status, ids = connect.add_vectors(collection_name=collection_name, records=vectors)
status = connect.create_index(collection_name, index_type, index_param)
......@@ -1089,8 +1077,6 @@ class TestIndexIP:
index_type = get_simple_index["index_type"]
status, mode = connect._cmd("mode")
assert status.OK()
if index_type in [IndexType.RNSG]:
pytest.skip()
# status, ids = connect.add_vectors(ip_collection, vectors)
status = connect.create_index(ip_collection, index_type, index_param)
if str(mode) == "GPU" and (index_type == IndexType.IVF_PQ):
......@@ -1114,8 +1100,6 @@ class TestIndexIP:
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
status = connect.create_partition(ip_collection, tag)
status, ids = connect.add_vectors(ip_collection, vectors, partition_tag=tag)
status = connect.create_index(ip_collection, index_type, index_param)
......@@ -1138,8 +1122,6 @@ class TestIndexIP:
new_tag = "new_tag"
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
status = connect.create_partition(ip_collection, tag)
status = connect.create_partition(ip_collection, new_tag)
status, ids = connect.add_vectors(ip_collection, vectors)
......@@ -1163,8 +1145,6 @@ class TestIndexIP:
# status, ids = connect.add_vectors(ip_collection, vectors)
status, mode = connect._cmd("mode")
assert status.OK()
if index_type in [IndexType.RNSG]:
pytest.skip()
# status, ids = connect.add_vectors(ip_collection, vectors)
status = connect.create_index(ip_collection, index_type, index_param)
if str(mode) == "GPU" and (index_type == IndexType.IVF_PQ):
......@@ -1217,8 +1197,6 @@ class TestIndexIP:
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
if index_type in [IndexType.RNSG]:
pytest.skip("Skip some RNSG cases")
status, ids = connect.add_vectors(ip_collection, vectors)
for i in range(2):
status = connect.create_index(ip_collection, index_type, index_param)
......
......@@ -396,6 +396,8 @@ class TestSearchBase:
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
logging.getLogger().info(get_simple_index)
if index_type == IndexType.RNSG:
pytest.skip("rnsg not support in ip")
vectors, ids = self.init_data(connect, ip_collection)
status = connect.create_index(ip_collection, index_type, index_param)
query_vec = [vectors[0]]
......@@ -422,6 +424,8 @@ class TestSearchBase:
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
logging.getLogger().info(get_simple_index)
if index_type == IndexType.RNSG:
pytest.skip("rnsg not support in ip")
vectors, ids = self.init_data(connect, ip_collection)
status = connect.create_index(ip_collection, index_type, index_param)
query_vec = []
......@@ -446,6 +450,8 @@ class TestSearchBase:
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
logging.getLogger().info(index_param)
if index_type == IndexType.RNSG:
pytest.skip("rnsg not support in ip")
status = connect.create_partition(ip_collection, tag)
vectors, ids = self.init_data(connect, ip_collection)
status = connect.create_index(ip_collection, index_type, index_param)
......@@ -473,6 +479,8 @@ class TestSearchBase:
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
logging.getLogger().info(index_param)
if index_type == IndexType.RNSG:
pytest.skip("rnsg not support in ip")
status = connect.create_partition(ip_collection, tag)
vectors, ids = self.init_data(connect, ip_collection, partition_tags=tag)
status = connect.create_index(ip_collection, index_type, index_param)
......@@ -666,9 +674,11 @@ class TestSearchBase:
'''
top_k = 2
nprobe = 1
vectors, ids = self.init_data(connect, ip_collection, nb=2)
index_param = get_index["index_param"]
index_type = get_index["index_type"]
if index_type == IndexType.RNSG:
pytest.skip("rnsg not support in ip")
vectors, ids = self.init_data(connect, ip_collection, nb=2)
connect.create_index(ip_collection, index_type, index_param)
logging.getLogger().info(connect.describe_index(ip_collection))
query_vecs = [[0.50 for i in range(dim)]]
......
......@@ -428,7 +428,7 @@ def gen_invaild_search_params():
IndexType.IVF_SQ8H,
IndexType.IVF_PQ,
IndexType.HNSW,
# IndexType.RNSG
IndexType.RNSG
]
search_params = []
......@@ -443,11 +443,11 @@ def gen_invaild_search_params():
hnsw_search_param = {"index_type": index_type, "search_param": {"ef": ef}}
search_params.append(hnsw_search_param)
search_params.append({"index_type": index_type, "search_param": {"invalid_key": 100}})
# elif index_type == IndexType.RNSG:
# for search_length in gen_invalid_params():
# nsg_search_param = {"index_type": index_type, "search_param": {"search_length": search_length}}
# search_params.append(nsg_search_param)
# search_params.append({"index_type": index_type, "search_param": {"invalid_key": 100}})
elif index_type == IndexType.RNSG:
for search_length in gen_invalid_params():
nsg_search_param = {"index_type": index_type, "search_param": {"search_length": search_length}}
search_params.append(nsg_search_param)
search_params.append({"index_type": index_type, "search_param": {"invalid_key": 100}})
return search_params
......@@ -466,26 +466,26 @@ def gen_invalid_index():
for efConstruction in gen_invalid_params():
index_param = {"index_type": IndexType.HNSW, "index_param": {"M": 16, "efConstruction": efConstruction}}
index_params.append(index_param)
# for search_length in gen_invalid_params():
# index_param = {"index_type": IndexType.RNSG,
# "index_param": {"search_length": search_length, "out_degree": 40, "candidate_pool_size": 50,
# "knng": 100}}
# index_params.append(index_param)
# for out_degree in gen_invalid_params():
# index_param = {"index_type": IndexType.RNSG,
# "index_param": {"search_length": 100, "out_degree": out_degree, "candidate_pool_size": 50,
# "knng": 100}}
# index_params.append(index_param)
# for candidate_pool_size in gen_invalid_params():
# index_param = {"index_type": IndexType.RNSG, "index_param": {"search_length": 100, "out_degree": 40,
# "candidate_pool_size": candidate_pool_size,
# "knng": 100}}
# index_params.append(index_param)
for search_length in gen_invalid_params():
index_param = {"index_type": IndexType.RNSG,
"index_param": {"search_length": search_length, "out_degree": 40, "candidate_pool_size": 50,
"knng": 100}}
index_params.append(index_param)
for out_degree in gen_invalid_params():
index_param = {"index_type": IndexType.RNSG,
"index_param": {"search_length": 100, "out_degree": out_degree, "candidate_pool_size": 50,
"knng": 100}}
index_params.append(index_param)
for candidate_pool_size in gen_invalid_params():
index_param = {"index_type": IndexType.RNSG, "index_param": {"search_length": 100, "out_degree": 40,
"candidate_pool_size": candidate_pool_size,
"knng": 100}}
index_params.append(index_param)
index_params.append({"index_type": IndexType.IVF_FLAT, "index_param": {"invalid_key": 1024}})
index_params.append({"index_type": IndexType.HNSW, "index_param": {"invalid_key": 16, "efConstruction": 100}})
# index_params.append({"index_type": IndexType.RNSG,
# "index_param": {"invalid_key": 100, "out_degree": 40, "candidate_pool_size": 300,
# "knng": 100}})
index_params.append({"index_type": IndexType.RNSG,
"index_param": {"invalid_key": 100, "out_degree": 40, "candidate_pool_size": 300,
"knng": 100}})
return index_params
......@@ -497,7 +497,7 @@ def gen_index():
IndexType.IVF_SQ8H,
IndexType.IVF_PQ,
IndexType.HNSW,
# IndexType.RNSG
IndexType.RNSG
]
nlists = [1, 1024, 16384]
......@@ -527,15 +527,15 @@ def gen_index():
for M in Ms \
for efConstruction in efConstructions]
index_params.extend(hnsw_params)
# elif index_type == IndexType.RNSG:
# nsg_params = [{"index_type": index_type,
# "index_param": {"search_length": search_length, "out_degree": out_degree,
# "candidate_pool_size": candidate_pool_size, "knng": knng}} \
# for search_length in search_lengths \
# for out_degree in out_degrees \
# for candidate_pool_size in candidate_pool_sizes \
# for knng in knngs]
# index_params.extend(nsg_params)
elif index_type == IndexType.RNSG:
nsg_params = [{"index_type": index_type,
"index_param": {"search_length": search_length, "out_degree": out_degree,
"candidate_pool_size": candidate_pool_size, "knng": knng}} \
for search_length in search_lengths \
for out_degree in out_degrees \
for candidate_pool_size in candidate_pool_sizes \
for knng in knngs]
index_params.extend(nsg_params)
return index_params
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册