ml-stable-diffusion icon indicating copy to clipboard operation
ml-stable-diffusion copied to clipboard

feat: Web UI for ML Stable Diffusion

Open soulteary opened this issue 2 years ago • 10 comments

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

soulteary avatar Dec 10 '22 11:12 soulteary

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:

  • Negative prompts
  • Ability to modify CFG scale
  • Using "Euler a" sampler
  • Ability to expand size from 512x512 to 512x576

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.

philipturner avatar Dec 10 '22 15:12 philipturner

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

AntonioCiolino avatar Dec 10 '22 22:12 AntonioCiolino

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

AntonioCiolino avatar Dec 10 '22 22:12 AntonioCiolino

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:

  • Sampling steps: 20 -> 50
  • Sampling method: Euler a -> PLMS
  • CFG Scale: 7 -> 7.5
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

philipturner avatar Dec 11 '22 02:12 philipturner

@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 avatar Dec 11 '22 04:12 soulteary

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

soulteary avatar Dec 11 '22 04:12 soulteary

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.

philipturner avatar Dec 11 '22 05:12 philipturner

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

soulteary avatar Dec 12 '22 04:12 soulteary

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!

philipturner avatar Dec 12 '22 04:12 philipturner

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

lucasjinreal avatar Mar 28 '23 12:03 lucasjinreal