sdwebuiapi
sdwebuiapi copied to clipboard
Timeout error on batch_size >1
When using it on GPU with 24GB RAM, and trying to set the batch_size to be bigger than 1, it returns error.
(Whereas, Though in the Automatic UI it works fine...)
Which api did you call? extra_batch_images? Posting the error message could be helpful.
The library does not set timeouts for any requests. It uses python 'requests' library, and it's documentation says there is no timeout set by default.
I suggest that you lower batch_size
between 1 and 8 and make use of n_iter
to generate multiple batches of size batch_size
. For example, if you want to generate 32 images you can call txt2img with batch_size=8, n_iter=4
instead of batch_size=32
.
From my experience this lowers the VRAM requirement.
same here. ill give you error when it will happen again. (it happens on slow server with hires enabled)
Here is the error i got
future: <Task finished name='Task-114' coro=<drawandsend() done, defined at /home/USRNAME/PycharmProjects/000/main.py:70> exception=TimeoutError()>
Traceback (most recent call last):
File "/home/USRNAME/PycharmProjects/000/main.py", line 97, in drawandsend
resultpic.image.save(f"{file}.png")
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/USRNAME/PycharmProjects/000/venv/lib/python3.11/site-packages/webuiapi/webuiapi.py", line 362, in async_post
async with session.post(url, json=json, auth=auth) as response:
File "/home/USRNAME/PycharmProjects/000/venv/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in __aenter__
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "/home/USRNAME/PycharmProjects/000/venv/lib/python3.11/site-packages/aiohttp/client.py", line 560, in _request
await resp.start(conn)
File "/home/USRNAME/PycharmProjects/000/venv/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 894, in start
with self._timer:
File "/home/USRNAME/PycharmProjects/000/venv/lib/python3.11/site-packages/aiohttp/helpers.py", line 721, in __exit__
raise asyncio.TimeoutError from None
TimeoutError
maybe can be fixed with something like this
import aiohttp
infinite_timeout = aiohttp.ClientTimeout(total=None)
async with aiohttp.ClientSession() as session:
async with session.post(url, json=json, auth=auth, timeout=infinite_timeout) as response:
(Code here)