Skip to content

Commit

Permalink
Reorganize the quantization directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hicder committed Dec 5, 2024
1 parent 2f62fe0 commit 12cf408
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion rs/cli/src/index_viewer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;
use index::hnsw::reader::HnswReader;
use index::hnsw::utils::GraphTraversal;
use quantization::pq::ProductQuantizer;
use quantization::pq::pq::ProductQuantizer;

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
Expand Down
2 changes: 1 addition & 1 deletion rs/index/src/hnsw/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ impl<Q: Quantizer> GraphTraversal<Q> for HnswBuilder<Q> {
mod tests {
use std::fs;

use quantization::pq::ProductQuantizer;
use quantization::pq::pq::ProductQuantizer;
use utils::test_utils::generate_random_vector;

use super::*;
Expand Down
4 changes: 2 additions & 2 deletions rs/index/src/hnsw/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ mod tests {
use std::fs;

use quantization::no_op::{NoQuantizer, NoQuantizerWriter};
use quantization::pq::{ProductQuantizer, ProductQuantizerConfig, ProductQuantizerWriter};
use quantization::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use quantization::pq::pq::{ProductQuantizer, ProductQuantizerConfig, ProductQuantizerWriter};
use quantization::pq::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use utils::test_utils::generate_random_vector;

use super::*;
Expand Down
4 changes: 2 additions & 2 deletions rs/index/src/hnsw/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ mod tests {
use std::vec;

use ordered_float::NotNan;
use quantization::pq::{ProductQuantizer, ProductQuantizerConfig, ProductQuantizerWriter};
use quantization::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use quantization::pq::pq::{ProductQuantizer, ProductQuantizerConfig, ProductQuantizerWriter};
use quantization::pq::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use utils::test_utils::generate_random_vector;

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion rs/index_server/src/index_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use index::hnsw::reader::HnswReader;
use index::index::BoxedIndex;
use index::spann::reader::SpannReader;
use index_writer::config::BaseConfig;
use quantization::pq::ProductQuantizer;
use quantization::pq::pq::ProductQuantizer;

pub struct IndexProvider {
data_directory: String,
Expand Down
2 changes: 1 addition & 1 deletion rs/index_writer/src/hnsw_reindexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use index::hnsw::reader::HnswReader;
use index::hnsw::writer::HnswWriter;
use index::vector::VectorStorageConfig;
use log::error;
use quantization::pq::ProductQuantizer;
use quantization::pq::pq::ProductQuantizer;

#[derive(Parser)]
struct Args {
Expand Down
4 changes: 2 additions & 2 deletions rs/index_writer/src/index_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use index::ivf::builder::{IvfBuilder, IvfBuilderConfig};
use index::ivf::writer::IvfWriter;
use log::{debug, info};
use quantization::no_op::{NoQuantizer, NoQuantizerWriter};
use quantization::pq::{ProductQuantizer, ProductQuantizerConfig, ProductQuantizerWriter};
use quantization::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use quantization::pq::pq::{ProductQuantizer, ProductQuantizerConfig, ProductQuantizerWriter};
use quantization::pq::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use rand::seq::SliceRandom;

use crate::config::{
Expand Down
4 changes: 2 additions & 2 deletions rs/quantization/benches/pq_dist.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use quantization::pq::ProductQuantizerConfig;
use quantization::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use quantization::pq::pq::ProductQuantizerConfig;
use quantization::pq::pq_builder::{ProductQuantizerBuilder, ProductQuantizerBuilderConfig};
use quantization::quantization::Quantizer;
use strum::IntoEnumIterator;
use utils::distance::l2::L2DistanceCalculatorImpl;
Expand Down
2 changes: 0 additions & 2 deletions rs/quantization/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#![feature(portable_simd)]
pub mod no_op;
pub mod pq;
pub mod pq_builder;
pub mod quantization;
pub mod rabitq;
pub mod rabitq_builder;
pub mod reader;
pub mod typing;
2 changes: 2 additions & 0 deletions rs/quantization/src/pq/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod pq;
pub mod pq_builder;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use kmeans::*;
use log::debug;

use crate::pq::{ProductQuantizer, ProductQuantizerConfig};
use crate::pq::pq::{ProductQuantizer, ProductQuantizerConfig};

pub struct ProductQuantizerBuilderConfig {
pub max_iteration: usize,
Expand Down
2 changes: 2 additions & 0 deletions rs/quantization/src/rabitq/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod rabitq;
pub mod rabitq_builder;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ndarray_linalg::solve::Inverse;
use ndarray_rand::rand_distr::StandardNormal;
use ndarray_rand::RandomExt;

use crate::rabitq::RabitQ;
use crate::rabitq::rabitq::RabitQ;

pub struct RabitQBuilder {
dimension: usize,
Expand Down
2 changes: 1 addition & 1 deletion rs/quantization/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::Path;
use anyhow::Result;

use crate::no_op::{NoQuantizer, NoQuantizerReader};
use crate::pq::{ProductQuantizer, ProductQuantizerReader};
use crate::pq::pq::{ProductQuantizer, ProductQuantizerReader};

pub struct QuantizationReader {
base_directory: String,
Expand Down

0 comments on commit 12cf408

Please sign in to comment.