Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
51cfc897
milvus
项目概览
qq_35024513
/
milvus
与 Fork 源项目一致
Fork自
milvus / milvus
通知
14
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
51cfc897
编写于
3月 16, 2020
作者:
D
del-zhenwu
提交者:
GitHub
3月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable nsg case (#1670)
Signed-off-by:
N
zhenwu
<
zw@zilliz.com
>
上级
332de079
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
63 deletion
+52
-63
tests/milvus_python_test/test_config.py
tests/milvus_python_test/test_config.py
+2
-1
tests/milvus_python_test/test_index.py
tests/milvus_python_test/test_index.py
+5
-27
tests/milvus_python_test/test_search_vectors.py
tests/milvus_python_test/test_search_vectors.py
+11
-1
tests/milvus_python_test/utils.py
tests/milvus_python_test/utils.py
+34
-34
未找到文件。
tests/milvus_python_test/test_config.py
浏览文件 @
51cfc897
...
...
@@ -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
()
...
...
tests/milvus_python_test/test_index.py
浏览文件 @
51cfc897
...
...
@@ -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
)
...
...
tests/milvus_python_test/test_search_vectors.py
浏览文件 @
51cfc897
...
...
@@ -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
)]]
...
...
tests/milvus_python_test/utils.py
浏览文件 @
51cfc897
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录