faiss 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '02752578b25cfcc61a7bb0e06e1d0dbc2d78175796cf99a44184a4e7298de073'
4
- data.tar.gz: ec678cf766efa90be0e013b342be6f95e42c6e67c4aa6de1b9e3b6f4c59d8699
3
+ metadata.gz: f6fb14299c0b91d6ddaf74ca2fa2d6895e8621249a5351683b109f35866ab541
4
+ data.tar.gz: 2ec9d11faf8f3f1af7790d1f39e31cb92d8a79d2539fa7c935dbda63f3052d8c
5
5
  SHA512:
6
- metadata.gz: 9342c736f6ce775b8561f0fc066b565e38f8d38470f98ea51b9635f371bb8efdbb9e049874588847fb11360da006da3ec0ca28d44fc6f844d970d91f648f1b03
7
- data.tar.gz: e70f220fdc76a37fcf5a06beba2b07f0315bbbb3dab7b396a8f932c04746e11454bd57ed527d18d55436352bd823d1e33e341046697fd36b124f7e64fbb72f38
6
+ metadata.gz: 5afa3a7ca6947fad6f5a4f7693b524411875d212079621bc72bda73df36fdf090fcb566b83248302a83ecb38ee04189c57c812eaad4ffc99f94840eaf3abfd28
7
+ data.tar.gz: c29cf727d683f82e530ba1788630ae546ddb4470f3145f0a4dd1b6afe31555bb9363dfa52cc2a5e005a077f6e2aae24b3dc1aa44d1ff9c50fc9269987df0ec87
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.7 (2021-03-26)
2
+
3
+ - Added `IndexScalarQuantizer` and `IndexIVFScalarQuantizer`
4
+
1
5
  ## 0.1.6 (2021-03-21)
2
6
 
3
7
  - Added support for inner product to `IndexIVFFlat` and `IndexIVFPQ`
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
@@ -1,3 +1,3 @@
1
1
  module Faiss
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
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.6
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-21 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice