AndBobsYourUncle / stable-diffusion-discord-bot

A Discord bot, written in Go, that interfaces with the Automatic 1111's API interface.
MIT License
128 stars 35 forks source link

change batch count of 4 to batch size of 4 instead #7

Open bitburner opened 1 year ago

bitburner commented 1 year ago

Right now the bot creates 4 images one by one as "Batch Count" is set to 4. If you change it to be the "Batch Size" set to 4 instead (and batch count back to 1) Automatic1111 will make all 4 images at once. instead of one by one. This should be a faster way to get the 4 images. Don't know if that throws a wrench in any logic but I did some tests on my system and to generate 4 768x768 it takes 45 seconds using "batch count" but using "batch size" it only takes 40 seconds (Euler a/20 steps, cfg 8, note that 512x512's speed discrepancy is smaller and only 2-3 seconds)

AndBobsYourUncle commented 1 year ago

Great suggestion! On my lowly gaming PC, a batch size of 4 with 768 images turns out to run out of memory. I need a 4090 😆

What I think I'd probably do is add both "batch size" and "batch count" as default bot settings (just like the 512 or 768 size is now).

That way each person using the bot would be able to customize as they see fit.

AndBobsYourUncle commented 1 year ago

@bitburner

If you'd like to try this out, I've opened a PR and branch with the added updates: https://github.com/AndBobsYourUncle/stable-diffusion-discord-bot/pull/8

Since you can build from source, you can do a:

git pull
git checkout add_batch_configuration
go build

That will build the bot version from the proposed changes.

It adds a new bot configuration that allows you to update the balance between count/size such that it results in a total of four images.

You can summon the configuration message by the Discord command /imagine_settings.

Let me know if this works for you. I've tested it myself, and it seems good, but maybe you run into something.

vonhex commented 1 year ago

image Im now getting two generations regardless of settings, one via batch size and one batch count. If I change it back to the original settings it does batch count twice

vonhex commented 1 year ago

2} 2023/03/02 16:40:54 Processing imagine #1080998197389959179: test [icture 2023/03/02 16:41:03 Seeds: [3414115480 3414115481 3414115482 3414115483] Subseeds:[1158651966 1158651967 1158651968 1158651969] 2023/03/02 16:41:28 Error responding to interaction: HTTP 404 Not Found, {"message": "Unknown interaction", "code": 10062} 2023/03/02 16:41:29 Processing imagine #1080998346665250958: man riding horse in field 2023/03/02 16:41:39 Seeds: [1794222459 1794222460 1794222461 1794222462] Subseeds:[3623849655 3623849656 3623849657 3623849658]