kiri-art / docker-diffusers-api

Diffusers / Stable Diffusion in docker with a REST API, supporting various models, pipelines & schedulers.
https://kiri.art/
MIT License
202 stars 94 forks source link

Make sure xformers is installed correctly and a GPU is available #29

Closed rdcoder33 closed 1 year ago

rdcoder33 commented 1 year ago

Thanks for this repo.

Model is from hugging face rdmodel:

I'm getting the following error while running : docker build -t banana-sd --build-arg HF_AUTH_TOKEN=${MY_HF_WRITE_TOKEN} .

(Running on Mac M1)

 => ERROR [output 26/33] RUN python3 download.py                        1731.0s
------
 > [output 26/33] RUN python3 download.py:
#33 25.25 Downloading model: rdcoder/rd-model-1
#33 25.25 Initializing DPMSolverMultistepScheduler for rdcoder/rd-model-1...
Downloading: 100%|██████████| 289/289 [00:00<00:00, 82.2kB/s]
#33 27.70 Initialized DPMSolverMultistepScheduler for rdcoder/rd-model-1 in 2612ms
Downloading: 100%|██████████| 543/543 [00:00<00:00, 47.8kB/s]
Downloading: 100%|██████████| 342/342 [00:00<00:00, 30.0kB/s]
Downloading: 100%|██████████| 4.72k/4.72k [00:00<00:00, 427kB/s]]
Downloading: 100%|██████████| 1.22G/1.22G [06:18<00:00, 3.22MB/s]
Downloading: 100%|██████████| 612/612 [00:00<00:00, 118kB/s]1s/it]
Downloading: 100%|██████████| 492M/492M [02:50<00:00, 2.89MB/s]t] 
Downloading: 100%|██████████| 525k/525k [00:01<00:00, 328kB/s]it]
Downloading: 100%|██████████| 472/472 [00:00<00:00, 57.4kB/s]/it]
Downloading: 100%|██████████| 792/792 [00:00<00:00, 55.2kB/s]/it]
Downloading: 100%|██████████| 1.06M/1.06M [00:02<00:00, 431kB/s]t]
Downloading: 100%|██████████| 876/876 [00:00<00:00, 102kB/s]9s/it]
Downloading: 100%|██████████| 3.44G/3.44G [16:51<00:00, 3.40MB/s]]
Downloading: 100%|██████████| 552/552 [00:00<00:00, 38.4kB/s]2s/it]
Downloading: 100%|██████████| 335M/335M [01:35<00:00, 3.51MB/s]/it]
Fetching 15 files: 100%|██████████| 15/15 [28:05<00:00, 112.37s/it]
#33 1714.5 /api/diffusers/src/diffusers/models/attention.py:433: UserWarning: Could not enable memory efficient attention. Make sure xformers is installed correctly and a GPU is available: torch.cuda.is_available() should be True but is False. xformers' memory efficient attention is only available for GPU 
#33 1714.5   warnings.warn(
#33 1729.9 /tmp/tmpt4f85uyv: line 3:    58 Killed                  /bin/bash -c 'python3 download.py'
#33 1730.1 ERROR conda.cli.main_run:execute(47): `conda run /bin/bash -c python3 download.py` failed. (See above for error)
------
executor failed running [/opt/conda/bin/conda run --no-capture-output -n xformers /bin/bash -c python3 download.py]: exit code: 137

Important Dockerfile lines:

ARG MODEL_ID="rdcoder/rd-model-1"
ARG PRECISION=""
ARG PIPELINE="StableDiffusionPipeline"
ARG USE_DREAMBOOTH=0

permutations.yaml :

list:

  - name: rd-model-name
    HF_AUTH_TOKEN: $HF_AUTH_TOKEN
    MODEL_ID: rdcoder/rd-model-1
    PIPELINE: StableDiffusionPipeline
gadicc commented 1 year ago

Thanks for reporting, @rdcoder33, and with all the right details :pray:

Unfortunately M1 is not yet a supported platform... tracking in https://github.com/kiri-art/docker-diffusers-api/issues/20 but there is a lot of work involved and I'm not sure when I'll have a chance to get to it yet.

I'm a little surprised of this specific error though, especially during the build phase. Was it only for this model or every model?

In any event, I'll add a note to the README that currently only Nvidia GPUs are supported. Sorry about that.

xcreateadmin commented 1 year ago

@gadicc It is for every model. But yeah this was just an M1 issue. Works fine on Banana.

But the image is blurred / not clear. I read you gonna merge dev to main soon which will fix this (My model is trained on SD v2.1)

Let me if this will fix soon or else I will try with sd v1.5

gadicc commented 1 year ago

Ok thanks for reporting back.

Oh yeah there was an issue with the diffusers version in main that only some of the schedulers worked.

And that's right, there are some big changes on their way :)

If you're up for it you could take a look at https://forums.kiri.art/t/wip-upgrading-from-v0-to-v1/116 if you want to try it out before the formal release (it's been running in production on kiri.art for almost a month, but I'd like to get some more feedback from others before I make it an official release)... or if you just want a quick fix now, you could merge in everything from v0-dev-final branch to fix this issue in your current workflow. But moving forward it's all gonna be about "v1" :D

rdcoder33 commented 1 year ago

sure, I will check. Thanks for the work you are doing :)

gadicc commented 1 year ago

My pleasure :pray: It's such an exciting space to be in right now :raised_hands:

If you're doing anything fun with it and want to share, feel free to post here https://forums.kiri.art/t/showcase-see-it-in-action/37.