-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Exception: fit() needs to called before retrieve() #1637
Comments
I confirm I can reproduce this, but at a first glance I don't see anything wrong in your setup. I'm going to find out what's going on here and let you know 👍 |
Hey @SaffronWolf, could you share the entire logs of your API server, from boot? I'm looking for a line similar to In practice the issue is interesting because it seems like |
Hi, @ZanSara thanks for looking into it.
I am not sure how to add documents to InDocumentMemoryStore. Can you please point me towards the documentation on it? I am using the RestAPI available in haystack repository.
|
Unfortunately it won't solve this specific issue, but just FYI the description of the REST API is here: https://haystack.deepset.ai/guides/rest-api It explains in detail all available endpoints, including the file upload one. Thanks for the stacktrace! |
Thanks. Would using a different retriever or ElasticSearch as DocumentStore solve the issue? |
I made it working swapping |
Hi @ZanSara Thanks for your response. |
Hi @aakar-007, interesting. Could you share a code snippet to reproduce the issue? |
Hi @ZanSara, the code is the same as the one @SaffronWolf has posted. Just swapped TfIdf retriever with DensePassageRetriever. |
Hello @aakar-007 and @SaffronWolf, I'm having a hard time reproducing your issue here. Could you try using the |
I had a look at where the exception is raised: haystack/haystack/nodes/retriever/sparse.py Line 177 in 13510aa
The problem is that the TfidfRetriever uses a dataframe haystack/haystack/nodes/retriever/sparse.py Line 134 in 13510aa
However, if there aren't any documents yet, the dataframe df remains empty, no scores are calculated and any retrieval step fails with the reported exception.
A quick fix is to run haystack/haystack/nodes/retriever/sparse.py Line 176 in 13510aa
I created a PR for that #1665 |
Describe the bug
I am getting the
Exception: fit() needs to called before retrieve()
using after running a query using Streamlit UI and RestAPI.Error message
Exception: fit() needs to called before retrieve()
To Reproduce
Start RestAPI
gunicorn rest_api.application:app -b 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker -t 300
UI
streamlit run webapp.py
Run the query
System:
The text was updated successfully, but these errors were encountered: