Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout error on batch_size >1 #6

Open
barshag opened this issue Jan 4, 2023 · 4 comments
Open

Timeout error on batch_size >1 #6

barshag opened this issue Jan 4, 2023 · 4 comments

Comments

@barshag
Copy link

barshag commented Jan 4, 2023

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...)

@mix1009
Copy link
Owner

mix1009 commented Jan 5, 2023

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.

@pablogpz
Copy link
Contributor

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.

@Ping7123
Copy link
Contributor

same here. ill give you error when it will happen again. (it happens on slow server with hires enabled)

@Ping7123
Copy link
Contributor

Ping7123 commented Oct 27, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants