30
30
#include " svs/lib/dispatcher.h"
31
31
#include " svs/lib/float16.h"
32
32
#include " svs/lib/meta.h"
33
+ #include " svs/lib/preprocessor.h"
33
34
#include " svs/orchestrators/vamana.h"
34
35
35
36
// pybind
@@ -420,40 +421,22 @@ void wrap(py::module& m) {
420
421
size_t window_size,
421
422
size_t max_candidate_pool_size,
422
423
size_t prune_to,
423
- size_t num_threads) {
424
- if (num_threads != std::numeric_limits<size_t >::max ()) {
425
- PyErr_WarnEx (
426
- PyExc_DeprecationWarning,
427
- " Constructing VamanaBuildParameters with the \" num_threads\" "
428
- " keyword "
429
- " argument is deprecated, no longer has any effect, and will be "
430
- " removed "
431
- " from future versions of the library. Use the \" num_threads\" "
432
- " keyword "
433
- " argument of \" svs.Vamana.build\" instead!" ,
434
- 1
435
- );
436
- }
437
-
438
- // Default the `prune_to` argument appropriately.
439
- if (prune_to == std::numeric_limits<size_t >::max ()) {
440
- prune_to = graph_max_degree;
441
- }
442
-
424
+ bool use_full_search_history) {
443
425
return svs::index ::vamana::VamanaBuildParameters{
444
426
alpha,
445
427
graph_max_degree,
446
428
window_size,
447
429
max_candidate_pool_size,
448
430
prune_to,
449
- true };
431
+ use_full_search_history };
450
432
}),
451
- py::arg (" alpha" ) = 1.2 ,
452
- py::arg (" graph_max_degree" ) = 32 ,
453
- py::arg (" window_size" ) = 64 ,
454
- py::arg (" max_candidate_pool_size" ) = 80 ,
455
- py::arg (" prune_to" ) = std::numeric_limits<size_t >::max (),
456
- py::arg (" num_threads" ) = std::numeric_limits<size_t >::max (),
433
+ py::arg (" alpha" ) = svs::FLOAT_PLACEHOLDER,
434
+ py::arg (" graph_max_degree" ) = svs::VAMANA_GRAPH_MAX_DEGREE_DEFAULT,
435
+ py::arg (" window_size" ) = svs::VAMANA_WINDOW_SIZE_DEFAULT,
436
+ py::arg (" max_candidate_pool_size" ) = svs::UNSIGNED_INTEGER_PLACEHOLDER,
437
+ py::arg (" prune_to" ) = svs::UNSIGNED_INTEGER_PLACEHOLDER,
438
+ py::arg (" use_full_search_history" ) =
439
+ svs::VAMANA_USE_FULL_SEARCH_HISTORY_DEFAULT,
457
440
R"(
458
441
Construct a new instance from keyword arguments.
459
442
@@ -462,6 +445,7 @@ void wrap(py::module& m) {
462
445
For distance types favoring minimization, set this to a number
463
446
greater than 1.0 (typically, 1.2 is sufficient). For distance types
464
447
preferring maximization, set to a value less than 1.0 (such as 0.95).
448
+ The default value is 1.2 for L2 distance type and 0.95 for MIP/Cosine.
465
449
graph_max_degree: The maximum out-degree in the final graph. Graphs with
466
450
a higher degree tend to yield better accuracy and performance at the cost
467
451
of a larger memory footprint.
@@ -470,10 +454,15 @@ void wrap(py::module& m) {
470
454
longer construction time. Should be larger than `graph_max_degree`.
471
455
max_candidate_pool_size: Limit on the number of candidates to consider
472
456
for neighbor updates. Should be larger than `window_size`.
457
+ The default value is ``graph_max_degree`` * 2.
473
458
prune_to: Amount candidate lists will be pruned to when exceeding the
474
459
target max degree. In general, setting this to slightly less than
475
- `graph_max_degree` will yield faster index building times. Default:
476
- `graph_max_degree`.
460
+ ``graph_max_degree`` will yield faster index building times. Default:
461
+ ` `graph_max_degree`` - 4 if
462
+ ``graph_max_degree`` is at least 16, otherwise ``graph_max_degree``.
463
+ use_full_search_history: When true, uses the full search history during
464
+ graph construction, which can improve graph quality at the expense of
465
+ additional memory and potentially longer build times.
477
466
)"
478
467
)
479
468
.def_readwrite (" alpha" , &svs::index ::vamana::VamanaBuildParameters::alpha)
@@ -557,4 +546,4 @@ overwritten when saving the index to this directory.
557
546
)"
558
547
);
559
548
}
560
- } // namespace svs::python::vamana
549
+ } // namespace svs::python::vamana
0 commit comments