sd_dreambooth_extension icon indicating copy to clipboard operation
sd_dreambooth_extension copied to clipboard

Using xformers, please set mixed precision to 'fp16' or 'bf16' to continue.

Open ZeroCool22 opened this issue 2 years ago • 6 comments

Python revision: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Dreambooth revision: cec6cbcf68c7aa58d85f0c8a6df503e89aaef455
SD-WebUI revision: 685f9631b56ff8bd43bce24ff5ce0f9a0e9af490

Checking Dreambooth requirements...
[+] bitsandbytes version 0.35.0 installed.
[+] diffusers version 0.10.2 installed.
[+] transformers version 4.25.1 installed.
[+] xformers version 0.0.14.dev0 installed.
[+] torch version 1.12.1+cu113 installed.
[+] torchvision version 0.13.1+cu113 installed.
ValueError: invalid literal for int() with base 10: "Using xformers, please set mixed precision to 'fp16' or 'bf16' to continue.<div class='performance'><p class='time'>Time taken: <wbr>0.00s</p><p class='vram'>Torch active/reserved: 2075/2370 MiB, <wb
Using xformers, please set mixed precision to 'fp16' or 'bf16' to continue.
Traceback (most recent call last):
  File "C:\Users\ZeroCool22\Desktop\Auto\venv\lib\site-packages\gradio\routes.py", line 284, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\ZeroCool22\Desktop\Auto\venv\lib\site-packages\gradio\blocks.py", line 982, in process_api
    result = await self.call_function(fn_index, inputs, iterator)
  File "C:\Users\ZeroCool22\Desktop\Auto\venv\lib\site-packages\gradio\blocks.py", line 824, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\ZeroCool22\Desktop\Auto\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\ZeroCool22\Desktop\Auto\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\ZeroCool22\Desktop\Auto\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\ZeroCool22\Desktop\Auto\extensions\sd_dreambooth_extension\dreambooth\db_config.py", line 275, in save_config
    config = DreamboothConfig(*args)
  File "C:\Users\ZeroCool22\Desktop\Auto\extensions\sd_dreambooth_extension\dreambooth\db_config.py", line 169, in __init__
    self.revision = int(revision)
ValueError: invalid literal for int() with base 10: "Using xformers, please set mixed precision to 'fp16' or 'bf16' to continue.<div class='performance'><p class='time'>Time taken: <wbr>0.00s</p><p class='vram'>Torch active/reserved: 2075/2370 MiB, <wb
Using xformers, please set mixed precision to 'fp16' or 'bf16' to continue.

Screenshot_1

No matter what option i choose, always get the same error.

-All updated to the latest version.

-OS: Windows 10 x64. -GPU: 1080 TI.

ZeroCool22 avatar Dec 13 '22 06:12 ZeroCool22

GTX 1080ti here. I have similar problems, but with different settings I get different error messages. It says change in precision detected, please restart webui. But if I restart, it forgets the settings.

If i use CPU only, it finishes without doing anything: Returning result: Training finished. Total lifetime steps: 0 If I use same GPU settings as you, I get error: Exception training model: 'UNet2DConditionModel' object has no attribute 'params'

Traceback (most recent call last): File "D:\stablediffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 356, in start_training config, mem_record, msg = main(config, mem_record, use_subdir=use_subdir, lora_model=lora_model_name, File "D:\stablediffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 600, in main {'params': unet.params() if not args.use_lora else itertools.chain(*unet_lora_params), File "D:\stablediffusion\stable-diffusion-webui\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 'params'

MikkoHaavisto avatar Dec 13 '22 06:12 MikkoHaavisto

GTX 1080ti here. I have similar problems, but with different settings I get different error messages. It says change in precision detected, please restart webui. But if I restart, it forgets the settings.

If i use CPU only, it finishes without doing anything: Returning result: Training finished. Total lifetime steps: 0 If I use same GPU settings as you, I get error: Exception training model: 'UNet2DConditionModel' object has no attribute 'params'

Traceback (most recent call last): File "D:\stablediffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\dreambooth.py", line 356, in start_training config, mem_record, msg = main(config, mem_record, use_subdir=use_subdir, lora_model=lora_model_name, File "D:\stablediffusion\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 600, in main {'params': unet.params() if not args.use_lora else itertools.chain(*unet_lora_params), File "D:\stablediffusion\stable-diffusion-webui\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 'params'

Yeah, i had problems with this Extension since it was created, never could make it work with my GPU, but the (https://github.com/ShivamShrirao/diffusers/tree/main/examples/dreambooth) repo and the GUI: (https://github.com/smy20011/dreambooth-gui) works with no problem, so if you're searching for an alternative with a GUI too, take a look to the last link.

ZeroCool22 avatar Dec 13 '22 15:12 ZeroCool22

The message failing to return on an error should be fixed. Params should be saved before you click "Train", but thanks to Gradio, I don't think that's working as intended. Try clicking the "save params" button before training.

Also, not really helpful for development to say "Hey, this $hit is busted, use this one instead.". Plenty of people have no issues using this...

d8ahazard avatar Dec 13 '22 18:12 d8ahazard

The message failing to return on an error should be fixed. Params should be saved before you click "Train", but thanks to Gradio, I don't think that's working as intended. Try clicking the "save params" button before training.

Also, not really helpful for development to say "Hey, this $hit is busted, use this one instead.". Plenty of people have no issues using this...

Screenshot_10

ZeroCool22 avatar Dec 14 '22 02:12 ZeroCool22

I'd like to say that the extension is amazing and I am really grateful for your great success at making it! I think most of the problems people encounter are due to limited explanations of the settings in a way that non-experts would understand.

Either you fixed something or I got it working. I tried a lot of things, so I don't know what helped.

It finally worked after:

  1. I reinstalled the extension.
  2. I deleted the .yaml file associated with the model I was trying to train.
  3. I added --xformers in the webui-user.bat.
  4. I had LORA, 8bit-adam, fp16, and xformers chosen, but EMA off and CPU only off.
  5. Pressed save params a bunch of times.

MikkoHaavisto avatar Dec 15 '22 10:12 MikkoHaavisto

The message failing to return on an error should be fixed. Params should be saved before you click "Train", but thanks to Gradio, I don't think that's working as intended. Try clicking the "save params" button before training.

Also, not really helpful for development to say "Hey, this $hit is busted, use this one instead.". Plenty of people have no issues using this...

Well, imagine this were the only way to train in DB, all ppl with 1080 TI GPU's will be fucked... So i give him an alternative, so he could train. Your extension had never worked with 1080 TI GPU's, dunno if you don't want or don't know how fix it...

I have been testing your extension since you created it, never worked with 1080 TI.

ZeroCool22 avatar Dec 15 '22 21:12 ZeroCool22

¡Me gustaría decir que la extensión es increíble y estoy muy agradecido por su gran éxito al hacerla! Creo que la mayoría de los problemas que encuentran las personas se deben a explicaciones limitadas de la configuración de una manera que los no expertos podrían entender.

O arreglaste algo o lo hice funcionar. Intenté muchas cosas, así que no sé qué ayudó.

Finalmente funcionó después de:

  1. Reinstalé la extensión.
  2. Eliminé el archivo .yaml asociado con el modelo que estaba tratando de entrenar.
  3. Agregué --xformers en webui-user.bat.
  4. Elegí LORA, 8bit-adam, fp16 y xformers, pero EMA apagado y CPU solo apagado.
  5. Presionado guardar parámetros un montón de veces.

how to i can uninstall Dreamboth?

Alesdanz avatar Dec 19 '22 00:12 Alesdanz

This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Dec 24 '22 00:12 github-actions[bot]

The extension has had a massive update, this should be fixed.

https://github.com/d8ahazard/sd_dreambooth_extension/commit/15244fef18c35864be6f6c2e1c0237dadc5415c1

d8ahazard avatar Jan 01 '23 16:01 d8ahazard

New x-formers provide support for no-floats/float32, so could you please consider removing whole code that prevents it: msg = None if config.attention == "xformers": if config.mixed_precision == "no": msg = "Using xformers, please set mixed precision to 'fp16' or 'bf16' to continue."

from dreambooth/ui_functions.py?

D-Ogi avatar May 25 '23 02:05 D-Ogi