NON906 / sd-webui-chatgpt

This is a repository for conversations using OpenAI API (compatible with ChatGPT) or llama.cpp in Stable Diffusion web UI.
MIT License
39 stars 7 forks source link

When image creation takes time with enable_hre set to true #9

Closed onexzero closed 6 months ago

onexzero commented 6 months ago

100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00, 4.59it/s] 5%|████▏ | 1/20 [00:00<00:04, 4.05it/s]ERROR:asyncio:Exception in callback H11Protocol.timeout_keep_alive_handler() handle: <TimerHandle when=6623.296 H11Protocol.timeout_keep_alive_handler()> Traceback (most recent call last): File "C:\Users\smbae\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 363, in timeout_keep_alive_handler self.conn.send(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 512, in send data_list = self.send_with_data_passthrough(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 537, in send_with_data_passthrough self._process_event(self.our_role, event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 272, in _process_event self._cstate.process_event(role, type(event), server_switch_event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_state.py", line 293, in process_event self._fire_event_triggered_transitions(role, _event_type) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_state.py", line 311, in _fire_event_triggered_transitions raise LocalProtocolError( h11._util.LocalProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE 100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:12<00:00, 1.61it/s] Total progress: 40it [00:17, 2.24it/s] *** API error: POST: http://localhost:7777/api/predict {'error': 'LocalProtocolError', 'detail': '', 'body': '', 'errors': "Can't send data when our state is ERROR"} Traceback (most recent call last): File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 109, in call await response(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 270, in call async with anyio.create_task_group() as task_group: File "F:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 597, in aexit raise exceptions[0] File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 273, in wrap await func() File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response return await super().stream_response(send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 255, in stream_response await send( File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 159, in _send await send(message) File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 490, in send output = self.conn.send(event=response) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 512, in send data_list = self.send_with_data_passthrough(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 527, in send_with_data_passthrough raise LocalProtocolError("Can't send data when our state is ERROR") h11._util.LocalProtocolError: Can't send data when our state is ERROR


ERROR: Exception in ASGI application Traceback (most recent call last): File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi result = await app( # type: ignore[func-returns-value] File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 273, in call await super().call(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in call raise exc File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 109, in call await response(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 270, in call async with anyio.create_task_group() as task_group: File "F:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 597, in aexit raise exceptions[0] File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 273, in wrap await func() File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response return await super().stream_response(send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 255, in stream_response await send( File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 159, in _send await send(message) File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 490, in send output = self.conn.send(event=response) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 512, in send data_list = self.send_with_data_passthrough(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 527, in send_with_data_passthrough raise LocalProtocolError("Can't send data when our state is ERROR") h11._util.LocalProtocolError: Can't send data when our state is ERROR 'AsyncRequest' object has no attribute '_json_response_data' chatgpt_txt2img.json

NON906 commented 6 months ago

I fixed at 07d7993323612d65be58ac8c720c62186e5a2df0. Please check it.

onexzero commented 6 months ago

It seems does not work!

55%|██████████████████████████████████ERROR:asyncio:Exception in callback H11Protocol.timeout_keep_alive_handler()t/s] handle: <TimerHandle when=20825.125 H11Protocol.timeout_keep_alive_handler()> Traceback (most recent call last): File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_state.py", line 249, in _fire_event_triggered_transitions new_state = EVENT_TRIGGERED_TRANSITIONS[role][state][event_type] KeyError: <class 'h11._events.ConnectionClosed'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\smbae\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 363, in timeout_keep_alive_handler self.conn.send(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 468, in send data_list = self.send_with_data_passthrough(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 493, in send_with_data_passthrough self._process_event(self.our_role, event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 242, in _process_event self._cstate.process_event(role, type(event), server_switch_event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_state.py", line 238, in process_event self._fire_event_triggered_transitions(role, event_type) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_state.py", line 251, in _fire_event_triggered_transitions raise LocalProtocolError( h11._util.LocalProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE 100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:05<00:00, 3.74it/s] 100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:10<00:00, 1.94it/s] Total progress: 40it [00:18, 2.22it/s] *** API error: POST: http://127.0.0.1:7777/api/predict {'error': 'LocalProtocolError', 'detail': '', 'body': '', 'errors': "Can't send data when our state is ERROR"} Traceback (most recent call last): File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 109, in call await response(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 270, in call async with anyio.create_task_group() as task_group: File "F:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 597, in aexit raise exceptions[0] File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 273, in wrap await func() File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response return await super().stream_response(send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 255, in stream_response await send( File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 159, in _send await send(message) File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 490, in send output = self.conn.send(event=response) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 468, in send data_list = self.send_with_data_passthrough(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 483, in send_with_data_passthrough raise LocalProtocolError("Can't send data when our state is ERROR") h11._util.LocalProtocolError: Can't send data when our state is ERROR


ERROR: Exception in ASGI application Traceback (most recent call last): File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi result = await app( # type: ignore[func-returns-value] File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 273, in call await super().call(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in call raise exc File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 109, in call await response(scope, receive, send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 270, in call async with anyio.create_task_group() as task_group: File "F:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 597, in aexit raise exceptions[0] File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 273, in wrap await func() File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response return await super().stream_response(send) File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 255, in stream_response await send( File "F:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 159, in _send await send(message) File "F:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 490, in send output = self.conn.send(event=response) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 468, in send data_list = self.send_with_data_passthrough(event) File "F:\stable-diffusion-webui\venv\lib\site-packages\h11_connection.py", line 483, in send_with_data_passthrough raise LocalProtocolError("Can't send data when our state is ERROR") h11._util.LocalProtocolError: Can't send data when our state is ERROR 'AsyncRequest' object has no attribute '_json_response_data'

onexzero commented 6 months ago

This problem seems to be related to the WEBUI API server. If you run webui without the --api argument, such as COMMANDLINE_ARGS= --xformers --port 7777 --opt-sdp-attention --upcast-sampling, it operates normally, but if you add --api, the error of this issue occurs.

NON906 commented 6 months ago

I pushed changes to a branch named hr_error. I added update processing for some modules.

In my environment, this error does not always occur, so I don't know if it has been fixed, but could you please try it?

onexzero commented 6 months ago

Good job! It's working.

NON906 commented 6 months ago

Thank you for confirming. Since it has been reflected in the main branch, close it.