zylon-ai / private-gpt

Interact with your documents using the power of GPT, 100% privately, no data leaks
https://privategpt.dev
Apache License 2.0
54k stars 7.26k forks source link

Exception: async generator raised StopAsyncIteration when asking a question #1689

Open rmuhawieh opened 7 months ago

rmuhawieh commented 7 months ago

Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7_-Iqs-py3.11/lib/python3.11/site-packages/gradio/chat_interface.py", line 481, in _stream_fn first_response = await asynciteration(generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 512, in anext return await anyio.to_thread.runsync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_workerthread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_workerthread return await future ^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/asyncio.py", line 807, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 498, in run_sync_iteratorasync raise StopAsyncIteration() from None StopAsyncIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 459, in call_prediction output = await route_utils.call_processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/route_utils.py", line 232, in call_process_api output = await app.get_blocks().processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1533, in process_api result = await self.callfunction( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1163, in call_function prediction = await utils.asynciteration(iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 640, in asyncgenwrapper async for response in f(*args, **kwargs): RuntimeError: async generator raised StopAsyncIteration Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/chat_interface.py", line 481, in _stream_fn first_response = await asynciteration(generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 512, in anext return await anyio.to_thread.runsync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_workerthread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_workerthread return await future ^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/asyncio.py", line 807, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 498, in run_sync_iteratorasync raise StopAsyncIteration() from None StopAsyncIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 459, in call_prediction output = await route_utils.call_processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/route_utils.py", line 232, in call_process_api output = await app.get_blocks().processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1533, in process_api result = await self.callfunction( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1163, in call_function prediction = await utils.asynciteration(iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 640, in asyncgenwrapper async for response in f(*args, **kwargs): RuntimeError: async generator raised StopAsyncIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 497, in process_events response = await self.call_prediction(awakeevents, batch) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 468, in call_prediction raise Exception(str(error) if show_error else None) from error Exception: async generator raised StopAsyncIteration

rmuhawieh commented 7 months ago

Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7_-Iqs-py3.11/lib/python3.11/site-packages/gradio/chat_interface.py", line 481, in _stream_fn first_response = await asynciteration(generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 512, in anext return await anyio.to_thread.runsync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_workerthread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_workerthread return await future ^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/asyncio.py", line 807, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 498, in run_sync_iteratorasync raise StopAsyncIteration() from None StopAsyncIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 459, in call_prediction output = await route_utils.call_processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/route_utils.py", line 232, in call_process_api output = await app.get_blocks().processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1533, in process_api result = await self.callfunction( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1163, in call_function prediction = await utils.asynciteration(iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 640, in asyncgenwrapper async for response in f(*args, **kwargs): RuntimeError: async generator raised StopAsyncIteration Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/chat_interface.py", line 481, in _stream_fn first_response = await asynciteration(generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 512, in anext return await anyio.to_thread.runsync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_workerthread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_workerthread return await future ^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/anyio/_backends/asyncio.py", line 807, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 498, in run_sync_iteratorasync raise StopAsyncIteration() from None StopAsyncIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 459, in call_prediction output = await route_utils.call_processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/route_utils.py", line 232, in call_process_api output = await app.get_blocks().processapi( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1533, in process_api result = await self.callfunction( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/blocks.py", line 1163, in call_function prediction = await utils.asynciteration(iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 519, in asynciteration return await iterator.anext() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/utils.py", line 640, in asyncgenwrapper async for response in f(*args, **kwargs): RuntimeError: async generator raised StopAsyncIteration The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 497, in process_events response = await self.call_prediction(awakeevents, batch) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/rmuhawieh/.cache/pypoetry/virtualenvs/private-gpt-5J7-Iqs-py3.11/lib/python3.11/site-packages/gradio/queueing.py", line 468, in call_prediction raise Exception(str(error) if show_error else None) from error Exception: async generator raised StopAsyncIteration

It was just working, I'm not sure what changed

d1g33k commented 7 months ago

Have the same issue, set up the latest 0.4.0 version and used it for a couple of days. Suddenly started getting the "Exception: async generator raised StopAsyncIteration" error in query mode for already ingested files. The chat mode in turn displays the "AttributeError: 'NoneType' object has no attribute 'split'" error.

I have already setup my environment from scratch 3-4 times but the result is the same. It seems to have just stopped working and no amount of re-installation or restart seems to be of any use.

dbzoo commented 7 months ago

I ran into this. This is what worked for me. These commands are executed from the private_gpt clone dir. Delete the virtual env. $ poetry env list private-gpt-XXXXX $ poetry env remove private-gpt-XXXXX Make sure you exit the poetry environment and start another shell and repopulate the environment again. Install new virtual env $ poetry shell $ poetry install

rmuhawieh commented 7 months ago

I ran into this. This is what worked for me. These commands are executed from the private_gpt clone dir. Delete the virtual env. $ poetry env list private-gpt-XXXXX $ poetry env remove private-gpt-XXXXX Make sure you exit the poetry environment and start another shell and repopulate the environment again. Install new virtual env $ poetry shell $ poetry install

In the step where you say repopulate the environment again, is that where you rerun the commands poetry install --with ui,local and poetry run python scripts/setup? Or is that done after the installation of the new virtual environment? I'm only asking because I don't remember install a virtual environment in following the privateGPT installation instructions but I see that there is one when I use poetry env list

dbzoo commented 7 months ago

The act of poetry install will create a virtual environment Alternatively, you can clear the poetry cache. I ran into poetry problems doing this. After the virtenv is gone go through the setup again --with etc..

rmuhawieh commented 7 months ago

The act of poetry install will create a virtual environment Alternatively, you can clear the poetry cache. I ran into poetry problems doing this. After the virtenv is gone go through the setup again --with etc..

Ah yes okay so just so I understand completely, this should work then right?

  1. poetry env list
  2. poetry env remove private-gpt-XXXXX
  3. poetry shell
  4. pyenv local 3.11
  5. poetry install --with ui,local
  6. poetry run python scripts/setup
rmuhawieh commented 7 months ago

The act of poetry install will create a virtual environment Alternatively, you can clear the poetry cache. I ran into poetry problems doing this. After the virtenv is gone go through the setup again --with etc..

It doesn't seem to work when I try it, I get the same error. But I noticed that in installing a new venv, it installs under the same exact name as the virtual environment I deleted. Any ideas?

d1g33k commented 7 months ago

The act of poetry install will create a virtual environment Alternatively, you can clear the poetry cache. I ran into poetry problems doing this. After the virtenv is gone go through the setup again --with etc..

It doesn't seem to work when I try it, I get the same error. But I noticed that in installing a new venv, it installs under the same exact name as the virtual environment I deleted. Any ideas?

I am not sure setting up the poetry environment alone will solve this issue. I was running it on WSL. I unregistered from WSL, removed and reinstalled the distro and even disabled/re-enabled WSL and I still end up with the same error every time.

I had given up and tried to set everything up in Docker and cannot get my own setup to work. I am using an existing docker image for now, but that is not what I want and was hoping to have my own setup working again. https://github.com/imartinez/privateGPT/discussions/1707