apple / ml-stable-diffusion

Stable Diffusion with Core ML on Apple Silicon
MIT License
16.73k stars 932 forks source link

feat: Web UI for ML Stable Diffusion #56

Open soulteary opened 1 year ago

soulteary commented 1 year ago

WX20221210-194115@2x

Simply added a web UI to make ML Stable Diffusion easier to use.

// The seed parameter used to reproduce the results was removed

pr: https://github.com/apple/ml-stable-diffusion/pull/55

philipturner commented 1 year ago

Perhaps for long-term maintenance, it would be better to contribute to AUTOMATIC1111/WebUI? Apple hasn't responded to a single PR yet, while AUTOMATIC1111 seems much more open to contributions.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/5461#discussioncomment-4365479

Conversely, it is possible to amp up the feature set of your WebUI implementation? I need access to:

I'm fine modifying these features from command-line if that's also possible.

Sort of off topic, but does this repo work with any random .ckpt model, granted that it's a checkpoint based on stable diffusion v1.X? My use case is a transfer learning model forked from v1.5.

AntonioCiolino commented 1 year ago

Maybe branch this to another repo? Also, I’m using SD 2.0 which is 768x768. Glad you put together a web UI!

AntonioCiolino commented 1 year ago

Also, maybe there’s a bridge for Auto1111 - he said he didn’t have time to create it.

philipturner commented 1 year ago

My performance report was kind of a false alarm. I tested WebUI with the exact same settings as Apple's ML stable diffusion. It does consume 600 J of energy/image when running entirely on GPU, but the PyTorch version completes in 26 seconds. That compares favorably to the minimum 24 seconds with this repository and better than the 37 seconds with default .cpuAndGPU. Also, 3 hours of generating images nonstop on battery isn't that bad.

Settings changed:

Batch Count Startup Inference Total
1 2 sec 24 sec 26 sec
2 2 sec 48 sec 51 sec
3 2 sec 73 sec 76 sec
soulteary commented 1 year ago

@philipturner my personal opinion is that the ML Stable Diffusion project should have a simple web interface for ease of use.

It is a good choice to integrate ML into project AUTOMATIC1111/stable-diffusion-webui. I have tried it in the previous, and it is indeed more convenient to use.

Maybe after the project PR is merged, create a new PR for this. After all, if this PR is not accepted, it will feel more difficult to merge more complex implementations.

soulteary commented 1 year ago

@AntonioCiolino SD released 2.1, 3 days ago,

I recently wrote two blog posts about "sd in web ui".

Maybe later, I can write a new article on how to integrate this kind of project into AUTOMATIC1111/stable-diffusion-webui with relatively few changes.

philipturner commented 1 year ago

If you could mention on the benefit of power efficiency from using the neural engine, that would be cool. Otherwise, I don't see much to gain from investing such time into improving AUTO 1111's Web UI.

soulteary commented 1 year ago

If the project is not convenient and easy to use, fewer people will use it, and fewer people will use it, and fewer people will contribute and improve the project.

Therefore, the usability and ease of use in the initial stage of the personal opinion project are still very important.

If there is no "interface", using this project currently, it takes a few minutes to generate each image through the pipeline (bootstrap, loading models, inferences, change prompt text in command).

For 80% of people, after running it once, they may not want to waste any more time.

Especially, if he has other equipment and models to choose from :D

@philipturner

philipturner commented 1 year ago

I do understand where you’re coming from. I’ve just found Stable Diffusion WebUI sufficient for my research purposes. I wish you well on your efforts though!

lucasjinreal commented 1 year ago

@soulteary Hello, I'd like webui with CoreML caused I only have a mac, does there a way to use it now?