Coder Social home page Coder Social logo

sd_dreambooth_extension's Issues

AttributeError: 'UNet2DConditionModel' object has no attribute 'enable_gradient_checkpointing'

Just trying to Train my first model but can't seem to get it to run the training.

Here's the full log:

Starting Dreambooth training...
 VRAM cleared.
 Allocated: 0.0GB
 Reserved: 0.0GB

 Loaded model.
 Allocated: 0.0GB
 Reserved: 0.0GB

Error completing request
Arguments: ('141234', 'I:\\Git\\AI\\Training\\1234\\data\\prepped\\', '', '1234', '*', '', '', 1.0, 7.5, 40.0, 0, 512, False, True, 1, 1, 1, 1000, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 200, 1000, 'no', True, '', False) {}
Traceback (most recent call last):
  File "I:\Git\AI\SDWebUI\modules\ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "I:\Git\AI\SDWebUI\webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "I:\Git\AI\SDWebUI\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "I:\Git\AI\SDWebUI\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 539, in main
    unet.enable_gradient_checkpointing()
  File "I:\Git\AI\SDWebUI\venv\lib\site-packages\torch\nn\modules\module.py", line 1207, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'UNet2DConditionModel' object has no attribute 'enable_gradient_checkpointing'

Given I'm mostly using the default values I'm wondering if I'm just not formatting the file path correctly?

Running on Win11 with an RTX3080

Keep xformers optimization in training.

In the latest webui, it is possible to keep the xformers optimization in TI to allow TI on 6GB, and after the xformers attention block fix the results are no longer bad.
I did a quick test training keeping xformers, and the results are still good, but further experiments are required, as to:

  1. whether xformers would affect the training result (if in a bad way);
  2. can xformers actually save VRAM, and by how much, and the performance impact.

Manual_seed expected a long, but got NoneType

Steps:  33%|███▎      | 100/300 [01:04<01:43,  1.93it/s, loss=0.0873, lr=5e-6]You have passed `None` for safety_checker to disable its functionality in <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'>. Note that this might lead to problems when using <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> and is not recommended.
2022-11-08T18:06:02.195544028Z You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 .
2022-11-08T18:06:02.294639436Z Error completing request
2022-11-08T18:06:02.294676939Z Arguments: ('shivamOrangeBag', '/workspace/input/', '', 'photo of a sks bag', 'photo of a bag', '', '', 1.0, 7.5, 40.0, 0, 512, False, True, 1, 4, 1, 300, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 100, 0, 'no', True, '', False, True, True) {}
2022-11-08T18:06:02.295402196Z Traceback (most recent call last):
2022-11-08T18:06:02.295416418Z   File "/workspace/stable-diffusion-webui/modules/ui.py", line 185, in f
2022-11-08T18:06:02.295438063Z     res = list(func(*args, **kwargs))
2022-11-08T18:06:02.295447088Z   File "/workspace/stable-diffusion-webui/webui.py", line 55, in f
2022-11-08T18:06:02.295455958Z     res = func(*args, **kwargs)
2022-11-08T18:06:02.295464711Z   File "/workspace/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 265, in start_training
2022-11-08T18:06:02.295474084Z     trained_steps = main(config)
2022-11-08T18:06:02.295482708Z   File "/workspace/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 856, in main
2022-11-08T18:06:02.295491955Z     g_cuda = torch.Generator(device=accelerator.device).manual_seed(args.seed)
2022-11-08T18:06:02.295500592Z RuntimeError: manual_seed expected a long, but got NoneType
2022-11-08T18:06:02.295509563Z 
2022-11-08T18:06:02.304687607Z 
Steps:  33%|███▎      | 100/300 [01:05<02:10,  1.54it/s, loss=0.0873, lr=5e-6]

Happens when I want to generate a thumbnail every 100 steps

8bit adam does not work on Windows.

ShivShiram's repo bypassed this issue by using WSL2 and a docker container for bitsandbytes's required CUDA libraries.
With Windows, the following error occurs upon training:

CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
CUDA SETUP: WARNING! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!
CUDA SETUP: Loading binary C:\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.so...
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
CUDA SETUP: WARNING! libcuda.so not found! Do you have a CUDA driver installed? If you are on a cluster, make sure you are on a CUDA machine!
CUDA SETUP: Loading binary C:\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.so...
CUDA SETUP: Problem: The main issue seems to be that the main CUDA library was not detected.
CUDA SETUP: Solution 1): Your paths are probably not up-to-date. You can update them via: sudo ldconfig.
CUDA SETUP: Solution 2): If you do not have sudo rights, you can do the following:
CUDA SETUP: Solution 2a): Find the cuda library via: find / -name libcuda.so 2>/dev/null
CUDA SETUP: Solution 2b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_2a
CUDA SETUP: Solution 2c): For a permanent solution add the export from 2b into your .bashrc file, located at ~/.bashrc
Exception importing 8bit adam:
        CUDA Setup failed despite GPU being available. Inspect the CUDA SETUP outputs aboveto fix your environment!
        If you cannot find any issues and suspect a bug, please open an issue with detals about your environment:
        https://github.com/TimDettmers/bitsandbytes/issues
The config attributes {'set_alpha_to_one': False, 'skip_prk_steps': True, 'steps_offset': 1} were passed to DDPMScheduler, but are not expected and will be ignored. Please verify your scheduler_config.json configuration file.
 Scheduler Loaded
 Allocated: 0.2GB
 Reserved: 0.2GB
  Total target lifetime optimization steps = 1000
 CPU: False Adam: False, Prec: fp16, Prior: False, Grad: True, TextTr: True

Disabling save checkpoint every N steps causes training to fail

For the option Save a checkpoint every N steps, 0 to disable
When setting it to 0, at the end of training, this happens:

Traceback (most recent call last):
  File "C:\stable-diffusion-webui\modules\ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "C:\stable-diffusion-webui\webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "C:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 785, in main
    save_ckpt = not global_step % args.save_embedding_every and global_step != 0
ZeroDivisionError: integer division or modulo by zero

And the checkpoint does not get saved, have to restart from scratch.

Error installing requirements

Hi. Getting errors thrown when I run the WEBUI with the extension installed.

Error running install.py for extension sd_dreambooth_extension.
Command: "G:\StableDiffusion\stable-diffusion-webui\venv\Scripts\python.exe" "extensions\sd_dreambooth_extension\install.py"
Error code: 1
stdout: Installing requirements for Dreambooth
Installing torch and torchvision

stderr: Traceback (most recent call last):
  File "G:\StableDiffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\install.py", line 12, in <module>
    run(f'"{python}" -m {torch_cmd}', "Installing torch and torchvision", "Couldn't install torch")
  File "G:\StableDiffusion\stable-diffusion-webui\launch.py", line 34, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install torch.
Command: "G:\StableDiffusion\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
Error code: 2
stdout: Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu116
Collecting torch==1.12.1+cu116
  Downloading https://download.pytorch.org/whl/cu116/torch-1.12.1%2Bcu116-cp310-cp310-win_amd64.whl (2388.4 MB)
     -----                                    0.3/2.4 GB 13.1 MB/s eta 0:02:37

Tried running as admin, no luck. Python is up to date as is AUTO's WebUI.

Webui failed to load dreambooth

I encountered an error. I installed dreambooth by entering the git address, but now I cannot load dreambooth in the UI. The error is as follows:

C:\SDwebUI-AUTOMATIC1111_V5>set COMMANDLINE_ARGS=--xformers --deepdanbooru
Error loading script: main.py
Traceback (most recent call last):
File "C:\SDwebUI-AUTOMATIC1111_V5\modules\scripts.py", line 170, in load_scripts
exec(compiled, module.dict)
File "C:\SDwebUI-AUTOMATIC1111_V5\extensions\sd_dreambooth_extension\scripts\main.py", line 3, in
from dreambooth import conversion, dreambooth
File "C:\SDwebUI-AUTOMATIC1111_V5\extensions\sd_dreambooth_extension\dreambooth\conversion.py", line 26, in
from dreambooth.dreambooth import get_db_models
File "C:\SDwebUI-AUTOMATIC1111_V5\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 10, in
from dreambooth.train_dreambooth import main
File "C:\SDwebUI-AUTOMATIC1111_V5\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 20, in
from accelerate import Accelerator
ModuleNotFoundError: No module named 'accelerate'

How can I solve it. please

no kernel image is available for execution on the device at line 167 in file D:\ai\tool\bitsandbytes\csrc\ops.cu

Getting this error from bitsandbytes when running dreambooth in auto1111. I have seen the fix listed here but it's not clear how to implement it in Windows.

GPU is a 1080ti with 11GB VRAM

CUDA SETUP: Loading binary C:\SD\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda116.dll...
 Scheduler Loaded
 Allocated: 0.3GB
 Reserved: 0.3GB

  Total target lifetime optimization steps = 1000
 CPU: False Adam: True, Prec: no, Prior: True, Grad: True, TextTr: True
 Allocated: 4.0GB
 Reserved: 4.1GB

Steps:   0%|                                                                                  | 0/1000 [00:00<?, ?it/s]Error no kernel image is available for execution on the device at line 167 in file D:\ai\tool\bitsandbytes\csrc\ops.cu
Press any key to continue . . .

Bitsandbytes Error

CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
WARNING: No libcudart.so found! Install CUDA or the cudatoolkit package (anaconda)!
CUDA SETUP: Loading binary C:\SUPER_SD_2.0\stable-diffusion-webui-master\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.so...

i already have Cuda installed so i don't get what's going on here.
Build cuda_11.6.r11.6/compiler.31057947_0

Maybe it's because i don't have anaconda installed?

Unable to parse config.json while generating preview image

Traceback (most recent call last):
File "E:\stable-diffusion-webui\venv\lib\site-packages\transformers\configuration_utils.py", line 601, in _get_config_dict
resolved_config_file = cached_path(
File "E:\stable-diffusion-webui\venv\lib\site-packages\transformers\utils\hub.py", line 300, in cached_path
raise ValueError(f"unable to parse {url_or_filename} as a URL or as a local path")
ValueError: unable to parse E:\stable-diffusion-webui\models\dreambooth\default\working\config.json as a URL or as a local path

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\stable-diffusion-webui\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "E:\stable-diffusion-webui\webui.py", line 54, in f
res = func(*args, **kwargs)
File "E:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 265, in start_training
trained_steps = main(config)
File "E:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 814, in main
text_enc_model = CLIPTextModel.from_pretrained(args.working_dir,
File "E:\stable-diffusion-webui\venv\lib\site-packages\transformers\modeling_utils.py", line 1764, in from_pretrained
config, model_kwargs = cls.config_class.from_pretrained(
File "E:\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\configuration_clip.py", line 126, in from_pretrained
config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
File "E:\stable-diffusion-webui\venv\lib\site-packages\transformers\configuration_utils.py", line 553, in get_config_dict
config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
File "E:\stable-diffusion-webui\venv\lib\site-packages\transformers\configuration_utils.py", line 634, in _get_config_dict
raise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this model, couldn't find it in the cached files and it looks like E:\stable-diffusion-webui\models\dreambooth\default\working is not the path to a directory containing a config.json file.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.

Missing key(s) in state_dict

When creating a model, it reports an error:

RuntimeError: Error(s) in loading state_dict for CLIPTextModel:
        Missing key(s) in state_dict: "text_model.embeddings.position_ids", ...
        Unexpected key(s) in state_dict: "embeddings.position_ids", ...

I need to change line 713 in conversion.py from

text_model_dict[key[len("cond_stage_model.transformer."):]] = checkpoint[key]

to

text_model_dict["text_model." + key[len("cond_stage_model.transformer."):]] = checkpoint[key]

to work.

TypeError: start_training() takes 36 positional arguments but 38 were given

When I try to start the model trainer, the console returns this:

Traceback (most recent call last): File "C:\Users\celar\stable-diffusion-webui\modules\ui.py", line 185, in f res = list(func(*args, **kwargs)) File "C:\Users\celar\stable-diffusion-webui\webui.py", line 54, in f res = func(*args, **kwargs) TypeError: start_training() takes 36 positional arguments but 38 were given

I am using the standard settings.

Smart PreProcess Tab

Not an issue, but what is the smart preprocess tab in your example? Been hoping someone introduced better pre-processing settings in the Auto1111 repo.

PIL.UnidentifiedImageError: cannot identify image file '/home/stable/stable-diffusion-webui/requirements_versions.txt'

If you do not (or forget to) set a Classification dataset directory (which says optional), after the classification images are generated, the training routine will fail (presumably because the directory was not set):

Traceback (most recent call last):
  File "/home/stable/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/home/stable/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 719, in main
    for step, batch in enumerate(train_dataloader):
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/accelerate/data_loader.py", line 357, in __iter__
    next_batch = next(dataloader_iter)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 681, in __next__
    data = self._next_data()
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 721, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 360, in __getitem__
    class_image = Image.open(class_path)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/PIL/Image.py", line 3147, in open
    raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file '/home/stable/stable-diffusion-webui/requirements_versions.txt'

Should/would it be possible to default this value to something? I can work around it now that I know that the 2 parameters together are required, but currently it might be seen as a bit unintuitive/confusing.

8bit adam not in requirements.txt

When clicking train with adam ticked:
Exception importing 8bit adam: No module named 'bitsandbytes'
CPU: False Adam: False, Prec: fp16, Prior: False, Grad: True, TextTr: True

add 'bitsandbytes' to requirements.txt to fix the issue.

RuntimeError: expected scalar type Half but found Float

I am receiving this error whenever I try running training, not sure what is going on. Running on a 3060 12GB

Starting Dreambooth training...
VRAM cleared.
Allocated: 0.9GB
Reserved: 0.9GB

Loaded model.
Allocated: 0.9GB
Reserved: 0.9GB

Scheduler Loaded
Allocated: 1.3GB
Reserved: 1.3GB
Total target lifetime optimization steps = 2000
CPU: False Adam: False, Prec: fp16, Prior: False, Grad: True, TextTr: False
Allocated: 4.5GB
Reserved: 4.6GB

Steps: 0%| | 0/2000 [00:00<?, ?it/s]Error completing request
Arguments: ('Auto1111Test', 'C:\Users\Riley\Downloads\TestModel', '', 'photo of test person', '*', '', '', 1.0, 7.5, 40.0, 0, 512, False, False, 1, 1, 1, 2000, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 500, 500, 'fp16', True, '', False) {}
Traceback (most recent call last):
File "C:\Users\Riley\stable-diffusion-webui\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "C:\Users\Riley\stable-diffusion-webui\webui.py", line 54, in f
res = func(*args, **kwargs)
File "C:\Users\Riley\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 256, in start_training
trained_steps = main(config)
File "C:\Users\Riley\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 744, in main
encoder_hidden_states = text_encoder(batch["input_ids"])[0]
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 722, in forward
return self.text_model(
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 643, in forward
encoder_outputs = self.encoder(
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 574, in forward
layer_outputs = encoder_layer(
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 317, in forward
hidden_states, attn_weights = self.self_attn(
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\Riley\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 257, in forward
attn_output = torch.bmm(attn_probs, value_states)
RuntimeError: expected scalar type Half but found Float

Steps: 0%| | 0/2000 [00:03<?, ?it/s]

Broken with latest commits due to arguments qty

Since Pad tokens and horizontal flip was added, number of arguments is now more, then expected:


2022-11-08T17:33:57.993890639Z Arguments: ('shivamOrangeBag', '/workspace/input/', '', 'photo of a sks bag', 'photo of a bag', '', '', 1.0, 7.5, 40.0, 0, 512, False, True, 1, 4, 1, 300, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 100, 0, 'no', True, '', False, True, True) {}
2022-11-08T17:33:57.994184812Z Traceback (most recent call last):
2022-11-08T17:33:57.994203030Z   File "/workspace/stable-diffusion-webui/modules/ui.py", line 185, in f
2022-11-08T17:33:57.994213769Z     res = list(func(*args, **kwargs))
2022-11-08T17:33:57.994222961Z   File "/workspace/stable-diffusion-webui/webui.py", line 55, in f
2022-11-08T17:33:57.994232061Z     res = func(*args, **kwargs)
2022-11-08T17:33:57.994240759Z TypeError: start_training() takes 36 positional arguments but 38 were given

How to use this extension in auto1111?

installed with the 'Install from URL' -- ran it and it installed and downloaded the reqs for dreambooth , but can't see any part of the gradio interface to use it?

[Feature Request] Generate classification dataset automatically

Shiv's repo does this where it makes a set of 50 images of the classification prompt if the class folder is empty.
Right now in the webui I have to generate the prompt manually in txt2img and then move them to a new folder that I feed into the extension.
Would be good if that process can be automated.

RuntimeError: CUDA error: invalid argument

I'm running this dreambooth extension using all the default settings and only changing these three settings:

Instance prompt: photo of florich girl
Class prompt: photo of girl
Dataset directory: D:\images\flo-output

When I run this I get the error "RuntimeError: CUDA error: invalid argument"

Is there something obvious causing this?

Running on 3090 24GB

Arguments: ('florich', 'D:\\images\\flo-output', '', 'photo of florich girl', 'photo of girl', '', '', 1.0, 7.5, 40.0, 0, 512, False, True, 1, 1, 1, 1000, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 500, 500, 'no', True, '', False, True, True) {}
Traceback (most recent call last):
  File "C:\github\stable-diffusion-webui\modules\[ui.py](http://ui.py/)", line 185, in f
    res = list(func(*args, **kwargs))
  File "C:\github\stable-diffusion-webui\[webui.py](http://webui.py/)", line 54, in f
    res = func(*args, **kwargs)
  File "C:\github\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\[dreambooth.py](http://dreambooth.py/)", line 265, in start_training
    trained_steps = main(config)
  File "C:\github\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\[train_dreambooth.py](http://train_dreambooth.py/)", line 790, in main
    accelerator.backward(loss)
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\accelerate\[accelerator.py](http://accelerator.py/)", line 884, in backward
    loss.backward(**kwargs)
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\torch\[_tensor.py](http://_tensor.py/)", line 396, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\torch\autograd\[__init__.py](http://__init__.py/)", line 173, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\torch\autograd\[function.py](http://function.py/)", line 253, in apply
    return user_fn(self, *args)
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\torch\utils\[checkpoint.py](http://checkpoint.py/)", line 146, in backward
    torch.autograd.backward(outputs_with_grad, args_with_grad)
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\torch\autograd\[__init__.py](http://__init__.py/)", line 173, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\torch\autograd\[function.py](http://function.py/)", line 253, in apply
    return user_fn(self, *args)
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\xformers\[ops.py](http://ops.py/)", line 369, in backward
    ) = torch.ops.xformers.efficient_attention_backward_cutlass(
  File "C:\github\stable-diffusion-webui\venv\lib\site-packages\torch\[_ops.py](http://_ops.py/)", line 143, in __call__
    return self._op(*args, **kwargs or {})
RuntimeError: CUDA error: invalid argument
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

Constant out of memory errors on 12GB rtx 3060 no matter what settings I use.

Used every single "VRAM saving" setting there is. 8bit adam, dont cache latents, gradient checkpointing, fp16 mixed precision, etc. Even dropped the training resolution to abysmally low resolutions like 384 just to see if it would work. Same out of memory errors.

Isn't this supposed to be working with 12GB cards?

PIL.UnidentifiedImageError: cannot identify image file .DS_Store

Platform: M1 Mac OS , 32GB ram

When training I get the following error. The problem appears because finder generates that file automatically and is not an image. I do not know if also happens in Linux or Windows.

Error completing request
Arguments: ('pepe', '/Users/eduardoreyes/Desktop/backups/Training images/pepe/processed', '/Users/eduardoreyes/Desktop/backups/Training images/Stable-Diffusion-Regularization-Images-person_ddim/person_ddim', 'photo of pepe person', 'photo of a person', '', '', 1.0, 7.5, 40.0, 400, 512, False, True, 1, 1, 1, 1000, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 500, 500, 'no', True, '', False) {}
Traceback (most recent call last):
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 716, in main
    for step, batch in enumerate(train_dataloader):
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/accelerate/data_loader.py", line 356, in __iter__
    next_batch = next(dataloader_iter)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 630, in __next__
    data = self._next_data()
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 673, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 58, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 343, in __getitem__
    instance_image = Image.open(instance_path)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/PIL/Image.py", line 3186, in open
    raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file '/Users/eduardoreyes/Desktop/backups/Training images/pepe/processed/.DS_Store'

AttributeError: 'DreamboothConfig' object has no attribute 'revision'

Just did a new git pull like 5 minutes ago since it looks like you are actively working things, hope that this is ok to report:

Now when training, as soon as first preview image render attempts, I get this error:

Traceback (most recent call last):
  File "/home/stable/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/home/stable/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 265, in start_training
    trained_steps = main(config)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 829, in main
    revision=args.revision,
AttributeError: 'DreamboothConfig' object has no attribute 'revision'

Does not run on 10GB GPUs and below

I've enabled all the suggested flags to reduce VRAM (8-bit, fp16, Gradient Checkpointing, Don't Cache Latents), but the out of memory error remains. I have 10GB of VRAM. Is it possible to run in 10GB?

No module named 'accelerate'

I just installed the dreambooth extension in the Extension tab and after installing it I get this message:

Error loading script: main.py
Traceback (most recent call last):
File "H:\Stable-Diffusion-Automatic\stable-diffusion-webui\modules\scripts.py", line 170, in load_scripts
exec(compiled, module.dict)
File "H:\Stable-Diffusion-Automatic\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\main.py", line 3, in
from dreambooth import conversion, dreambooth
File "H:\Stable-Diffusion-Automatic\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\conversion.py", line 26, in
from dreambooth.dreambooth import get_db_models
File "H:\Stable-Diffusion-Automatic\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 10, in
from dreambooth.train_dreambooth import main
File "H:\Stable-Diffusion-Automatic\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 20, in
from accelerate import Accelerator
ModuleNotFoundError: No module named 'accelerate'

Did you miss something in the automatic installation of the extension? I am using an RTX 3060 card, without --xformers.

AttributeError: 'UNet2DConditionModel' object has no attribute 'enable_gradient_checkpointing'

After your latest commit (try...except preview wrapping), now when I try to start training, I get this one:

Traceback (most recent call last):
  File "/home/stable/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/home/stable/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 265, in start_training
    trained_steps = main(config)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 563, in main
    unet.enable_gradient_checkpointing()
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1207, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'UNet2DConditionModel' object has no attribute 'enable_gradient_checkpointing'

Various error when installing

Hi there, I tried to install the Dreambooth extension and got these following errors, can you please help?

"Error loading script: main.py
Traceback (most recent call last):
File "E:AI\SD\Local\stable-diffusion-webui\modules\scripts.py", line 155, in load_scripts
exec(compiled, module.dict)
File "E:AI\SD\Local\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\main.py", line 3, in from dreambooth import conversion, dreambooth
File "E:AI\SD\Local\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\conversion.py", line 26, in
from dreambooth.dreambooth import get_db_models
File "E:AI\SD\Local\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 10, in
from dreambooth.train_dreambooth import main
File "E:AI\SD\Local\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 20, in
from accelerate import Accelerator
ModuleNotFoundError: No module named 'accelerate'"

Thanks so much

Possible typo on "Preview image negative instance prompt"

Hi,

The placeholder text for the negative prompt field reads, "Leave blank to use instance prompt." I haven't looked at the source code, but I assume this is not accurate. Logically, a blank value should not produce a negative prompt.

AttributeError: 'DreamboothConfig' object has no attribute 'seed'

Hello! When trying to train from A1111 extension (great job, BTW!!!!), I receive the following error after the first checkpoint at 500 is saved:

Traceback (most recent call last):
  File "/home/stable/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/home/stable/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 833, in main
    g_cuda = torch.Generator(device=accelerator.device).manual_seed(args.seed)
AttributeError: 'DreamboothConfig' object has no attribute 'seed'

KeyError: 'state_dict' not fix

图片
图片

created with animefull-latest.ckpt model [7G ver].
fact that always find this problem in dreambooth.
I tried to solved it like this, in some scripts it works,might can not work on this scripts
图片

Successfully trained model OOM on conversion

Using the CPU only options for training, it saves the model by using GPU VRAM. Currently using a 3070 with 8 GB VRAM and after 100 steps, when it went to save it gave an OOM.

RuntimeError: CUDA out of memory. Tried to allocate 512.00 MiB (GPU 0; 8.00 GiB total capacity; 7.20 GiB already allocated; 0 bytes free; 7.30 GiB reserved in total by PyTorch)...

The VRAM was also not freed after failure and the training was stopped.

Invalid requirement

stdout: Installing requirements for Dreambooth

stderr: Traceback (most recent call last):
File "C:\SUPER SD 2.0\stable-diffusion-webui-master\extensions\sd_dreambooth_extension-main\install.py", line 4, in
run_pip(f"install -r {reqs}", "requirements for Dreambooth")
File "C:\SUPER SD 2.0\stable-diffusion-webui-master\launch.py", line 63, in run_pip
return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
File "C:\SUPER SD 2.0\stable-diffusion-webui-master\launch.py", line 34, in run
raise RuntimeError(message)
RuntimeError: Couldn't install requirements for Dreambooth.
Command: "C:\SUPER SD 2.0\stable-diffusion-webui-master\venv\Scripts\python.exe" -m pip install -r C:\SUPER SD 2.0\stable-diffusion-webui-master\extensions\sd_dreambooth_extension-main\requirements.txt --prefer-binary
Error code: 1
stdout:
stderr: ERROR: Invalid requirement: '2.0\stable-diffusion-webui-master\extensions\sd_dreambooth_extension-main\requirements.txt'
Hint: It looks like a path. File '2.0\stable-diffusion-webui-master\extensions\sd_dreambooth_extension-main\requirements.txt' does not exist.

Error when finishing training - AssertionError: Torch not compiled with CUDA enabled

Platform: M1 Mac, RAM 32GB.
Generating images works with MPS instead of CUDA and with the Dreambooth extension training works with or without the CPU only option enabled.

I tried to test training with 10 steps and it trains the model but when it finishes it throw the following message:

Total target lifetime optimization steps = 10
 CPU: True Adam: False, Prec: no, Prior: True, Grad: True, TextTr: True
 Allocated: 0.0GB
 Reserved: 0.0GB

Steps: 100%|███████████████| 10/10 [04:32<00:00, 26.22s/it, loss=0.514, lr=5e-6]Error completing request
Arguments: ('pepe', '/Users/eduardoreyes/Desktop/backups/Weights/pepe/Processed', '/Users/eduardoreyes/Desktop/backups/Weights/Stable-Diffusion-Regularization-Images-person_ddim/person_ddim', 'photo of pepe person', 'photo of a person', '', '', 1.0, 7.5, 40.0, 440, 512, False, True, 1, 1, 1, 10, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 500, 500, 'no', True, '', True) {}
Traceback (most recent call last):
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 811, in main
    pipeline = pipeline.to("cuda")
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/diffusers/pipeline_utils.py", line 220, in to
    module.to(torch_device)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 987, in to
    return self._apply(convert)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 639, in _apply
    module._apply(fn)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 639, in _apply
    module._apply(fn)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 639, in _apply
    module._apply(fn)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 662, in _apply
    param_applied = fn(param)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 985, in convert
    return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
  File "/Users/eduardoreyes/Documents/stable-diffusion-webui/env/lib/python3.10/site-packages/torch/cuda/__init__.py", line 221, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Error when Generate a preview image every N steps set to 0

One of the things that throws me a Cuda out of memory error is when the training attempts to run a sample image. However when I set the 'Generate a preview image every N steps' to '0' to disable it I receive this error when starting training:

Error completing request... File "C:\stable-diffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 786, in main save_img = not global_step % args.save_preview_every and global_step != 0 ZeroDivisionError: integer division or modulo by zero

Unable to load concepts as JSON

I have created a concepts_list.json and have put its directory in the first box, but dreambooth doesn't load it.
image
(Don't mind the low training steps in the photo, this is a test to see if it works).
My json file has custom directories to image folders, here my concepts_list.json contents:

[
{
"instance_prompt": "true-full-body",
"class_prompt": "1girl, full body",
"instance_data_dir": "Train\dreambooth\images\Instance\true-full-body_5",
"class_data_dir": "Train\dreambooth\images\Class\true-full-body_migliori"
}
]

(The image folders are in the stable diffusion webui root directory, this is why i use the short path, and yesterday with my personal ShivamShrirao's Repo it was warking).
I have tried path\to\json, path\to\json, path/to/json and path/to/images and all don't work. I don't know why cause yesterday i was using my personal ShivamShrirao's Repo and the same path was warking.

Log:
Starting Dreambooth training...
VRAM cleared.
Allocated: 0.0GB
Reserved: 0.0GB

Trying to parse: C:\Users\wgius\Desktop\stable-diffusion-webui\Train\dreambooth\concepts_list.json
Unable to load concepts as JSON, trying as file: 'str' object has no attribute 'read'
Loaded model.
Allocated: 0.0GB
Reserved: 0.0GB

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link

CUDA SETUP: Loading binary C:\Users\wgius\Desktop\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda116.dll...
Scheduler Loaded
Allocated: 0.2GB
Reserved: 0.2GB

Total target lifetime optimization steps = 5
CPU: False Adam: True, Prec: fp16, Prior: True, Grad: True, TextTr: True
Allocated: 3.8GB
Reserved: 3.9GB

Steps: 0%| | 0/5 [00:00<?, ?it/s]Error completing request
Arguments: ('truefullbodytest', '', '', '', '', '1girl, true-full-body', '', 1.0, 7.5, 40.0, 55, 512, False, True, 1, 1, 1, 5, 1, True, 5e-06, False, 'constant', 0, True, 0.9, 0.999, 0.01, 1e-08, 1, 0, 0, 'fp16', True, 'C:\Users\wgius\Desktop\stable-diffusion-webui\Train\dreambooth\concepts_list.json', False) {}
Traceback (most recent call last):
File "C:\Users\wgius\Desktop\stable-diffusion-webui\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "C:\Users\wgius\Desktop\stable-diffusion-webui\webui.py", line 54, in f
res = func(*args, **kwargs)
File "C:\Users\wgius\Desktop\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 256, in start_training
trained_steps = main(config)
File "C:\Users\wgius\Desktop\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 715, in main
for step, batch in enumerate(train_dataloader):
File "C:\Users\wgius\Desktop\stable-diffusion-webui\venv\lib\site-packages\accelerate\data_loader.py", line 348, in iter
current_batch = next(dataloader_iter)
File "C:\Users\wgius\Desktop\stable-diffusion-webui\venv\lib\site-packages\torch\utils\data\dataloader.py", line 681, in next
data = self._next_data()
File "C:\Users\wgius\Desktop\stable-diffusion-webui\venv\lib\site-packages\torch\utils\data\dataloader.py", line 721, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "C:\Users\wgius\Desktop\stable-diffusion-webui\venv\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\wgius\Desktop\stable-diffusion-webui\venv\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\wgius\Desktop\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 356, in getitem
class_image = Image.open(class_path)
File "C:\Users\wgius\Desktop\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3147, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file 'C:\Users\wgius\Desktop\stable-diffusion-webui\webui.sh'

Steps: 0%| | 0/5 [00:00<?, ?it/s]

This is not related, but on my rtx 3060 12 gb ShivamShrirao's Repo with --gradient_checkpointing and --use_8bit_adam dreambooth works, while in webui for some reason not; i think the rest of the parameters are more or less the same, and shouldn't affect memory usage too much anyway

Possibility to choose base directory?

I have automatic111 launched with cpkt directory since I have space issues.
Training with this extension always uses the normal automatic111 models path.

You have passed a non-standard module None. We cannot verify whether it has the correct type

I have installed Dreambooth with all the requirements into Automatic1111's folder by using the Extensions.

After creating a model and setting everything up according to the manual I get this error:

Starting Dreambooth training...
VRAM cleared.
Allocated: 0.9GB
Reserved: 0.9GB

You have passed a non-standard module None. We cannot verify whether it has the correct type
{'freq_shift', 'downsample_padding', 'block_out_channels', 'norm_num_groups', 'act_fn', 'out_channels', 'sample_size', 'mid_block_scale_factor', 'attention_head_dim', 'flip_sin_to_cos', 'down_block_types', 'in_channels', 'cross_attention_dim', 'center_input_sample', 'up_block_types', 'layers_per_block', 'norm_eps'} was not found in config. Values will be initialized to default values.
Error completing request
Arguments: ('dcmpol', 'C:\Users\daanp\OneDrive\Desktop\DreamBooth\Image files\dcmpol\processed 512', '', 'a photo of a man dcmpol', 'a photo of a man', 'a portrait of dcmpol, 35mm , magic hour', '', 1.0, 7.5, 40.0, 180, 512, False, True, 1, 1, 1, 1800, 1, True, 5e-06, False, 'constant', 0, True, 0.9, 0.999, 0.01, 1e-08, 1, 300, 3000, 'fp16', True, '', False) {}
Traceback (most recent call last):
File "C:\Users\daanp\OneDrive\Desktop\SUPER SD 2.0 Dependencies\stable-diffusion-webui\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "C:\Users\daanp\OneDrive\Desktop\SUPER SD 2.0 Dependencies\stable-diffusion-webui\webui.py", line 54, in f
res = func(*args, **kwargs)
File "C:\Users\daanp\OneDrive\Desktop\SUPER SD 2.0 Dependencies\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 256, in start_training
trained_steps = main(config)
File "C:\Users\daanp\OneDrive\Desktop\SUPER SD 2.0 Dependencies\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 486, in main
pipeline = StableDiffusionPipeline.from_pretrained(
File "C:\Users\daanp\OneDrive\Desktop\SUPER SD 2.0 Dependencies\stable-diffusion-webui\venv\lib\site-packages\diffusers\pipeline_utils.py", line 383, in from_pretrained
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "C:\Users\daanp\OneDrive\Desktop\SUPER SD 2.0 Dependencies\stable-diffusion-webui\venv\lib\site-packages\diffusers\modeling_utils.py", line 301, in from_pretrained
raise EnvironmentError(
OSError: Error no file named diffusion_pytorch_model.bin found in directory C:\Users\daanp\OneDrive\Desktop\SUPER SD 2.0 Dependencies\stable-diffusion-webui\models\dreambooth\dcmpol\working\safety_checker.

How can I fix this?

TypeError: string indices must be integers

I followed the example in Readme to try out multiple-concept option and got this error. All I did was directly copy-pasted the example with small changes in directory:

Starting Dreambooth training...
 VRAM cleared.
 Allocated: 0.0GB
 Reserved: 0.0GB

Trying to parse: [
    {
        "instance_prompt":      "photo of zwx dog",
        "class_prompt":         "photo of a dog",
        "instance_data_dir":    "E:/data/alvan",
        "class_data_dir":       "E:/data/dog"
    }
]
Error completing request
Arguments: ('DogSD1000', '', '', '*', '*', '', '', 1.0, 7.5, 40.0, 1500, 512, False, False, 1, 1, 1, 3000, 1, True, 5e-05, False, 'constant', 0, True, 0.9, 0.999, 0.01, 1e-08, 1, 500, 7000, 'fp16', False, '[\n    {\n        "instance_prompt":      "photo of zwx dog",\n        "class_prompt":         "photo of a dog",\n        "instance_data_dir":    "E:/data/alvan",\n        "class_data_dir":       "E:/data/dog"\n    }\n]', False) {}
Traceback (most recent call last):
  File "E:\Stable\stable-diffusion-webui\modules\ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "E:\Stable\stable-diffusion-webui\webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "E:\Stable\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "E:\Stable\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 478, in main
    class_images_dir = Path(concept["class_data_dir"])
TypeError: string indices must be integers

Prior reservation, args.prior_loss_weight doesn't exist

When I use prior reservation, it tells me
args.prior_loss_weight doesn't exist in the train_dreambooth.py
line 796
loss = loss + args.prior_loss_weight * prior_loss

I quickly turned it into loss = loss + prior_loss just to test it and it seems to be churning well. I'm not sure where args.prior_loss_weight should be defined.

also it would be good to specify the labels correctly.
db_train_batch_size = gr.Number(label="Batch Size", precision=1, value=1)
db_sample_batch_size = gr.Number(label="Class Batch Size", precision=1, value=1)
it's confusing, I needed to look into the code to see what is what. so Batch size should be labeled Train Batch Size etc...

CUDA error: invalid argument

Error completing request
Arguments: ('kxgman', 'D:\stable-diffusion-ui\data\chris', 'D:\stable-diffusion-ui\data\man', 'photo of kxg man', 'photo of a man', '', '', 1.0, 7.5, 1200.0, 0, 512, False, True, 1, 1, 1, 1000, 1, True, 5e-06, False, 'constant', 0, False, 0.9, 0.999, 0.01, 1e-08, 1, 1000, 1000, 'no', True, '', False, True, True) {}
Traceback (most recent call last):
File "D:\stable-diffusion-ui\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "D:\stable-diffusion-ui\webui.py", line 54, in f
res = func(*args, **kwargs)
File "D:\stable-diffusion-ui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 265, in start_training
trained_steps = main(config)
File "D:\stable-diffusion-ui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 790, in main
accelerator.backward(loss)
File "D:\stable-diffusion-ui\venv\lib\site-packages\accelerate\accelerator.py", line 884, in backward
loss.backward(**kwargs)
File "D:\stable-diffusion-ui\venv\lib\site-packages\torch_tensor.py", line 396, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File "D:\stable-diffusion-ui\venv\lib\site-packages\torch\autograd_init_.py", line 173, in backward
Variable.execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
File "D:\stable-diffusion-ui\venv\lib\site-packages\torch\autograd\function.py", line 253, in apply
return user_fn(self, *args)
File "D:\stable-diffusion-ui\venv\lib\site-packages\torch\utils\checkpoint.py", line 146, in backward
torch.autograd.backward(outputs_with_grad, args_with_grad)
File "D:\stable-diffusion-ui\venv\lib\site-packages\torch\autograd_init
.py", line 173, in backward
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
File "D:\stable-diffusion-ui\venv\lib\site-packages\torch\autograd\function.py", line 253, in apply
return user_fn(self, *args)
File "D:\stable-diffusion-ui\venv\lib\site-packages\xformers\ops.py", line 369, in backward
) = torch.ops.xformers.efficient_attention_backward_cutlass(
File "D:\stable-diffusion-ui\venv\lib\site-packages\torch_ops.py", line 143, in call
return self._op(*args, **kwargs or {})
RuntimeError: CUDA error: invalid argument
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1

CPU training fails

On Windows 11 when attempting CPU training I get this error:

Error an illegal memory access was encountered at line 167 in file D:\ai\tool\bitsandbytes\csrc\ops.cu

Look like it's got a hardcoded reference?

Also it looks like when 'Mixed Precision' is set to 'FP16', CPU training also fails due to:

RuntimeError: "slow_conv2d_cpu" not implemented for 'Half'

Don't think CPU training supports FP16.

RuntimeError: expected scalar type Half but found Float

Another bug here. When setting preview images to something higher (since that is still bugged out), I get this error on the first checkpoint progress save:

Traceback (most recent call last):
  File "/home/stable/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/home/stable/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 265, in start_training
    trained_steps = main(config)
  File "/home/stable/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 763, in main
    encoder_hidden_states = text_encoder(batch["input_ids"])[0]
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py", line 722, in forward
    return self.text_model(
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py", line 643, in forward
    encoder_outputs = self.encoder(
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py", line 567, in forward
    layer_outputs = torch.utils.checkpoint.checkpoint(
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/utils/checkpoint.py", line 235, in checkpoint
    return CheckpointFunction.apply(function, preserve, *args)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/utils/checkpoint.py", line 96, in forward
    outputs = run_function(*args)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py", line 563, in custom_forward
    return module(*inputs, output_attentions)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py", line 317, in forward
    hidden_states, attn_weights = self.self_attn(
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/stable/stable-diffusion-webui/venv/lib/python3.8/site-packages/transformers/models/clip/modeling_clip.py", line 257, in forward
    attn_output = torch.bmm(attn_probs, value_states)
RuntimeError: expected scalar type Half but found Float

Error when generating a preview image

Traceback (most recent call last):
  File "/notebooks/stable-diffusion-webui/modules/ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "/notebooks/stable-diffusion-webui/webui.py", line 54, in f
    res = func(*args, **kwargs)
  File "/notebooks/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/dreambooth.py", line 256, in start_training
    trained_steps = main(config)
  File "/notebooks/stable-diffusion-webui/extensions/sd_dreambooth_extension/dreambooth/train_dreambooth.py", line 829, in main
    g_cuda = torch.Generator(device=accelerator.device).manual_seed(args.seed)
AttributeError: 'DreamboothConfig' object has no attribute 'seed'

Worked fine before updating to the latest version.

Error no kernel image available on training step 0

Starting Dreambooth training...
 VRAM cleared.
 Allocated: 0.2GB
 Reserved: 0.2GB

 Loaded model.
 Allocated: 0.2GB
 Reserved: 0.2GB


===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link
================================================================================
CUDA SETUP: Loading binary {path}\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda116.dll...
 Scheduler Loaded
 Allocated: 0.5GB
 Reserved: 0.5GB

  Total target lifetime optimization steps = 1000
 CPU: False Adam: True, Prec: no, Prior: False, Grad: True, TextTr: True
 Allocated: 4.2GB
 Reserved: 4.3GB

Steps:   0%|                                                                                  | 0/1000 [00:00<?, ?it/s]Error no kernel image is available for execution on the device at line 167 in file D:\ai\tool\bitsandbytes\csrc\ops.cu
Press any key to continue . . .

I'm using the C drive by the way, and those files don't exist in that D drive directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.