faiss 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +12 -0
- data/ext/faiss/index.cpp +24 -0
- data/lib/faiss/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6fb14299c0b91d6ddaf74ca2fa2d6895e8621249a5351683b109f35866ab541
|
4
|
+
data.tar.gz: 2ec9d11faf8f3f1af7790d1f39e31cb92d8a79d2539fa7c935dbda63f3052d8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5afa3a7ca6947fad6f5a4f7693b524411875d212079621bc72bda73df36fdf090fcb566b83248302a83ecb38ee04189c57c812eaad4ffc99f94840eaf3abfd28
|
7
|
+
data.tar.gz: c29cf727d683f82e530ba1788630ae546ddb4470f3145f0a4dd1b6afe31555bb9363dfa52cc2a5e005a077f6e2aae24b3dc1aa44d1ff9c50fc9269987df0ec87
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -97,12 +97,24 @@ Locality-sensitive hashing
|
|
97
97
|
Faiss::IndexLSH.new(d, nbits)
|
98
98
|
```
|
99
99
|
|
100
|
+
Scalar quantizer (SQ) in flat mode
|
101
|
+
|
102
|
+
```rb
|
103
|
+
Faiss::IndexScalarQuantizer.new(d, qtype)
|
104
|
+
```
|
105
|
+
|
100
106
|
Product quantizer (PQ) in flat mode
|
101
107
|
|
102
108
|
```rb
|
103
109
|
Faiss::IndexPQ.new(d, m, nbits)
|
104
110
|
```
|
105
111
|
|
112
|
+
IVF and scalar quantizer
|
113
|
+
|
114
|
+
```rb
|
115
|
+
Faiss::IndexIVFScalarQuantizer.new(quantizer, d, nlists, qtype)
|
116
|
+
```
|
117
|
+
|
106
118
|
IVFADC (coarse quantizer+PQ on residuals)
|
107
119
|
|
108
120
|
```rb
|
data/ext/faiss/index.cpp
CHANGED
@@ -30,6 +30,30 @@ faiss::MetricType from_ruby<faiss::MetricType>(Rice::Object x)
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
|
33
|
+
template<>
|
34
|
+
faiss::ScalarQuantizer::QuantizerType from_ruby<faiss::ScalarQuantizer::QuantizerType>(Rice::Object x)
|
35
|
+
{
|
36
|
+
auto s = x.to_s().str();
|
37
|
+
if (s == "qt_8bit") {
|
38
|
+
return faiss::ScalarQuantizer::QT_8bit;
|
39
|
+
} else if (s == "qt_4bit") {
|
40
|
+
return faiss::ScalarQuantizer::QT_4bit;
|
41
|
+
} else if (s == "qt_8bit_uniform") {
|
42
|
+
return faiss::ScalarQuantizer::QT_8bit_uniform;
|
43
|
+
} else if (s == "qt_4bit_uniform") {
|
44
|
+
return faiss::ScalarQuantizer::QT_4bit_uniform;
|
45
|
+
} else if (s == "qt_fp16") {
|
46
|
+
return faiss::ScalarQuantizer::QT_fp16;
|
47
|
+
} else if (s == "qt_8bit_direct") {
|
48
|
+
return faiss::ScalarQuantizer::QT_8bit_direct;
|
49
|
+
} else if (s == "qt_6bit") {
|
50
|
+
return faiss::ScalarQuantizer::QT_6bit;
|
51
|
+
} else {
|
52
|
+
// TODO throw argument error
|
53
|
+
throw std::runtime_error("Invalid quantizer type: " + s);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
33
57
|
void init_index(Rice::Module& m) {
|
34
58
|
Rice::define_class_under<faiss::Index>(m, "Index")
|
35
59
|
.define_method(
|
data/lib/faiss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faiss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rice
|