severian42 / GraphRAG-Local-UI

GraphRAG using Local LLMs - Features robust API and multiple apps for Indexing/Prompt Tuning/Query/Chat/Visualizing/Etc. This is meant to be the ultimate GraphRAG/KG local LLM app.
MIT License
1.51k stars 173 forks source link

Gradio issue: Refresh LLM Models #50

Open rubenvillarreal opened 1 month ago

rubenvillarreal commented 1 month ago

When i click on Refresh LLM Models in gradio interface I get an error:

2024-07-22 14:02:51,943 - INFO - HTTP Request: POST http://127.0.0.1:7860/reset "HTTP/1.1 200 OK" Traceback (most recent call last): File "/Users/rubenvillarreal/miniconda3/envs/graphollama/lib/python3.11/site-packages/gradio/blocks.py", line 1298, in postprocess_data block = self.blocks[output_id]


KeyError: 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/rubenvillarreal/miniconda3/envs/graphollama/lib/python3.11/site-packages/gradio/routes.py", line 439, in run_predict
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rubenvillarreal/miniconda3/envs/graphollama/lib/python3.11/site-packages/gradio/blocks.py", line 1387, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rubenvillarreal/miniconda3/envs/graphollama/lib/python3.11/site-packages/gradio/blocks.py", line 1300, in postprocess_data
    raise InvalidBlockError(
gradio.exceptions.InvalidBlockError: Output component with id 1 used in then() event not found in this gr.Blocks context. You are allowed to nest gr.Blocks contexts, but there must be a gr.Blocks context that contains all components and events.
2024-07-22 14:02:51,995 - INFO - HTTP Request: POST http://127.0.0.1:7860/api/predict "HTTP/1.1 500 Internal Server Error"
2024-07-22 14:02:51,999 - INFO - HTTP Request: POST http://127.0.0.1:7860/reset "HTTP/1.1 200 OK"
stud2008 commented 1 month ago

I encountered the same error using python 3.12.4 and requirements.txt:

2024-07-23 14:36:32,938 - INFO - Successfully fetched openai models: ['llama3:latest'] 2024-07-23 14:36:32,963 - INFO - HTTP Request: POST http://10.10.10.10:7860/api/predict "HTTP/1.1 200 OK" 2024-07-23 14:36:32,966 - INFO - HTTP Request: POST http://10.10.10.10:7860/reset "HTTP/1.1 200 OK" 2024-07-23 14:36:32,998 - INFO - Raw API response: {"object":"list","data":[{"id":"llama3:latest","object":"model","created":1721700640,"owned_by":"library"}]}

2024-07-23 14:36:32,999 - INFO - Successfully fetched openai models: ['llama3:latest'] 2024-07-23 14:36:33,025 - INFO - HTTP Request: POST http://10.10.10.10:7860/api/predict "HTTP/1.1 200 OK" 2024-07-23 14:36:33,042 - INFO - HTTP Request: POST http://10.10.10.10:7860/reset "HTTP/1.1 200 OK" Traceback (most recent call last): File "/home/miniconda3/envs/graphrag/lib/python3.12/site-packages/gradio/blocks.py", line 1298, in postprocess_data block = self.blocks[output_id]


KeyError: 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/miniconda3/envs/graphrag/lib/python3.12/site-packages/gradio/routes.py", line 439, in run_predict
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miniconda3/envs/graphrag/lib/python3.12/site-packages/gradio/blocks.py", line 1387, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miniconda3/envs/graphrag/lib/python3.12/site-packages/gradio/blocks.py", line 1300, in postprocess_data
    raise InvalidBlockError(
gradio.exceptions.InvalidBlockError: Output component with id 1 used in then() event not found in this gr.Blocks context. You are allowed to nest gr.Blocks contexts, but there must be a gr.Blocks context that contains all components and events.
2024-07-23 14:36:33,120 - INFO - HTTP Request: POST http://10.10.10.10:7860/api/predict "HTTP/1.1 500 Internal Server Error"
2024-07-23 14:36:33,129 - INFO - HTTP Request: POST http://10.10.10.10:7860/reset "HTTP/1.1 200 OK"
stud2008 commented 1 month ago

I fixed this problem, update gradio: pip install gradio==4.38.1 pip install aiofiles==24.1.0

You may get some error message like: ERROR: Cannot install aiofiles==24.1.0 and gradio==4.38.1 because these package versions have conflicting dependencies. Ignore it, I test the project can be run.

severian42 commented 1 month ago

Hey! These are just Gradio errors that won't stop your ability to do stuff, has more to do with the aesthetics and such. Working on making it a non-issue in upcoming updates