AbdBarho / stable-diffusion-webui-docker

Easy Docker setup for Stable Diffusion with user-friendly UI
Other
6.61k stars 1.1k forks source link

MacOS Support #35

Open yuriten opened 2 years ago

yuriten commented 2 years ago

Steps to Reproduce

  1. clone the repo
  2. copy model.ckpt to models
  3. cd ./AUTOMATIC1111
  4. docker compose up --build

There are no problems with the previous steps, but the last error is reported:

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 2/2
 ⠿ Network automatic1111_default    Created                                                                                                 0.0s
 ⠿ Container automatic1111-model-1  Created                                                                                                 0.1s
Attaching to automatic1111-model-1
Error response from daemon: could not select device driver "nvidia" with capabilities: [[gpu]]

Hardware / Software:

What do I need to do to fix this?

AbdBarho commented 2 years ago

@yuriten Mac Support is a big subject. I know that lstein fork has mac support, but I cannot integrate it because I don't have a mac.

If you or anyone would like to contribute and implement it I will gladly add it to the repo.

related #31

jasalt commented 2 years ago

There's also SD in app format for Mac (Apple Silicon) now: https://github.com/divamgupta/diffusionbee-stable-diffusion-ui. Probably easiest way to get SD running there while the Docker ARM support is lagging behind.

AdamGoyer commented 1 year ago

gm, Checking in briefly. Has any progress been made on Apple M1 Silicon since Sept 2022?

jasalt commented 1 year ago

@AdamGoyer Running the AUTOMATIC1111 UI without Docker following the wiki docs has been easiest and most feature rich way to run SD Web UI on M1 Mac from what I have tried out. Works quite fine with 16GB ram model at least. It uses Python machine learning packages customized for Mac hardware.

GPU passthrough for (Docker) VM is not available there and might take a while to happen.

AdamGoyer commented 1 year ago
jasalt commented 1 year ago

@AdamGoyer Haha, nice. It would be cool for sure but I wonder if it's even possible without Docker adding GPU passthrough like WSL2 which only Parallels and virgl seem to be able to do in some extent (ref https://apple.stackexchange.com/a/453103/29042). Or maybe use some tricks to use the PyTorch etc. from Mac side..

basavaraja-v commented 1 year ago

@yuriten you need to remove the nvidia and gpu related dependencies in the https://github.com/AbdBarho/stable-diffusion-webui-docker/blob/master/docker-compose.yml since your machine dont have GPU as below.

version: '3.9'

x-base_service: &base_service ports:

name: webui-docker

services: download: build: ./services/download/ profiles: ["download"] volumes:

Ntsako-Hlungwani commented 11 months ago

Docker Compose Configuration: Check your Docker Compose configuration to make sure that you have specified the correct runtime and options for NVIDIA GPUs. Here is an example snippet you might include in your docker-compose.yml file: services: automatic1111-model-1: runtime: nvidia environment:

cmutnik commented 6 months ago

@jasalt I made a docker image that spinds up locally (mac m3) and launches the AUTOMATIC1111/stable-diffusion-webui through localhost:7860

I got it to work using the vscode method from think link but that only worked in vscode cuz gradio is so fun. So I hacked together an image you can build and run locally, without requiring vscode; just needs the simple commands:

docker build -t sdwebui:lite -f Dockerfile .
docker run -it -p 7860:7860 sdwebui:lite

This has been tested and works, but the Dockerfile is a mess haha. Deff not something good enough to submit for a PR yet. Whenever I have the time Ill clean it up and put in a PR, or anyone else who wants to make it prettier/remove duplicate logic can. Until then, Im currently in the process of pushing it to docker hub:

docker image tag sdwebui:lite letsstartdocking/sdwebui:lightonmodels
docker push letsstartdocking/sdwebui:lightonmodels

All this to say -- its possible, I have the code; just need to find the time so a PR isn't embarrassingly ugly haha.

sd_webui_mac_m1

cmutnik commented 6 months ago

anyone who wants access to the really bad dockerfile can have it (just no shaming until its cleaned up haha)

cmutnik commented 6 months ago

PR is open, please see notes/comments for discussion.

MatchlessHeroVIP commented 2 months ago

mac boookpro M1 芯片build报错 could not select device driver "nvidia" with capabilities: [[compute utility]]

cmutnik commented 1 month ago

Is there a way to emulate an m1 chip so I can troubleshoot that for you?

ziqq commented 3 weeks ago

@MatchlessHeroVIP, i have this same issue.

Attaching to auto-1
Gracefully stopping... (press Ctrl+C again to force)
Error response from daemon: could not select devi
ziqq commented 3 weeks ago

Hi @cmutnik

Emulate M1 #### Emulating the Apple M1 chip is a challenging task because the M1 is based on the ARM architecture, and accurately emulating it requires specialized software and significant computational resources. #### Available Options: QEMU with ARM support: QEMU is a popular emulator that supports ARM emulation. However, emulating the M1 through QEMU requires deep technical knowledge and significant configuration, and even then, the performance will be far from what you’d get on an actual M1 device. #### UTM: UTM is a tool based on QEMU that offers a more user-friendly interface for ARM emulation on Apple devices. UTM supports the emulation of various architectures, including ARM, and could theoretically be used to emulate M1-based devices, though, again, the performance and accuracy will be limited. #### Rosetta 2: If the goal is to run applications developed for Intel on M1 devices, Apple provides Rosetta 2, which allows for this. This is not emulation but rather instruction translation, which can help developers test for compatibility. #### Why Emulating M1 is Difficult: The Apple M1 is a system on a chip (SoC) with highly integrated components, including the CPU, GPU, neural engine, and specialized modules for security and memory. Emulating all these components accurately is extremely complex and requires specialized hardware and software. #### Alternatives: If you need to test applications intended to run on the M1, the best option is to use actual devices with this chip or virtual machines supported by Apple, such as virtual devices in Xcode on a Mac with an M1 chip. #### In summary, there is no full-fledged emulation of the M1 chip currently available, but some tools can assist in specific scenarios.
cmutnik commented 3 weeks ago

Thanks @ziqq I am on an M3 which is also arm arch, so I was hoping of a way to emulate whatever the differences are between M1 and M2/M3 that allow all of this to work on M2/M3 but now on M1