Coder Social home page Coder Social logo

sd_dreambooth_extension's Introduction

Dreambooth Extension for Stable-Diffusion-WebUI

This is a WIP port of Shivam Shriao's Diffusers Repo, which is a modified version of the default Huggingface Diffusers Repo optimized for better performance on lower-VRAM GPUs.

In addition, there are parts borrowed from Koyha SS by BMaltais.

It also adds several other features, including training multiple concepts simultaneously, and (Coming soon) Inpainting training.

Installation

To install, simply go to the "Extensions" tab in the SD Web UI, select the "Available" sub-tab, pick "Load from:" to load the list of extensions, and finally, click "install" next to the Dreambooth entry.

image

Once installed, you must restart the Stable-Diffusion WebUI completely. Reloading the UI will not install the necessary requirements.

We also need a newer version of diffusers, as SD-WebUI uses version 0.3.0, while DB training requires >= 0.10.0. Not having the right diffusers version is the cause of the 'UNet2DConditionModel' object has no attribute ' enable_gradient_checkpointing' error message, as well as safety checker warnings.

IF YOU ARE HAVING ISSUES WITH REQUIREMENTS AFTER INSTALLING, LOOK BELOW

To force sd-web-ui to only install one set of requirements and resolve many issues on install, we can specify the command line argument:

set/export REQS_FILE=.\extensions\sd_dreambooth_extension\requirements.txt

Refer to the appropriate script below for extra flags to install requirements:

https://github.com/d8ahazard/sd_dreambooth_extension/blob/main/webui-user-dreambooth.bat https://github.com/d8ahazard/sd_dreambooth_extension/blob/main/webui-user-dreambooth.sh

And last, if you wish to completely skip the "native" install routine of Dreambooth, you can set the following environment flag: DREAMBOOTH_SKIP_INSTALL=True

This is ideal for "offline mode", where you don't want the script to constantly check things from pypi.

After installing via the WebUI, it is recommended to set the above flags and re-launch the entire Stable-diffusion-webui, not just reload it.

Several Tutorial Videos For Dreambooth

Zero To Hero Stable Diffusion DreamBooth Tutorial By Using Automatic1111 Web UI - Ultra Detailed How to Inject Your Trained Subject e.g. Your Face Into Any Custom Stable Diffusion Model By Web UI 8 GB LoRA Training - Fix CUDA Version For DreamBooth and Textual Inversion Training By Automatic1111 Automatic1111 Stable Diffusion DreamBooth Guide: Optimal Classification Images Count Comparison Test Epic Web UI DreamBooth Update - New Best Settings - 10 Stable Diffusion Training Compared on RunPods How To Install New DREAMBOOTH & Torch 2 On Automatic1111 Web UI PC For Epic Performance Gains Guide

Usage

Create a Model

  1. Go to the Dreambooth tab.

  2. Under the "Create Model" sub-tab, enter a new model name and select the source checkpoint to train from. If you want to use a model from the HF Hub instead, specify the model URL and token. URL format should be ' runwayml/stable-diffusion-v1-5'

    The source checkpoint will be extracted to models\dreambooth\MODELNAME\working.

  3. Click "Create". This will take a minute or two, but when done, the UI should indicate that a new model directory has been set up.

Various Top Buttons

Save Params - Save current training parameters for the current model.

Load Params - Load training parameters from the currently selected model. Use this to copy params from one model to another.

Generate Ckpt - Generate a checkpoint from the currently saved weights at the current revision.

Generate Samples* - Click this while training to generate samples before the next interval.

Cancel - Cancels training after the current step.

Train - Starts training.

Model Section

Model - The model to use. Training parameters will not be automatically loaded to the UI when changing models.

Lora Model - An existing lora checkpoint to load if resuming training, or to merge with the base model if generating a checkpoint.

Half Model - Enable this to save the model using half precision. Results in a smaller checkpoint with little noticeable difference in image output.

Save Checkpoint to Subdirectory - Save the checkpoint to a subdirectory using the model name.

Training Parameters

Performance Wizard (WIP) - Tries to set the optimal training parameters based on the amount of VRAM for your GPU and number of instance images.

Probably not perfect, but at least a good starting point.

Intervals

This section contains parameters related to when things happen during training.

Training Steps Per Image (Epochs) - As the name would imply, an epoch is one training run over the entire set of instance images. So, if we want to train 100 steps per image, we can set this value to 100 and we're ready to go. No math required.

Pause After N Epochs - When set to a value higher than 0, training will pause for the time specified.

Amount of time to pause between Epochs, in Seconds - How long to pause between "N" epochs when N is greater than zero, in seconds.

Use Concepts - Whether to use a JSON file or string with multiple concepts, or the individual settings below.

Save Model/Preview Frequency (Epochs) - The save checkpoint and preview frequencies will be per epoch, not steps.

Batching

Batch size - How many training steps to process simultaneously. You probably want to leave this at 1.

Gradient Accumulation Steps - This should probably be set to the same value as the training batch size.

Class batch size - How many classification images to generate simultaneously. Set this to whatever you can safely process at once using Txt2Image, or just leave it alone.

Set Gradients to None When Zeroing - instead of setting to zero, set the grads to None. This will in general have lower memory footprint, and can modestly improve performance. https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.zero_grad.html

Gradient Checkpointing - Enable this to save VRAM at the cost of a bit of speed. https://arxiv.org/abs/1604.06174v2

Max Grad Norms - The maximum number of gradient normalizati

Learning Rate

This section contains parameters related to the learning rate.

Learning rate - The strength at which training impacts the new model. A higher learning rate requires less training steps, but can cause over-fitting more easily. Recommended between .000006 and .00000175

Scale Learning Rate - Adjusts the learning rate over time.

Learning Rate Scheduler - The scheduler used with the learning rate.

Learning Rate Warmup Steps - How many steps to run before scaling the learning rate. I think.

Image Processing

Here, you'll find settings related to the handling of images.

Resolution - The resolution your instance images are set to. This should probably be 512 or 768. Using a resolution higher than 512 will result in more vram usage.

Center Crop - Enable this to automatically use "dumb cropping" when input images are larger than the specified resolution.

Apply Horizontal Flip - When enabled, instance images will be randomly flipped horizontally during training. This can allow for better editability, but may require a larger number of training steps, as we're effectively increasing our dataset size.

Miscellaneous

Other random stuff that doesn't fit well into any other category.

Pretrained VAE Name or Path - Enter the full path to an existing vae .bin file, and it will be used instead of the VAE from the source checkpoint.

Use Concepts List - Enable this to ignore the concepts tab and load training data from a JSON file instead.

Concepts List - The path to a json file containing the concepts to train.

Advanced Settings

Here you will find more performance-related settings. Changing these will likely impact the amount of VRAM required for training.

Tuning

Use CPU Only - As indicated, this is more of a last resort if you can't get it to train with any other settings. Also, as indicated, it will be abysmally slow. Also, you cannot use 8Bit-Adam with CPU Training, or you'll have a bad time.

Use EMA - Use estimated moving averages when training the unet. Purportedly, this is better for generating images, but seems to have a minimal effect on training results. Uses more VRAM.

Mixed Precision - When using 8bit AdamW, you must set this to fp16 or bf16. Bf16 precision is only supported by newer GPUs, and enabled/disabled by default.

Memory Attention - Type of attention to use. Choices are: 'default': usually fastest, but use most VRAM; 'xformers': slower, uses less VRAM, can only be used with Mixed Precision = 'fp16' (no impact on Apple Silicon); 'flash_attention': slowest, requires lowest VRAM.

Don't Cache Latents - Why is this not just called "cache" latents? Because that's what the original script uses, and I'm trying to maintain the ability to update this as easily as possible. Anyway...when this box is checked latents will not be cached. When latents are not cached, you will save a bit of VRAM, but train slightly slower.

Train Text Encoder - Not required, but recommended. Requires more VRAM, may not work on <12 GB GPUs. Drastically improves output results.

Prior Loss Weight - The weight to use when calculating prior loss. You probably want to leave this at 1.

Center Crop - Crop images if they aren't the right dimensions? I don't use this, and I recommend you just crop your images "right".

Pad Tokens - Pads the text tokens to a longer length for some reason.

Shuffle Tags - Enable this to treat input prompts as a comma-separated list, and to shuffle that list, which can lead to better editability.

Max Token Length - raise the tokenizer's default limit above 75. Requires Pad Tokens for > 75.

AdamW Weight Decay - The weight decay of the AdamW Optimizer used for training. Values closer to 0 closely match your training dataset, and values closer to 1 generalize more and deviate from your training dataset. Default is 1e-2, values lower than 0.1 are recommended.

Concepts

The UI exposes three concepts, which seemed like a reasonable number of items to train on at once.

If you wish to use more than three concepts at once, you can ignore this section entirely, and instead use the "Use Concepts List" option from the Miscellaneous section under the Parameters tab.

You can refer to the Example Concepts List for a sample of the JSON format. You can theoretically use any number of concepts this way.

Concept Parameters

Below is a list of the various parameters that can be used to train a concept.

Maximum Training Steps - The total number of lifetime training steps to train the concept until. Leave at -1 to use the global value.

Dataset Directory - The directory in which the instance images are located.

Classification Dataset Directory The directory in which class images are stored. Leave empty to save to model directory.

Filewords

The below values will be used in conjunction with the [filewords] tag in prompts to append/remove tags. See the 'Using [filewords]' section below for more information.

Instance Token The unique identifier for your subject. (sks, xyz). Leave blank for fine-tuning.

Class Token What your subject is. If a xyz is a person, this could be person/man/woman.

Prompts

Instance Prompt - A prompt used for your instance images. Use [filewords] to insert or combine existing tags with tokens.

Class Prompt - A prompt used for generating and training class images. Use [filewords] to insert or combine existing tags with tokens.

Classification Image Negative Prompt - When generating class images, this is the negative prompt that will be used to guide image generation.

Sample Image Prompt - A prompt used when generating sample images. Use [filewords] to insert or combine existing tags with tokens.

Sample Prompt Template File - An existing txt file used to generate sample images. [filewords] and [names] will be replaced with the instance token.

Sample Image Negative Prompt - When generating sample images, this is the negative prompt that will be used to guide image generation.

Image Generation

Total Number of Class/Reg Images - How many classification images will be generated. Leave at 0 to disable prior preservation.

Classification/Sample CFG Scale - The Classifier Free Guidance scale to use when generating images.

Classification/Sample Steps - The number of steps to use when generating respective images.

Number of Samples to Generate - How many sample images to generate.

Sample Seed - A seed to use for consistent sample generation. Set to -1 to use a random seed.

Using [filewords]

Each concept allows you to use prompts from image filenames or accompanying text files for instance and class images.

To instruct the trainer to use prompts from existing files, use '[filewords]' (no quotes) for the instance/class/sample prompts.

In order to properly insert and remove words from existing prompts, we need to let the trainer know what words indicate what our subject name and class are.

To do this, we specify an instance and class token. If your subject were called 'zxy' and it was a man, then your instance token would be 'zxy', and your class token would be 'man'.

Now, when building your respective prompts, the subject and class can be inserted or removed as necessary.

Debugging

Here's a bunch of random stuff I added that seemed useful, but didn't seem to fit anywhere else.

Preview Prompts - Return a JSON string of the prompts that will be used for training. It's not pretty, but you can tell if things are going to work right.

Generate Sample Image - Generate a sample using the specified seed and prompt below.

Sample Prompt - What the sample should be.

Sample Seed - The seed to use for your sample. Leave at -1 to use a random seed.

Train Imagic Only - Imagic is basically dreambooth, but uses only one image and is significantly faster.

If using Imagic, the first image in the first concept's Instance Data Dir will be used for training.

See here for more details:

https://github.com/ShivamShrirao/diffusers/tree/main/examples/imagic

Continuing Training

Once a model has been trained for any number of steps, a config file is saved which contains all of the parameters from the UI.

If you wish to continue training a model, you can simply select the model name from the dropdown and then click the blue button next to the model name dropdown to load previous parameters.

image

Memory and Optimization

As this is based on ShivamShiaro's repo, it should be able to run under the same GPU constraints, but is not guaranteed.

Please check out the discussions page to find some possible tips and tricks to help you get this running on your setup - or share what you've done to get it working.

Issues

Please be sure to use an issue template when asking for help. Some of the questions may be tedious, but I promise, they'll help me help you faster.

Bug Report

Feature Request

Discord

Credits

Huggingface.co - All the things

CloneOfSimo - LORA

ShivamShrirao - Multiple concepts, optimizations.

Bmalthais - Optimizations, Features

Automatic1111 - Base app

sd_dreambooth_extension's People

Contributors

0xitx avatar anime4000 avatar arrowm avatar ashleykleynhans avatar chrissaunders-wrc avatar crazyboym avatar d8ahazard avatar ekeric13 avatar exponentialml avatar fabbarix avatar furkangozukara avatar gammagoat avatar janca avatar jeryzeng avatar juanumusic avatar koalazak avatar leppie avatar naegles avatar orenwang avatar rossm avatar samomar avatar saunderez avatar schreeedi avatar sgsdxzy avatar sparkle-motion-2 avatar stardust-sjf avatar stdkoehler avatar theflyingpirate avatar thomas-mmj avatar zehongs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sd_dreambooth_extension's Issues

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.

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'.

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

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
图片

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

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.

[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.

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 . . .

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?

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.

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: 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.

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'

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?

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

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.

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]

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.

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.

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?

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

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.

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'

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.

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.

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...

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'

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.

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

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?

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.

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 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'

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.

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

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

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.

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.

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

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?

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

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

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

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.