Giter Site home page Giter Site logo

Comments (4)

CloudBreadPaPa avatar CloudBreadPaPa commented on August 23, 2024

same result from my side.
looks like a bug of search with metadata.

repro steps.
copy attached query_embeddings.txt and title_embeddings.txt file.
These're 2048d vector with simple metadata file.

Run below commands and check results.txt file.

./indexbuilder -d 2048 -v Float -i ../shane-test/query_embeddings.txt -o ../output3 -a BKT 

./indexsearcher ../output3 Index.QueryFile=../shane-test/title_embeddings.txt Index.ResultFile=../output3/results.txt Index.K=2

First line of first prediction looks okay but next, errors.
the broken text, it should be t2 metadata name value but might be some encoding? or text printing issues on it.

results.txt file text

m1:0.680@t1|0.998@`�|
m2:0.654@��|0.973@`�|
m3:0.719@��|0.980@`�|
m4:0.753@��|0.978@`�|
m5:0.707@��|0.994@`�|
m6:0.696@��|1.001@`�|
m7:0.755@��|0.985@`�|
m8:0.720@��|1.002@`�|
m9:0.833@��|0.975@`�|
m10:0.723@��|1.000@`�|
m11:0.680@��|0.998@`�|
m12:0.654@��|0.973@`�|
m13:0.719@��|0.980@`�|
m14:0.753@��|0.978@`�|
m15:0.707@��|0.994@`�|
m16:0.696@��|1.001@`�|
m17:0.755@��|0.985@`�|
m18:0.720@��|1.002@`�|
m19:0.833@��|0.975@`�|
m20:0.723@��|1.000@`�|

attaching the test files.

SPTAG-result-with-metadata.zip

from sptag.

MaJaHa95 avatar MaJaHa95 commented on August 23, 2024

I spent a bit of time debugging this the other day, and seemed to find that inserting elements one at a time (using AddIndex) resolved it. Relatively slow, but maybe that's a hint toward what might be at play?

from sptag.

lambday avatar lambday commented on August 23, 2024

Faced the same issue on Windows. I was trying with dummy vectors of dimension 10.

  1. Here's the input file to the index builder executable (target.txt).
hello	100|101|103|104|105|106|107|108|109|110
hullo	99|100|101|103|104|105|106|107|108|109
hola	85|86|87|88|89|90|91|92|93|94
hi	120|121|122|123|124|125|126|127|119|118
what's up	-10|-11|-12|-13|-14|-15|-16|-17|-18|-19
  1. Ran index builder
indexbuilder.exe -d 10 -v float -i D:\path\to\data\target.txt -o D:\path\to\data\gen -a BKT Index.DistCalcMethod=Cosine
  1. My search input file (source.txt)
this	-120|-121|-122|-123|-124|-125|-126|-127|-128|-129
magnificiant	250|251|252|253|254|255|256|257|258|259
helloo	101|102|103|104|105|106|107|108|109|120
hwllo	98|99|100|101|102|103|104|105|106|107
search	1|2|3|4|5|6|7|8|9|10
  1. Ran index search
indexsearcher.exe D:\path\to\data\gen Index.QueryFile=D:\path\to\data\source.txt Index.ResultFile=D:\path\to\data\gen\result.txt Index.K=4
  1. Content of result.txt
this:2.000@  ðÂC|2.000@C   |2.000@C |2.000@¸$P}÷�   |
magnificiant:0.000@C    |0.000@l e |0.000@C |0.000@         |
helloo:0.000@    C|0.001@    C|0.001@C   |0.001@� |
hwllo:0.000@C �Åî|0.000@    C|0.000@C   |0.000@� |
search:0.100@  ðÂC|0.114@C    |0.114@C   |0.114@C |

I don't know what to make of it. Any help is appreciated.

from sptag.

lambday avatar lambday commented on August 23, 2024

Okay not sure how much it helps, but this is something I tried with the index searcher.

  1. Removed the if (...) thing here and the else block. So this is how it looks in my local
for (int j = 0; j < K; j++)
{
     //if (results[i].GetResult(j)->VID < 0) {
         fp << results[i].GetResult(j)->Dist << "@" << results[i].GetResult(j)->VID; // << std::endl;
     //}
     /*else {
         ByteArray vm = index.GetMetadata(results[i].GetResult(j)->VID);
         fp << (results[i].GetResult(j)->Dist / basesquare) << "@";
         fp.write((const char*)vm.Data(), vm.Length());
     }*/
    fp << "|";
}
  1. Increased the precision here to 6 (since the distance is float32_t so we can't get better than that).

  2. Output file:

this:1.999734@1|1.999734@2|1.999734@3|1.999734@4|
magnificiant:0.000064@1|0.000064@2|0.000064@3|0.000064@4|
helloo:0.000382@0|0.001155@1|0.001155@2|0.001155@3|
hwllo:0.000005@0|0.000392@1|0.000392@2|0.000392@3|
search:0.100150@0|0.113595@1|0.113595@2|0.113595@3|

from sptag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.