Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

join() argument must be str, bytes, or os.PathLike object, not 'NoneType' #802

Closed
ricoty opened this issue Jan 19, 2023 · 17 comments · Fixed by #806
Closed

join() argument must be str, bytes, or os.PathLike object, not 'NoneType' #802

ricoty opened this issue Jan 19, 2023 · 17 comments · Fixed by #806
Labels
new Just added, you should probably sort this.

Comments

@ricoty
Copy link

ricoty commented Jan 19, 2023

Kindly read the entire form below and fill it out with the requested information.

Please find the following lines in the console and paste them below. If you do not provide this information, your
issue will be automatically closed.

`

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

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

Have you read the Readme?
yes
Have you completely restarted the stable-diffusion-webUI, not just reloaded the UI?
yes
Have you updated Dreambooth to the latest revision?
yes
Have you updated the Stable-Diffusion-WebUI to the latest version?
yes
No, really. Please save us both some trouble and update the SD-WebUI and Extension and restart before posting this.
Reply 'OK' Below to acknowledge that you did this.

Describe the bug

While Using LoRa the training fails

Provide logs

Traceback (most recent call last):
File "C:\AI\auto1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\dreambooth.py", line 561, in start_training
result = main(config, use_txt2img=use_txt2img)
File "C:\AI\auto1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 973, in main
return inner_loop()
File "C:\AI\auto1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 116, in decorator
return function(batch_size, grad_size, prof, *args, **kwargs)
File "C:\AI\auto1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 294, in inner_loop
unet_lora_params, text_encoder_lora_params = apply_lora_weights(args.lora_model_name, unet, text_encoder,
File "C:\AI\auto1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\lora_diffusion\lora.py", line 150, in apply_lora_weights
lora_path = os.path.join(paths.models_path, "lora", lora_model)
File "C:\Users\wwans\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 143, in join
genericpath._check_arg_types('join', path, *paths)
File "C:\Users\wwans\AppData\Local\Programs\Python\Python310\lib\genericpath.py", line 152, in _check_arg_types
raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
Training completed, reloading SD Model.
Restored system models.
Returning result: Exception training model: 'join() argument must be str, bytes, or os.PathLike object, not 'NoneType''.
Environment

What OS?
Windows native
If Windows - WSL or native?

What GPU are you using?
rtx2060 max-Q
Screenshots/Config
If the issue is specific to an error while training, please provide a screenshot of training parameters or the
db_config.json file from /models/dreambooth/MODELNAME/db_config.json

@ricoty ricoty added the new Just added, you should probably sort this. label Jan 19, 2023
@Tsubashi
Copy link

Tsubashi commented Jan 19, 2023

I had this same error. For me, uninstalling CUDA 11.3 and rebooting did the trick.

@ricoty
Copy link
Author

ricoty commented Jan 19, 2023

I had this same error. For me, uninstalling CUDA 11.3 and rebooting did the trick.

currently running CUDA 12.0 but will give it a go to see if it helps.

Uninstalled still same error.

@art-phony
Copy link

art-phony commented Jan 19, 2023

Same error happens to me. I just uninstall / reinstall CUDA 11.8, but it doesn't works.

FYI:

Initializing Dreambooth
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Dreambooth revision: c2269b8585d994efa31c6582fc19a890253c804e
SD-WebUI revision: b165e341e70300f66c8a77b9383041f4147b24a8

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.13.1+cu117 installed.
[+] torchvision version 0.14.1+cu117 installed.
Starting Dreambooth training...
Initializing dreambooth training...
Replace CrossAttention.forward to use xformers
Instance Bucket 0: Resolution (768, 768), Count: 80
Class Bucket 0: Resolution (768, 768), Count: 332
Target Bucket 0: Resolution (768, 768), Count: 0
We need a total of 0 images.
Nothing to generate.
Traceback (most recent call last):
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\dreambooth.py", line 561, in start_training
    result = main(config, use_txt2img=use_txt2img)
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 973, in main
    return inner_loop()
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 116, in decorator
    return function(batch_size, grad_size, prof, *args, **kwargs)
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 294, in inner_loop
    unet_lora_params, text_encoder_lora_params = apply_lora_weights(args.lora_model_name, unet, text_encoder,
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\lora_diffusion\lora.py", line 150, in apply_lora_weights
    lora_path = os.path.join(paths.models_path, "lora", lora_model)
  File "C:\Users\osuwa\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 143, in join
    genericpath._check_arg_types('join', path, *paths)
  File "C:\Users\osuwa\AppData\Local\Programs\Python\Python310\lib\genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'list'
Training completed, reloading SD Model.
Restored system models.
Returning result: Exception training model: 'join() argument must be str, bytes, or os.PathLike object, not 'list''.

@ricoty
Copy link
Author

ricoty commented Jan 19, 2023

Same error happens to me. I just uninstall / reinstall CUDA 11.8, but it doesn't works.

FYI:

Initializing Dreambooth
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Dreambooth revision: c2269b8585d994efa31c6582fc19a890253c804e
SD-WebUI revision: b165e341e70300f66c8a77b9383041f4147b24a8

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.13.1+cu117 installed.
[+] torchvision version 0.14.1+cu117 installed.
Starting Dreambooth training...
Initializing dreambooth training...
Replace CrossAttention.forward to use xformers
Instance Bucket 0: Resolution (768, 768), Count: 80
Class Bucket 0: Resolution (768, 768), Count: 332
Target Bucket 0: Resolution (768, 768), Count: 0
We need a total of 0 images.
Nothing to generate.
Traceback (most recent call last):
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\scripts\dreambooth.py", line 561, in start_training
    result = main(config, use_txt2img=use_txt2img)
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 973, in main
    return inner_loop()
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 116, in decorator
    return function(batch_size, grad_size, prof, *args, **kwargs)
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 294, in inner_loop
    unet_lora_params, text_encoder_lora_params = apply_lora_weights(args.lora_model_name, unet, text_encoder,
  File "E:\AI_Drawing\automatic1111\stable-diffusion-webui\extensions\sd_dreambooth_extension\lora_diffusion\lora.py", line 150, in apply_lora_weights
    lora_path = os.path.join(paths.models_path, "lora", lora_model)
  File "C:\Users\osuwa\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 143, in join
    genericpath._check_arg_types('join', path, *paths)
  File "C:\Users\osuwa\AppData\Local\Programs\Python\Python310\lib\genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'list'
Training completed, reloading SD Model.
Restored system models.
Returning result: Exception training model: 'join() argument must be str, bytes, or os.PathLike object, not 'list''.

this is a different error, you are experiencing an empty list error instead of nonetype error
"TypeError: join() argument must be str, bytes, or os.PathLike object, not 'list'"
"TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'"

@john-cianfarani
Copy link

Having the exact same error

@nathan-kennedy
Copy link

Just had the same issue. Somehow I didn't have xformers installed. Seems to have resolved itself after relaunching the webui with -xformers

@d8ahazard d8ahazard linked a pull request Jan 20, 2023 that will close this issue
@ddzbs
Copy link

ddzbs commented Jan 20, 2023

Having the exact same error

@john-cianfarani
Copy link

Tried again this morning did a git pull on the ui and the dreambooth extension and I receive the same error.

Dreambooth revision: c2269b8
SD-WebUI revision: e33cace2c2074ef342d027c1f31ffc4b3c3e877e

@Jc7out
Copy link

Jc7out commented Jan 25, 2023

Same error.

@fipil
Copy link

fipil commented Mar 1, 2023

Same error.
Dreambooth rev d4e2f7d

@SoundGuy
Copy link

SoundGuy commented Mar 2, 2023

I'm getting a similar error :

Got scheduler: <class 'diffusers.schedulers.scheduling_deis_multistep.DEISMultistepScheduler'>
Traceback (most recent call last):
File "G:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\ui_functions.py", line 555, in start_training
result = main(use_txt2img=use_txt2img)
File "G:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 1133, in main
return inner_loop()
File "G:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 123, in decorator
return function(batch_size, grad_size, prof, *args, **kwargs)
File "G:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 198, in inner_loop
count, instance_prompts, class_prompts = generate_classifiers(args, use_txt2img=use_txt2img,
File "G:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\utils\gen_utils.py", line 134, in generate_classifiers
builder = ImageBuilder(
File "G:\stable-diffusion-webui\extensions\sd_dreambooth_extension\helpers\image_builder.py", line 126, in init
lora_model_path = os.path.join(shared.models_path, "lora", lora_model)
File "C:\Users\art2\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 143, in join
genericpath._check_arg_types('join', path, *paths)
File "C:\Users\art2\AppData\Local\Programs\Python\Python310\lib\genericpath.py", line 152, in _check_arg_types
raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'list'

@Anonym271
Copy link

I am also getting the 'list' version of this error at the current version (commit 5075d48) when generating class images for lora training:

Generating class images 0/492::   0%|                                                          | 0/492 [00:00<?, ?it/s]Using scheduler: DEISMultistep
Traceback (most recent call last):
  File "F:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\ui_functions.py", line 760, in ui_classifiers
    count, images = generate_classifiers(config, use_txt2img=use_txt2img, ui=True)
  File "F:\stable-diffusion-webui\extensions\sd_dreambooth_extension\dreambooth\utils\gen_utils.py", line 134, in generate_classifiers
    builder = ImageBuilder(
  File "F:\stable-diffusion-webui\extensions\sd_dreambooth_extension\helpers\image_builder.py", line 136, in __init__
    lora_model_path = os.path.join(shared.models_path, "lora", lora_model)
  File "C:\Users\xy\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 117, in join
    genericpath._check_arg_types('join', path, *paths)
  File "C:\Users\xy\AppData\Local\Programs\Python\Python310\lib\genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'list'

@Anonym271
Copy link

I think I found the problem (for the 'list' error): when generating a new model the default value for "lora_model_name" should be an empty string but for some reason it is an empty list. In helpers/image_builder.py, around line 135, this is a problem:

            if config.use_lora and lora_model != "":
                lora_model_path = os.path.join(shared.models_path, "lora", lora_model)

Now if you want to train a lora config.use_lora is True and lora_model is not "" (because it is []) and so it tries to load an existing lora model.

As a workaround I edited my model's db_config.json file (under models/dreambooth/<your_model>) and replaced "lora_model_name": [] with "lora_model_name": "", this fixed the error.

@harrywang
Copy link

This worked for me. Thanks! @Anonym271

@caretaker0815
Copy link

Helped me too. Thanks a lot @Anonym271

@GitHubGuy89
Copy link

For anyone coming here, my lora_model_name was already set to a string in the db_config.json file but I was still having this issue in the newest update that I installed via Automatic1111.

This fixed it for me I think:
cloneofsimo/lora#147 (comment)

Basically I had to redownload from here and then delete everything in my "extensions\sd_dreambooth_extension" folder and then copy the files into it from what I redownloaded manually.

@kc1025
Copy link

kc1025 commented Mar 27, 2023

Thank you for helping me solve the problem.

I think I found the problem (for the 'list' error): when generating a new model the default value for "lora_model_name" should be an empty string but for some reason it is an empty list. In helpers/image_builder.py, around line 135, this is a problem:

            if config.use_lora and lora_model != "":
                lora_model_path = os.path.join(shared.models_path, "lora", lora_model)

Now if you want to train a lora config.use_lora is True and lora_model is not "" (because it is []) and so it tries to load an existing lora model.

As a workaround I edited my model's db_config.json file (under models/dreambooth/<your_model>) and replaced "lora_model_name": [] with "lora_model_name": "", this fixed the error.

Thank you for helping me solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new Just added, you should probably sort this.
Projects
None yet
Development

Successfully merging a pull request may close this issue.