Skip to content

Commit

Permalink
Pybind fix (#69)
Browse files Browse the repository at this point in the history
* fix

* LSHAPG FIX
  • Loading branch information
Rubatozh authored Jan 15, 2025
1 parent bd9d189 commit 44e54d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/CANDY/LSHAPGIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ bool LSHAPGIndex::setConfig(INTELLI::ConfigMapPtr cfg) {
if(this->faissMetric==faiss::METRIC_INNER_PRODUCT) {
_g_dist_mes=1;
INTELLI_INFO("switch into inner product");
} else {
_g_dist_mes=0;
INTELLI_INFO("switch back to L2");
}
vecDim = cfg->tryI64("vecDim", 768, true);
flatBuffer.setConfig(cfg);
Expand Down
14 changes: 7 additions & 7 deletions src/PyCANDY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#if CANDY_PAPI == 1
#include <Utils/ThreadPerfPAPI.hpp>
#endif
#if CANDY_DiskANN == 1
//#if CANDY_DiskANN == 1
#include "defaults.h"
#include "distance.h"
#include <DiskANN/python/include/dynamic_memory_index.h>
#include <DiskANN/python/include/builder.h>
#endif
//#endif
#include <faiss/index_factory.h>


Expand Down Expand Up @@ -234,7 +234,7 @@ class SPSCWrapperIdx{



#if CANDY_DiskANN == 1
//#if CANDY_DiskANN == 1
struct Variant
{
std::string disk_builder_name;
Expand Down Expand Up @@ -282,7 +282,7 @@ template <typename T> inline void add_variant(py::module_ &m, const Variant &var
.def("consolidate_delete", &diskannpy::DynamicMemoryIndex<T>::consolidate_delete);

}
#endif
//#endif
#define COMPILED_TIME (__DATE__ " " __TIME__)
PYBIND11_MODULE(PyCANDYAlgo, m) {
/**
Expand Down Expand Up @@ -424,7 +424,7 @@ PYBIND11_MODULE(PyCANDYAlgo, m) {
m_diskann.def("add_tensors", &add_tensors, "A function that adds two tensors");


#if CANDY_DiskANN == 1
//#if CANDY_DiskANN == 1
py::module_ default_values = m_diskann.def_submodule(
"defaults",
"A collection of the default values used for common diskann operations. `GRAPH_DEGREE` and `COMPLEXITY` are not"
Expand Down Expand Up @@ -460,9 +460,9 @@ PYBIND11_MODULE(PyCANDYAlgo, m) {
.export_values();
m_diskann.attr("defaults") = default_values;
m.attr("diskannpy") = m_diskann;
#endif
//#endif




}
}

0 comments on commit 44e54d6

Please sign in to comment.