Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search not working after add_to_index #266

Open
rashed2014 opened this issue Feb 6, 2025 · 1 comment
Open

search not working after add_to_index #266

rashed2014 opened this issue Feb 6, 2025 · 1 comment

Comments

@rashed2014
Copy link

I was able to use add_to_index successfully. The new file contents appear in the collection.json and also the updated pid_docid_map.json (in the index directory). When I perform a search, the model seems to return the right index (no 55 in my case). However, it is blowing up as below:

File /opt/conda/lib/python3.11/site-packages/ragatouille/models/colbert.py:411, in ColBERT.search(self, query, index_name, k, force_fast, zero_index_ranks, doc_ids)
409 result_for_query = []
410 for id_, rank, score in zip(*result):
--> 411 document_id = self.pid_docid_map[id_]
412 result_dict = {
413 "content": self.collection[id_],
414 "score": score,
(...)
417 "passage_id": id_,
418 }
420 if self.docid_metadata_map is not None:

KeyError: 55

Is pid_docid_map getting properly read during search? Please note that the search works with the other indexes from the first document.

@rashed2014
Copy link
Author

I figured it out. My search method was holding on to the older RAG instance, even after the add_to_index. I had to load the model from the index path for both add_to_index and for search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant