LightRAG icon indicating copy to clipboard operation
LightRAG copied to clipboard

When pushing many files, the ui hangs

Open ParisNeo opened this issue 10 months ago • 28 comments

The ui is freezing and I can see that the backend is still processing the files: Image

When I reboot the backend, the same status can be found while this time nothing is happening on the backend.

Mayebe the file upload status must be recovered after reboot, we must fix the freezing. And also the import is taking way much more time than before, We need to add some debug information to see where there is a problem. I suspect that the LLM is failing to generate correct output which results in hanging nearely forever.

@danielaskdd @ArnoChenFx , can you please take a look at that?

ParisNeo avatar Feb 19 '25 07:02 ParisNeo

What happen if you trigger SCAN from WebUI after reboot. Check system log to see anything happens.

danielaskdd avatar Feb 19 '25 07:02 danielaskdd

It starts scanning but the ui stays the same

ParisNeo avatar Feb 19 '25 07:02 ParisNeo

OK after a while it seems to unfreeze:

Image

ParisNeo avatar Feb 19 '25 07:02 ParisNeo

Does SCAN works for you ?

YanSte avatar Feb 19 '25 08:02 YanSte

Yes after scan, I needed to wait for a while then it unfroze. But I don't understand why I had multiple entries with processing status (the files are sequentially processed, so I don't see why I had that). After reboot and rescan, it seems to work better. I also did a pull of the last version. Was there any fixes between yesterday morning and today that can explain this?

ParisNeo avatar Feb 19 '25 08:02 ParisNeo

Your UI is an old version? It is difference from my:

Image

danielaskdd avatar Feb 19 '25 08:02 danielaskdd

No, it is the same, I was just showing a zoom of the files

ParisNeo avatar Feb 19 '25 08:02 ParisNeo

Since ollama now supports multiple queries and batching, why don't we add an option to set maximum parallel files processing as an environment variable and as a service parameter then use that to speedup processing of files.

Also I suggest adding a progress value to the status of each file since we know already how many chunks to process, we can estimate a progress value. We can also add the number of entities and the number of connections and at the bottom the total number of entities and connections.

Finally, we need to implement the graph data recovery for at least the default version (the json and graphml) so that the Knowledge graph visualization can be viewed.

ParisNeo avatar Feb 19 '25 09:02 ParisNeo

How to use this interface? I don't see any documentation, is it with fastapi? Thanks

YanSte avatar Feb 19 '25 09:02 YanSte

@ArnoChenFx developed this new version of the interface. To access it you just install lightrag with [api] option, then to view it, you just go to your service address (example: http:localhost:9621/webui).

I suggest removing the /webui part as this would make it easier to access?

If that's OK with you I can do that now.

ParisNeo avatar Feb 19 '25 09:02 ParisNeo

And I'll make a youtube video about how to use it when It is ready.

ParisNeo avatar Feb 19 '25 09:02 ParisNeo

Thanks 🙏🏻 Will have a look.

YanSte avatar Feb 19 '25 09:02 YanSte

@ArnoChenFx did a great job. It is very iuntuitive. I made some friends test it and I didn't have to tell them much.

ParisNeo avatar Feb 19 '25 09:02 ParisNeo

Although a progress bar is a nice feature, I don't consider it a priority for the project. Given that indexing large numbers of files can take hours, it's unlikely that users will stay on the page just to watch the progress. Instead, there are several more valuable features to consider adding:

  1. Include a failure list in the view, allowing users to identify and resolve issues before re-uploading.
  2. Display file names in the list view, so users can easily see which files have been successfully processed and which have failed.
  3. Enable multiple file and folder uploads, providing users with the ability to preview the file list and remove files before initiating the indexing process.
  4. Implement a delete feature, allowing users to make corrections without the need to reindex all files, which can be a significant task.

danielaskdd avatar Feb 19 '25 09:02 danielaskdd

my ui is freezing until llm has responses, cannot switch to other tab pages or make any other api calls is it caused by using zhipu? I check the code and wonder if it really supports async calls

zhouy13 avatar Feb 19 '25 09:02 zhouy13

my ui is freezing until llm has responses, cannot switch to other tab pages or make any other api calls is it caused by using zhipu? I check the code and wonder if it really supports async calls

Based on my understanding, the LLM call operates asynchronously, whereas the large PDF(with image) content extraction using Docling does not. However, the latest version has eliminated Docling. Could you please provide a screenshot of the backend logs during the UI freeze?

danielaskdd avatar Feb 19 '25 11:02 danielaskdd

yes - no more docling in latest version. Here is the screenshot

Image

backend gets stuck at Upserting process, and once llm returns extracted info, everything backs to work.

I change to use OpenAI alike api, this problem get solved. I think problem is zhipu_complete_if_cache use

 response = client.chat.completions.create(model=model, messages=messages, **kwargs)

not

client.chat.asyncCompletions.create

but asyncCompletions has some problems with stream response, so need a fix on it

zhouy13 avatar Feb 19 '25 12:02 zhouy13

oh, I found out the problem. We are using the classic logger which is storing the logs to disk and my tmp folder is full so this is causing a fail: logger.info(f"Inserting {len(data)} vectors to {self.namespace}") with No more space on the disk.

I would use ASCIIColors instead of the classic logger as it handles this kind of things or by default deactivate logging to files.

ParisNeo avatar Feb 19 '25 12:02 ParisNeo

If the UI is freezing, there is no need to restart the server. Please refresh the webpage to reset the UI state. This will not affect any backend tasks.

ArnoChenFx avatar Feb 19 '25 14:02 ArnoChenFx

  1. Now the failure list will be displayed. If you have failed tasks but they are not shown as "failed," it is likely that the document status in the database was not updated in time.
  2. The filename is not stored in the database, so the frontend cannot display it.
  3. The multi-file upload is an already implemented feature.

ArnoChenFx avatar Feb 19 '25 14:02 ArnoChenFx

I've looked at zhipu's implementation code, and it's currently not using an asynchronous approach to call the LLM. Since zhipu's API is compatible with OpenAI, could we remove zhipu's implementation code and switch to using the OpenAI-alike mode to call zhipu's LLM? @zhouy13

danielaskdd avatar Feb 19 '25 14:02 danielaskdd

May be we should add file name to database as an reference. @ArnoChenFx @YanSte

danielaskdd avatar Feb 19 '25 14:02 danielaskdd

And zhipu_complete_if_cache is not handling stream response correctly. @zhouy13

danielaskdd avatar Feb 19 '25 14:02 danielaskdd

Agree to add filename. Also need to consider the warning at the beginning of this PR #792.

ArnoChenFx avatar Feb 19 '25 14:02 ArnoChenFx

When frontend summit a file for enqueuing, we should return a document id for future status inquiry. @YanSte @ArnoChenFx

danielaskdd avatar Feb 19 '25 15:02 danielaskdd

@ArnoChenFx I know the multifiles import is implemented. I was thinking parallel processing of multiploe files and make the workers number programmable.

ParisNeo avatar Feb 19 '25 19:02 ParisNeo

@ParisNeo @danielaskdd Could you please test the last version? The speed is improved.

YanSte avatar Feb 19 '25 23:02 YanSte

It is late here. I'll do that tomorrow. Thanks alot

ParisNeo avatar Feb 20 '25 00:02 ParisNeo