mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-06 04:36:32 +00:00
Use constants as the hannoy default parameters
This commit is contained in:
committed by
Louis Dureuil
parent
bf921e9135
commit
9a2a40a4fa
@ -41,6 +41,10 @@ pub type Embedding = Vec<f32>;
|
|||||||
pub const REQUEST_PARALLELISM: usize = 40;
|
pub const REQUEST_PARALLELISM: usize = 40;
|
||||||
pub const MAX_COMPOSITE_DISTANCE: f32 = 0.01;
|
pub const MAX_COMPOSITE_DISTANCE: f32 = 0.01;
|
||||||
|
|
||||||
|
const HANNOY_EF_CONSTRUCTION: usize = 48;
|
||||||
|
const HANNOY_M: usize = 16;
|
||||||
|
const HANNOY_M0: usize = 32;
|
||||||
|
|
||||||
pub struct HannoyWrapper {
|
pub struct HannoyWrapper {
|
||||||
quantized: bool,
|
quantized: bool,
|
||||||
embedder_index: u8,
|
embedder_index: u8,
|
||||||
@ -147,7 +151,10 @@ impl HannoyWrapper {
|
|||||||
if self.quantized {
|
if self.quantized {
|
||||||
let writer = hannoy::Writer::new(self.quantized_db(), index, dimension);
|
let writer = hannoy::Writer::new(self.quantized_db(), index, dimension);
|
||||||
if writer.need_build(wtxn)? {
|
if writer.need_build(wtxn)? {
|
||||||
writer.builder(rng).ef_construction(48).build::<16, 32>(wtxn)?
|
writer
|
||||||
|
.builder(rng)
|
||||||
|
.ef_construction(HANNOY_EF_CONSTRUCTION)
|
||||||
|
.build::<HANNOY_M, HANNOY_M0>(wtxn)?
|
||||||
} else if writer.is_empty(wtxn)? {
|
} else if writer.is_empty(wtxn)? {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -173,8 +180,8 @@ impl HannoyWrapper {
|
|||||||
.available_memory(hannoy_memory.unwrap_or(usize::MAX))
|
.available_memory(hannoy_memory.unwrap_or(usize::MAX))
|
||||||
// .progress(|step| progress.update_progress_from_hannoy(step))
|
// .progress(|step| progress.update_progress_from_hannoy(step))
|
||||||
// .cancel(cancel)
|
// .cancel(cancel)
|
||||||
.ef_construction(48)
|
.ef_construction(HANNOY_EF_CONSTRUCTION)
|
||||||
.build::<16, 32>(wtxn)?;
|
.build::<HANNOY_M, HANNOY_M0>(wtxn)?;
|
||||||
} else if writer.is_empty(wtxn)? {
|
} else if writer.is_empty(wtxn)? {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user