basujindal/stable-diffusion

Errors on txt2img_gradio.py when trying to run container

aaaleeexTLC opened this issue · 1 comments

Could somebody please help me out with these error messages?? They seem to appear when I try to start the container (haven't been able to run it not even once)

I got this at the end of the command

docker compose up --build

As you can see, it seems it is loading well the model, but I get those "txt2img_gradio.py" error messages

✔ Container optimizedsd-sd-1 Recreated 0.4s
Attaching to optimizedsd-sd-1
optimizedsd-sd-1 | Clearing symlinks in /etc/ssl/certs...
optimizedsd-sd-1 | done.
optimizedsd-sd-1 | Updating certificates in /etc/ssl/certs...
optimizedsd-sd-1 | rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
optimizedsd-sd-1 | 124 added, 0 removed; done.
optimizedsd-sd-1 | Running hooks in /etc/ca-certificates/update.d...
optimizedsd-sd-1 | done.
optimizedsd-sd-1 | Loading model from models/ldm/stable-diffusion-v1/model.ckpt
optimizedsd-sd-1 | Traceback (most recent call last):
optimizedsd-sd-1 | File "optimizedSD/txt2img_gradio.py", line 46, in
optimizedsd-sd-1 | sd = load_model_from_config(f"{ckpt}")
optimizedsd-sd-1 | File "optimizedSD/txt2img_gradio.py", line 41, in load_model_from_config
optimizedsd-sd-1 | sd = pl_sd["state_dict"]
optimizedsd-sd-1 | KeyError: 'state_dict'
optimizedsd-sd-1 exited with code 1

it happens also when running txt2img

~/optimizedSD$ docker compose run sd python optimizedSD/optimized_txt2img.py --precision full --prompt "A monkey programming code on a computer. The monkey looks very smart." --H 512 --W 512 --seed 27 --n_iter 2 --n_samples 5 --ddim_steps 50
Clearing symlinks in /etc/ssl/certs...
done.
Updating certificates in /etc/ssl/certs...
rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
124 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Global seed set to 27
Loading model from models/ldm/stable-diffusion-v1/model.ckpt
Traceback (most recent call last):
File "optimizedSD/optimized_txt2img.py", line 190, in
sd = load_model_from_config(f"{opt.ckpt}")
File "optimizedSD/optimized_txt2img.py", line 32, in load_model_from_config
sd = pl_sd["state_dict"]
KeyError: 'state_dict'

~/optimizedSD$

Thanks
Alex

Any updates? It's 2023 and I'm having the exact same issue.