diffusionbee-stable-diffusion-ui
diffusionbee-stable-diffusion-ui copied to clipboard
Help: Any way to run SD from command line with DiffusionBee?
Obviously Stable Diffusion is present somewhere on my computer, but I can't find a way to run it from command line. I've found /Applications/DiffusionBee.app/Contents/Resources/core/txt2img, but this doesn't seem to accept any arguments (and I guess it meant to be called from the DiffusionBee application).
Is there a way to run Stable Diffusion from command line when DiffusionBee is installed? I'd love to experiment some more, and DiffusionBee is a really neat way of getting all I need onto my computer.
I just installed DiffusionBee a few hours ago, so sorry if I'm missing something obvious.
Related to #48.
I just did some experimenting (and looking at the code). Once you have txt2img running, you can ask it to run a prompt like so:
b2py t2im {"prompt": "cat", "W": 512, "H": 512, "seed": 42, "scale": 7.5, "ddim_steps": 25}
The result goes in /tmp/samples on your hard drive. Looking at the code:
https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/blob/aa8a4ff29537cbb9e5862e2a213d754111715002/stable-diffusion/txt2img.py#L228
...it seems like that's the only way to work the script; you can't call it with command line arguments. Presumably this makes it less useful for the sort of thing you are hoping to do (write your own script that calls this script with a variety of different arguments). I don't know if there's a way to work around that.
Anyway, thought I'd share what I found!
Thanks for the detective work! I thought DiffusionBee was a GUI on top of a command line interface, but I was obviously wrong. Thanks again!
I'm returning to this issue – it would still be great to be able to run DiffusionBee from a command line, and have arguments for setting various parameters.
My own use case is creating prototype images for cards in a board game. Command line interface would allow me to pull data from a spreadsheet and feed into DiffusionBee, have it run over night, and have prototype images in the morning. (I can imagine other use cases as well, involving creating images with varying inputs or settings.)
@iangilman: If you could confirm that CLI isn't possible also after the switch to Tensor Flow I'd be grateful. (But no stress.)
@Itangalo It looks like the backend executable is now:
/Applications/DiffusionBee.app/Contents/Resources/core/diffusionbee_backend
… but it's the same concept… you start it running, and then it waits for inputs. Here's the code:
https://github.com/divamgupta/diffusionbee-stable-diffusion-ui/blob/e594fee034ae647f10387d0c81e02a087fa1b33d/backends/stable_diffusion_tf/diffusionbee_backend.py#L47
I'd love a clean and direct CLI for stable diffusion within DiffusionBee. I went with this app initially because the direct Stable Diffusion CLI was complicated with virtual environments or something like that, and anyway I wanted to test something "normal" people could use. But I would like to use the version of these tools that are installed with DiffusionBee from the command line similar to the direct Stable Diffusion tools. Maybe this would be something like a diffusionbee tool inside the app that has things like diffusionbee txt2img that then just accepts all the standard CLI arguments, and basically is a bridge between the CLI and stable diffusion, so that we can have just the one copy of the weights and tools installed, but use them from both the GUI and CLI.
I wanted this too, so I looked into it. It turns out the backend, also made by @divamgupta, is at https://github.com/divamgupta/stable-diffusion-tensorflow and has a totally reasonable install and command line interface.
To install:
git clone [email protected]:divamgupta/stable-diffusion-tensorflow.git
python3 -m venv venv
source venv/bin/activate
pip install -r requirements_m1.txt
Using requirements_m1.txt is important for macs, the readme doesn't point that out.
Otherwise, the readme has how to run it. It also takes care of downloading models for you, which is nice.
I kept getting this:
Cloning into 'stable-diffusion-tensorflow'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Sounds like you need to sort out your SSH keys somehow. Another option is to download the zip from there:
https://github.com/divamgupta/stable-diffusion-tensorflow/archive/refs/heads/master.zip
… but that's less convenient when it comes time to pull new versions.
DiffusionBee app with CLI is still more ideal, somewhat missing "matrix" prompting.
I agree, nice to see that this exists, but would much prefer a CLI shipped within the app. Something that I could use without needing the main app open nor separate installation of tools.
I have 6 M1 macmini's in the office, it would be awesome if I could use the CLI to have them run generations.
Hi there,
Any update on this ?