Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

MLX Stable Diffusion WebUI for Apple MLX Stable Diffusion example code.

License

Notifications You must be signed in to change notification settings

neobundy/MLX-Stable-Diffusion-WebUI

Repository files navigation

Notes on Future Development

Due to serious Metal bugs, at least for me, that can't be managed, I won't be actively working on this project anymore. Feel free to explore on your own.

For more information, please refer to the NOTES_ON_METAL_BUGS.md file.

‼️Important Final Note: I'm archiving this repository as of April 13, 2024. I will keep the repository up for reference, but I won't be updating it. I am moving on to other projects. I hope this repository has been helpful to you. Thank you for your support.

MLX Stable Diffusion WebUI

This is a straightforward web interface for the Apple MLX Stable Diffusion example.

It is a modified version of mlx-examples/stable-diffusion by Apple. The original code can be found at https://github.com/ml-explore/mlx-examples/tree/main/stable_diffusion

The project is purely for educational purposes and is not intended for any serious use.

Depending on the availability of free time and the level of interest, there may be further development and refinement of these ideas.

thumb.jpeg

What's New

👉 Streamlit WebUI

👉 All models from Hugging Face can be used

👉 All SD 1.5 Models that can be converted to diffuser models are supported

When you select a non-diffuser model from the list, the model will be converted to a diffuser model and saved in the `diffuser_models` folder. 

The next time you run the code, the converted model will be used.

Please note that the conversion process may take a while.

👉 Implementation of Image to Image Generation

👉 I2I UI Cleaned Up

👉 Normalized I2I Base Image Strength Control

👉 Seed Control

👉 Half Precision Support

Installation

To run this example, you need to install Streamlit.

pip install streamlit   

Alternatively, you can install it using:

pip install -r requirements.txt

The first time you run the code with a new checkpoint, it will download it from Hugging Face, so it may take a while. Downloded checkpoints are cached, so the next time you run the code it will be faster.

How to Add Models from Hugging Face

To add a new model, you need to add a new entry to the _AVAILABLE_MODELS list in stable_diffusion_models.py. For example, to add the Lykon/absolute-reality-1.81 model, you would add the following entry:

_AVAILABLE_MODELS = [
    "stabilityai/stable-diffusion-2-1-base",
    "Lykon/dreamshaper-8",
    "Lykon/absolute-reality-1.81", # <--- Add this line
]

Added models will be available in the dropdown menu in the web interface automatically. XL models are not supported.

How to Add Local Models

Just symlink your Automatic1111 Stable Diffusion models folder to the models folder.

ln -s /path/to/your/automatic1111/stable_diffusion/models_folder ./models

ex) ln -s ~/stable-diffusion-webui/models/Stable-diffusion ./models

Note that all SDXL models are excluded based on their file names and not checked for compatibility.

You original unconverted models will remain intact. Converted models will be saved in the diffuser_models folder.

How to Run

To run the example, simply type in terminal:

streamlit run ./MLX-Stable-Diffusion-WebUI/main.py

Resources

Denoising Diffusion Probabilistic Models (DDPM) by Jonathan Ho, Ajay Jain, Pieter Abbeel https://arxiv.org/pdf/2006.11239.pdf

Umar Jamil(hkproj) PyTorch Stable Diffusion https://github.com/hkproj/pytorch-stable-diffusion

Notes on Contributions

While I deeply appreciate the community's interest and support, this project is currently not open for external contributions. As the sole author, I am crafting the content meticulously to ensure the highest quality and consistency in the educational material provided. This approach helps maintain the integrity and coherence of the content, tailored specifically for this project's unique educational goals.

I encourage you to use this resource for your learning and hope it helps you in your AI journey. Thank you for understanding and respecting the nature of this project.

About

MLX Stable Diffusion WebUI for Apple MLX Stable Diffusion example code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages