Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
2a21d2cb
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
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 搜索 >>
未验证
提交
2a21d2cb
编写于
11月 30, 2020
作者:
S
shengjun.li
提交者:
GitHub
11月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix leak (#4324)
Signed-off-by:
N
shengjun.li
<
shengjun.li@zilliz.com
>
上级
b6dbbccd
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
27 addition
and
24 deletion
+27
-24
core/src/db/snapshot/CompoundOperations.h
core/src/db/snapshot/CompoundOperations.h
+1
-1
core/src/db/snapshot/Operations.h
core/src/db/snapshot/Operations.h
+1
-1
core/src/db/snapshot/ReferenceProxy.h
core/src/db/snapshot/ReferenceProxy.h
+1
-0
core/src/db/snapshot/Snapshot.h
core/src/db/snapshot/Snapshot.h
+1
-0
core/src/index/knowhere/knowhere/index/vector_index/IndexBinaryIVF.cpp
...x/knowhere/knowhere/index/vector_index/IndexBinaryIVF.cpp
+1
-0
core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp
...c/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp
+5
-3
core/src/index/knowhere/knowhere/index/vector_index/IndexIVFPQ.cpp
...index/knowhere/knowhere/index/vector_index/IndexIVFPQ.cpp
+6
-5
core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQ.cpp
...index/knowhere/knowhere/index/vector_index/IndexIVFSQ.cpp
+5
-10
core/src/index/knowhere/knowhere/index/vector_offset_index/IndexIVF_NM.cpp
...owhere/knowhere/index/vector_offset_index/IndexIVF_NM.cpp
+6
-4
未找到文件。
core/src/db/snapshot/CompoundOperations.h
浏览文件 @
2a21d2cb
...
...
@@ -323,7 +323,7 @@ class GetCollectionIDsOperation : public Operations {
GetIDs
()
const
;
protected:
bool
reversed_
;
bool
reversed_
=
true
;
IDS_TYPE
ids_
;
};
...
...
core/src/db/snapshot/Operations.h
浏览文件 @
2a21d2cb
...
...
@@ -199,7 +199,7 @@ class Operations : public std::enable_shared_from_this<Operations> {
OperationContext
context_
;
ScopedSnapshotT
prev_ss_
;
StepsHolderT
holders_
;
size_t
last_pos_
;
size_t
last_pos_
=
0
;
std
::
vector
<
ID_TYPE
>
ids_
;
bool
done_
=
false
;
Status
status_
;
...
...
core/src/db/snapshot/ReferenceProxy.h
浏览文件 @
2a21d2cb
...
...
@@ -44,6 +44,7 @@ class ReferenceProxy : public std::enable_shared_from_this<ReferenceProxy> {
for
(
auto
&
cb
:
on_no_ref_cbs_
)
{
cb
(
this
->
shared_from_this
());
}
on_no_ref_cbs_
.
clear
();
}
}
...
...
core/src/db/snapshot/Snapshot.h
浏览文件 @
2a21d2cb
...
...
@@ -273,6 +273,7 @@ class Snapshot : public ReferenceProxy {
ReferenceProxy
::
UnRef
();
if
(
ref_count_
==
0
)
{
UnRefAll
();
std
::
apply
([](
auto
&
...
holder
)
{
((
holder
.
clear
()),
...);
},
resources_
);
}
}
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexBinaryIVF.cpp
浏览文件 @
2a21d2cb
...
...
@@ -112,6 +112,7 @@ BinaryIVF::Train(const DatasetPtr& dataset_ptr, const Config& config) {
faiss
::
MetricType
metric_type
=
GetMetricType
(
config
[
Metric
::
TYPE
].
get
<
std
::
string
>
());
faiss
::
IndexBinary
*
coarse_quantizer
=
new
faiss
::
IndexBinaryFlat
(
dim
,
metric_type
);
auto
index
=
std
::
make_shared
<
faiss
::
IndexBinaryIVF
>
(
coarse_quantizer
,
dim
,
nlist
,
metric_type
);
index
->
own_fields
=
true
;
index
->
train
(
rows
,
static_cast
<
const
uint8_t
*>
(
p_data
));
index
->
add_with_ids
(
rows
,
static_cast
<
const
uint8_t
*>
(
p_data
),
p_ids
);
index_
=
index
;
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp
浏览文件 @
2a21d2cb
...
...
@@ -67,11 +67,13 @@ void
IVF
::
Train
(
const
DatasetPtr
&
dataset_ptr
,
const
Config
&
config
)
{
GET_TENSOR_DATA_DIM
(
dataset_ptr
)
int64_t
nlist
=
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
();
faiss
::
MetricType
metric_type
=
GetMetricType
(
config
[
Metric
::
TYPE
].
get
<
std
::
string
>
());
faiss
::
Index
*
coarse_quantizer
=
new
faiss
::
IndexFlat
(
dim
,
metric_type
);
auto
nlist
=
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
();
index_
=
std
::
shared_ptr
<
faiss
::
Index
>
(
new
faiss
::
IndexIVFFlat
(
coarse_quantizer
,
dim
,
nlist
,
metric_type
));
index_
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
auto
index
=
std
::
make_shared
<
faiss
::
IndexIVFFlat
>
(
coarse_quantizer
,
dim
,
nlist
,
metric_type
);
index
->
own_fields
=
true
;
index
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
index_
=
index
;
}
void
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexIVFPQ.cpp
浏览文件 @
2a21d2cb
...
...
@@ -38,11 +38,12 @@ IVFPQ::Train(const DatasetPtr& dataset_ptr, const Config& config) {
faiss
::
MetricType
metric_type
=
GetMetricType
(
config
[
Metric
::
TYPE
].
get
<
std
::
string
>
());
faiss
::
Index
*
coarse_quantizer
=
new
faiss
::
IndexFlat
(
dim
,
metric_type
);
index_
=
std
::
shared_ptr
<
faiss
::
Index
>
(
new
faiss
::
IndexIVFPQ
(
coarse_quantizer
,
dim
,
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
(),
config
[
IndexParams
::
m
].
get
<
int64_t
>
(),
config
[
IndexParams
::
nbits
].
get
<
int64_t
>
(),
metric_type
));
index_
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
auto
index
=
std
::
make_shared
<
faiss
::
IndexIVFPQ
>
(
coarse_quantizer
,
dim
,
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
(),
config
[
IndexParams
::
m
].
get
<
int64_t
>
(),
config
[
IndexParams
::
nbits
].
get
<
int64_t
>
(),
metric_type
);
index
->
own_fields
=
true
;
index
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
index_
=
index
;
}
VecIndexPtr
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexIVFSQ.cpp
浏览文件 @
2a21d2cb
...
...
@@ -37,18 +37,13 @@ void
IVFSQ
::
Train
(
const
DatasetPtr
&
dataset_ptr
,
const
Config
&
config
)
{
GET_TENSOR_DATA_DIM
(
dataset_ptr
)
// std::stringstream index_type;
// index_type << "IVF" << config[IndexParams::nlist] << ","
// << "SQ" << config[IndexParams::nbits];
// index_ = std::shared_ptr<faiss::Index>(
// faiss::index_factory(dim, index_type.str().c_str(), GetMetricType(config[Metric::TYPE].get<std::string>())));
faiss
::
MetricType
metric_type
=
GetMetricType
(
config
[
Metric
::
TYPE
].
get
<
std
::
string
>
());
faiss
::
Index
*
coarse_quantizer
=
new
faiss
::
IndexFlat
(
dim
,
metric_type
);
index_
=
std
::
shared_ptr
<
faiss
::
Index
>
(
new
faiss
::
IndexIVFScalarQuantizer
(
coarse_quantizer
,
dim
,
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
(),
faiss
::
QuantizerType
::
QT_8bit
,
metric_type
));
index_
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
auto
index
=
std
::
make_shared
<
faiss
::
IndexIVFScalarQuantizer
>
(
coarse_quantizer
,
dim
,
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
(),
faiss
::
QuantizerType
::
QT_8bit
,
metric_type
);
index
->
own_fields
=
true
;
index
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
index_
=
index
;
}
VecIndexPtr
...
...
core/src/index/knowhere/knowhere/index/vector_offset_index/IndexIVF_NM.cpp
浏览文件 @
2a21d2cb
...
...
@@ -108,11 +108,13 @@ void
IVF_NM
::
Train
(
const
DatasetPtr
&
dataset_ptr
,
const
Config
&
config
)
{
GET_TENSOR_DATA_DIM
(
dataset_ptr
)
int64_t
nlist
=
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
();
faiss
::
MetricType
metric_type
=
GetMetricType
(
config
[
Metric
::
TYPE
].
get
<
std
::
string
>
());
faiss
::
Index
*
coarse_quantizer
=
new
faiss
::
IndexFlat
(
dim
,
metric_type
);
auto
nlist
=
config
[
IndexParams
::
nlist
].
get
<
int64_t
>
();
index_
=
std
::
shared_ptr
<
faiss
::
Index
>
(
new
faiss
::
IndexIVFFlat
(
coarse_quantizer
,
dim
,
nlist
,
metric_type
));
index_
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
auto
coarse_quantizer
=
new
faiss
::
IndexFlat
(
dim
,
metric_type
);
auto
index
=
std
::
make_shared
<
faiss
::
IndexIVFFlat
>
(
coarse_quantizer
,
dim
,
nlist
,
metric_type
);
index
->
own_fields
=
true
;
index
->
train
(
rows
,
reinterpret_cast
<
const
float
*>
(
p_data
));
index_
=
index
;
}
void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录