Fixing Common Stable Diffusion / Dreambooth Errors

In my limited time playing with Stable Diffusion and Dreambooth I have encountered a number of errors.


No module 'xformers'. Proceeding without it.

Add the following to /stable-diffusion-webui/webui.bat

set COMMANDLINE_ARGS=--xformers

or

set COMMANDLINE_ARGS= "--xformers"

Note: This will require Xformers to be installed correctly first

Failing that working you can also try adding the following to file \stable-diffusion-webui\modules\paths_internal.py

commandline_args = os.environ.get('COMMANDLINE_ARGS', "--xformers")

Launch skipping Python version check

Add the following to /stable-diffusion-webui/webui.bat

set COMMANDLINE_ARGS=--skip-python-version-check

ModuleNotFoundError: No module named 'models.blip'; 'models' is not a package

This issue comes about due to installing the TensorRT extension and then trying to use Dreambooth. It should be patched into future versions of Stable Diffusion hopefully, but in the interim, you can rename the following file and update the reference to it.

Rename file

/stable-diffusion-webui/extensions/Stable-Diffusion-WebUI-TensorRT/models.py 

to

/stable-diffusion-webui/extensions/Stable-Diffusion-WebUI-TensorRT/models_trt.py 

Then in the file \stable-diffusion-webui\extensions\Stable-Diffusion-WebUI-TensorRT\ui_trt.py

Change

from models import make_OAIUNetXL, make_OAIUNet

To

from models_trt import make_OAIUNetXL, make_OAIUNet

"Unable to extract checkpoint!" While trying to use Dreambooth

The checkpoint file you are using is most likely not supported by Dreambooth. Try a different checkpoint file.


ValueError: not enough values to unpack (expected 2, got 1)

Replace the contents of \stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py

with the contents of this paste bin

https://pastebin.com/raw/uqaV7kae

The main changes being

if with_prior_preservation:

to

if model_pred.shape[0] > 1 and with_prior_preservation:


and

loss = 

to

loss = instance_loss =

This list will be updated from time to time as our experiences expand.