Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
b6fcbb09
M
milvus
项目概览
milvus
/
milvus
9 个月 前同步成功
通知
260
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
b6fcbb09
编写于
8月 11, 2023
作者:
G
Gao
提交者:
GitHub
8月 11, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support ScaNN index (#26099)
Signed-off-by:
N
chasingegg
<
chao.gao@zilliz.com
>
上级
54d6f0ea
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
38 addition
and
4 deletion
+38
-4
internal/core/thirdparty/knowhere/CMakeLists.txt
internal/core/thirdparty/knowhere/CMakeLists.txt
+2
-2
internal/querynodev2/mock_data.go
internal/querynodev2/mock_data.go
+1
-0
internal/querynodev2/segments/mock_data.go
internal/querynodev2/segments/mock_data.go
+1
-0
internal/util/indexcgowrapper/index_test.go
internal/util/indexcgowrapper/index_test.go
+6
-0
pkg/util/indexparamcheck/conf_adapter_mgr.go
pkg/util/indexparamcheck/conf_adapter_mgr.go
+1
-0
pkg/util/indexparamcheck/conf_adapter_mgr_test.go
pkg/util/indexparamcheck/conf_adapter_mgr_test.go
+12
-0
pkg/util/indexparamcheck/index_type.go
pkg/util/indexparamcheck/index_type.go
+1
-0
tests/integration/getvector/get_vector_test.go
tests/integration/getvector/get_vector_test.go
+11
-0
tests/integration/util_index.go
tests/integration/util_index.go
+3
-2
未找到文件。
internal/core/thirdparty/knowhere/CMakeLists.txt
浏览文件 @
b6fcbb09
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# or implied. See the License for the specific language governing permissions and limitations under the License.
# or implied. See the License for the specific language governing permissions and limitations under the License.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
set
(
KNOWHERE_VERSION
b7d0b0a
)
set
(
KNOWHERE_VERSION
4f99dc0
)
message
(
STATUS
"Building knowhere-
${
KNOWHERE_SOURCE_VER
}
from source"
)
message
(
STATUS
"Building knowhere-
${
KNOWHERE_SOURCE_VER
}
from source"
)
message
(
STATUS
${
CMAKE_BUILD_TYPE
}
)
message
(
STATUS
${
CMAKE_BUILD_TYPE
}
)
...
@@ -30,7 +30,7 @@ endif ()
...
@@ -30,7 +30,7 @@ endif ()
set
(
CMAKE_PREFIX_PATH
${
CONAN_BOOST_ROOT
}
)
set
(
CMAKE_PREFIX_PATH
${
CONAN_BOOST_ROOT
}
)
FetchContent_Declare
(
FetchContent_Declare
(
knowhere
knowhere
GIT_REPOSITORY
"https://github.com/
milvus-io
/knowhere.git"
GIT_REPOSITORY
"https://github.com/
zilliztech
/knowhere.git"
GIT_TAG
${
KNOWHERE_VERSION
}
GIT_TAG
${
KNOWHERE_VERSION
}
SOURCE_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/knowhere-src
SOURCE_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/knowhere-src
BINARY_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/knowhere-build
BINARY_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/knowhere-build
...
...
internal/querynodev2/mock_data.go
浏览文件 @
b6fcbb09
...
@@ -50,6 +50,7 @@ const (
...
@@ -50,6 +50,7 @@ const (
IndexFaissIDMap
=
"FLAT"
IndexFaissIDMap
=
"FLAT"
IndexFaissIVFFlat
=
"IVF_FLAT"
IndexFaissIVFFlat
=
"IVF_FLAT"
IndexFaissIVFPQ
=
"IVF_PQ"
IndexFaissIVFPQ
=
"IVF_PQ"
IndexScaNN
=
"SCANN"
IndexFaissIVFSQ8
=
"IVF_SQ8"
IndexFaissIVFSQ8
=
"IVF_SQ8"
IndexFaissBinIDMap
=
"BIN_FLAT"
IndexFaissBinIDMap
=
"BIN_FLAT"
IndexFaissBinIVFFlat
=
"BIN_IVF_FLAT"
IndexFaissBinIVFFlat
=
"BIN_IVF_FLAT"
...
...
internal/querynodev2/segments/mock_data.go
浏览文件 @
b6fcbb09
...
@@ -56,6 +56,7 @@ const (
...
@@ -56,6 +56,7 @@ const (
IndexFaissIVFFlat
=
"IVF_FLAT"
IndexFaissIVFFlat
=
"IVF_FLAT"
IndexFaissIVFPQ
=
"IVF_PQ"
IndexFaissIVFPQ
=
"IVF_PQ"
IndexFaissIVFSQ8
=
"IVF_SQ8"
IndexFaissIVFSQ8
=
"IVF_SQ8"
IndexScaNN
=
"SCANN"
IndexFaissBinIDMap
=
"BIN_FLAT"
IndexFaissBinIDMap
=
"BIN_FLAT"
IndexFaissBinIVFFlat
=
"BIN_IVF_FLAT"
IndexFaissBinIVFFlat
=
"BIN_IVF_FLAT"
IndexHNSW
=
"HNSW"
IndexHNSW
=
"HNSW"
...
...
internal/util/indexcgowrapper/index_test.go
浏览文件 @
b6fcbb09
...
@@ -18,6 +18,7 @@ const (
...
@@ -18,6 +18,7 @@ const (
IndexFaissIVFFlat
=
"IVF_FLAT"
IndexFaissIVFFlat
=
"IVF_FLAT"
IndexFaissIVFPQ
=
"IVF_PQ"
IndexFaissIVFPQ
=
"IVF_PQ"
IndexFaissIVFSQ8
=
"IVF_SQ8"
IndexFaissIVFSQ8
=
"IVF_SQ8"
IndexScaNN
=
"SCANN"
IndexFaissBinIDMap
=
"BIN_FLAT"
IndexFaissBinIDMap
=
"BIN_FLAT"
IndexFaissBinIVFFlat
=
"BIN_IVF_FLAT"
IndexFaissBinIVFFlat
=
"BIN_IVF_FLAT"
...
@@ -52,6 +53,8 @@ func generateFloatVectorTestCases() []vecTestCase {
...
@@ -52,6 +53,8 @@ func generateFloatVectorTestCases() []vecTestCase {
{
IndexFaissIVFPQ
,
metric
.
IP
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexFaissIVFPQ
,
metric
.
IP
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexFaissIVFSQ8
,
metric
.
L2
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexFaissIVFSQ8
,
metric
.
L2
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexFaissIVFSQ8
,
metric
.
IP
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexFaissIVFSQ8
,
metric
.
IP
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexScaNN
,
metric
.
L2
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexScaNN
,
metric
.
IP
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexHNSW
,
metric
.
L2
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexHNSW
,
metric
.
L2
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexHNSW
,
metric
.
IP
,
false
,
schemapb
.
DataType_FloatVector
},
{
IndexHNSW
,
metric
.
IP
,
false
,
schemapb
.
DataType_FloatVector
},
}
}
...
@@ -89,6 +92,9 @@ func generateParams(indexType, metricType string) (map[string]string, map[string
...
@@ -89,6 +92,9 @@ func generateParams(indexType, metricType string) (map[string]string, map[string
indexParams
[
common
.
DimKey
]
=
strconv
.
Itoa
(
dim
)
indexParams
[
common
.
DimKey
]
=
strconv
.
Itoa
(
dim
)
indexParams
[
"nlist"
]
=
strconv
.
Itoa
(
nlist
)
indexParams
[
"nlist"
]
=
strconv
.
Itoa
(
nlist
)
indexParams
[
"nbits"
]
=
strconv
.
Itoa
(
nbits
)
indexParams
[
"nbits"
]
=
strconv
.
Itoa
(
nbits
)
}
else
if
indexType
==
IndexScaNN
{
indexParams
[
common
.
DimKey
]
=
strconv
.
Itoa
(
dim
)
indexParams
[
"nlist"
]
=
strconv
.
Itoa
(
nlist
)
}
else
if
indexType
==
IndexHNSW
{
}
else
if
indexType
==
IndexHNSW
{
indexParams
[
common
.
DimKey
]
=
strconv
.
Itoa
(
dim
)
indexParams
[
common
.
DimKey
]
=
strconv
.
Itoa
(
dim
)
indexParams
[
"M"
]
=
strconv
.
Itoa
(
16
)
indexParams
[
"M"
]
=
strconv
.
Itoa
(
16
)
...
...
pkg/util/indexparamcheck/conf_adapter_mgr.go
浏览文件 @
b6fcbb09
...
@@ -48,6 +48,7 @@ func (mgr *indexCheckerMgrImpl) registerIndexChecker() {
...
@@ -48,6 +48,7 @@ func (mgr *indexCheckerMgrImpl) registerIndexChecker() {
mgr
.
checkers
[
IndexFaissIDMap
]
=
newFlatChecker
()
mgr
.
checkers
[
IndexFaissIDMap
]
=
newFlatChecker
()
mgr
.
checkers
[
IndexFaissIvfFlat
]
=
newIVFBaseChecker
()
mgr
.
checkers
[
IndexFaissIvfFlat
]
=
newIVFBaseChecker
()
mgr
.
checkers
[
IndexFaissIvfPQ
]
=
newIVFPQChecker
()
mgr
.
checkers
[
IndexFaissIvfPQ
]
=
newIVFPQChecker
()
mgr
.
checkers
[
IndexScaNN
]
=
newIVFBaseChecker
()
mgr
.
checkers
[
IndexFaissIvfSQ8
]
=
newIVFSQChecker
()
mgr
.
checkers
[
IndexFaissIvfSQ8
]
=
newIVFSQChecker
()
mgr
.
checkers
[
IndexFaissBinIDMap
]
=
newBinFlatChecker
()
mgr
.
checkers
[
IndexFaissBinIDMap
]
=
newBinFlatChecker
()
mgr
.
checkers
[
IndexFaissBinIvfFlat
]
=
newBinIVFFlatChecker
()
mgr
.
checkers
[
IndexFaissBinIvfFlat
]
=
newBinIVFFlatChecker
()
...
...
pkg/util/indexparamcheck/conf_adapter_mgr_test.go
浏览文件 @
b6fcbb09
...
@@ -41,6 +41,12 @@ func Test_GetConfAdapterMgrInstance(t *testing.T) {
...
@@ -41,6 +41,12 @@ func Test_GetConfAdapterMgrInstance(t *testing.T) {
_
,
ok
=
adapter
.
(
*
ivfBaseChecker
)
_
,
ok
=
adapter
.
(
*
ivfBaseChecker
)
assert
.
Equal
(
t
,
true
,
ok
)
assert
.
Equal
(
t
,
true
,
ok
)
adapter
,
err
=
adapterMgr
.
GetChecker
(
IndexScaNN
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
NotEqual
(
t
,
nil
,
adapter
)
_
,
ok
=
adapter
.
(
*
ivfBaseChecker
)
assert
.
Equal
(
t
,
true
,
ok
)
adapter
,
err
=
adapterMgr
.
GetChecker
(
IndexFaissIvfPQ
)
adapter
,
err
=
adapterMgr
.
GetChecker
(
IndexFaissIvfPQ
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
NotEqual
(
t
,
nil
,
adapter
)
assert
.
NotEqual
(
t
,
nil
,
adapter
)
...
@@ -95,6 +101,12 @@ func TestConfAdapterMgrImpl_GetAdapter(t *testing.T) {
...
@@ -95,6 +101,12 @@ func TestConfAdapterMgrImpl_GetAdapter(t *testing.T) {
_
,
ok
=
adapter
.
(
*
ivfBaseChecker
)
_
,
ok
=
adapter
.
(
*
ivfBaseChecker
)
assert
.
Equal
(
t
,
true
,
ok
)
assert
.
Equal
(
t
,
true
,
ok
)
adapter
,
err
=
adapterMgr
.
GetChecker
(
IndexScaNN
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
NotEqual
(
t
,
nil
,
adapter
)
_
,
ok
=
adapter
.
(
*
ivfBaseChecker
)
assert
.
Equal
(
t
,
true
,
ok
)
adapter
,
err
=
adapterMgr
.
GetChecker
(
IndexFaissIvfPQ
)
adapter
,
err
=
adapterMgr
.
GetChecker
(
IndexFaissIvfPQ
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
Equal
(
t
,
nil
,
err
)
assert
.
NotEqual
(
t
,
nil
,
adapter
)
assert
.
NotEqual
(
t
,
nil
,
adapter
)
...
...
pkg/util/indexparamcheck/index_type.go
浏览文件 @
b6fcbb09
...
@@ -21,6 +21,7 @@ const (
...
@@ -21,6 +21,7 @@ const (
IndexFaissIDMap
IndexType
=
"FLAT"
// no index is built.
IndexFaissIDMap
IndexType
=
"FLAT"
// no index is built.
IndexFaissIvfFlat
IndexType
=
"IVF_FLAT"
IndexFaissIvfFlat
IndexType
=
"IVF_FLAT"
IndexFaissIvfPQ
IndexType
=
"IVF_PQ"
IndexFaissIvfPQ
IndexType
=
"IVF_PQ"
IndexScaNN
IndexType
=
"SCANN"
IndexFaissIvfSQ8
IndexType
=
"IVF_SQ8"
IndexFaissIvfSQ8
IndexType
=
"IVF_SQ8"
IndexFaissBinIDMap
IndexType
=
"BIN_FLAT"
IndexFaissBinIDMap
IndexType
=
"BIN_FLAT"
IndexFaissBinIvfFlat
IndexType
=
"BIN_IVF_FLAT"
IndexFaissBinIvfFlat
IndexType
=
"BIN_IVF_FLAT"
...
...
tests/integration/getvector/get_vector_test.go
浏览文件 @
b6fcbb09
...
@@ -287,6 +287,17 @@ func (s *TestGetVectorSuite) TestGetVector_IVF_PQ() {
...
@@ -287,6 +287,17 @@ func (s *TestGetVectorSuite) TestGetVector_IVF_PQ() {
s
.
run
()
s
.
run
()
}
}
func
(
s
*
TestGetVectorSuite
)
TestGetVector_SCANN
()
{
s
.
nq
=
10
s
.
topK
=
10
s
.
indexType
=
integration
.
IndexScaNN
s
.
metricType
=
metric
.
L2
s
.
pkType
=
schemapb
.
DataType_Int64
s
.
vecType
=
schemapb
.
DataType_FloatVector
s
.
searchFailed
=
false
s
.
run
()
}
func
(
s
*
TestGetVectorSuite
)
TestGetVector_IVF_SQ8
()
{
func
(
s
*
TestGetVectorSuite
)
TestGetVector_IVF_SQ8
()
{
s
.
nq
=
10
s
.
nq
=
10
s
.
topK
=
10
s
.
topK
=
10
...
...
tests/integration/util_index.go
浏览文件 @
b6fcbb09
...
@@ -35,6 +35,7 @@ const (
...
@@ -35,6 +35,7 @@ const (
IndexFaissIDMap
=
indexparamcheck
.
IndexFaissIDMap
IndexFaissIDMap
=
indexparamcheck
.
IndexFaissIDMap
IndexFaissIvfFlat
=
indexparamcheck
.
IndexFaissIvfFlat
IndexFaissIvfFlat
=
indexparamcheck
.
IndexFaissIvfFlat
IndexFaissIvfPQ
=
indexparamcheck
.
IndexFaissIvfPQ
IndexFaissIvfPQ
=
indexparamcheck
.
IndexFaissIvfPQ
IndexScaNN
=
indexparamcheck
.
IndexScaNN
IndexFaissIvfSQ8
=
indexparamcheck
.
IndexFaissIvfSQ8
IndexFaissIvfSQ8
=
indexparamcheck
.
IndexFaissIvfSQ8
IndexFaissBinIDMap
=
indexparamcheck
.
IndexFaissBinIDMap
IndexFaissBinIDMap
=
indexparamcheck
.
IndexFaissBinIDMap
IndexFaissBinIvfFlat
=
indexparamcheck
.
IndexFaissBinIvfFlat
IndexFaissBinIvfFlat
=
indexparamcheck
.
IndexFaissBinIvfFlat
...
@@ -124,7 +125,7 @@ func ConstructIndexParam(dim int, indexType string, metricType string) []*common
...
@@ -124,7 +125,7 @@ func ConstructIndexParam(dim int, indexType string, metricType string) []*common
switch
indexType
{
switch
indexType
{
case
IndexFaissIDMap
,
IndexFaissBinIDMap
:
case
IndexFaissIDMap
,
IndexFaissBinIDMap
:
// no index param is required
// no index param is required
case
IndexFaissIvfFlat
,
IndexFaissBinIvfFlat
,
IndexFaissIvfSQ8
:
case
IndexFaissIvfFlat
,
IndexFaissBinIvfFlat
,
IndexFaissIvfSQ8
,
IndexScaNN
:
params
=
append
(
params
,
&
commonpb
.
KeyValuePair
{
params
=
append
(
params
,
&
commonpb
.
KeyValuePair
{
Key
:
"nlist"
,
Key
:
"nlist"
,
Value
:
"100"
,
Value
:
"100"
,
...
@@ -163,7 +164,7 @@ func GetSearchParams(indexType string, metricType string) map[string]any {
...
@@ -163,7 +164,7 @@ func GetSearchParams(indexType string, metricType string) map[string]any {
switch
indexType
{
switch
indexType
{
case
IndexFaissIDMap
,
IndexFaissBinIDMap
:
case
IndexFaissIDMap
,
IndexFaissBinIDMap
:
params
[
common
.
MetricTypeKey
]
=
metricType
params
[
common
.
MetricTypeKey
]
=
metricType
case
IndexFaissIvfFlat
,
IndexFaissBinIvfFlat
,
IndexFaissIvfSQ8
,
IndexFaissIvfPQ
:
case
IndexFaissIvfFlat
,
IndexFaissBinIvfFlat
,
IndexFaissIvfSQ8
,
IndexFaissIvfPQ
,
IndexScaNN
:
params
[
"nprobe"
]
=
8
params
[
"nprobe"
]
=
8
case
IndexHNSW
:
case
IndexHNSW
:
params
[
"ef"
]
=
200
params
[
"ef"
]
=
200
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录