DreamArtist-sd-webui-extension
DreamArtist-sd-webui-extension copied to clipboard
Training does not work AttributeError: 'NoneType' object has no attribute 'detach
The following error message appears and training cannot be started. Is this due to a misconfiguration? Note: This log is from standalone DreamArtist, but the exact same error was output in Extension.
Training at rate of 0.005 until step 30000
Preparing dataset...
100%|██████████████████████████████████████| 1/1 [00:05<00:00, 5.43s/it]
0%| | 0/30000 [00:01<?, ?it/s]
Error completing request
Arguments: ('emma', '0.005', 1, 'D:\\StableDiffusion\\work\\APT\\emma', 'dream_artist', 512, 512, 30000, 1000, 1000, 'D:\\SDWU\\DreamArtist-stable-diffusion\\textual_inversion_templates\\default.txt', True, True, '', '', 15, 0, 7, -1.0, 512, 512, 5.0, '', True, False, 1, 1) {}
Traceback (most recent call last):
File "D:\SDWU\DreamArtist-stable-diffusion\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "D:\SDWU\DreamArtist-stable-diffusion\webui.py", line 54, in f
res = func(*args, **kwargs)
File "D:\SDWU\DreamArtist-stable-diffusion\modules\dream_artist\ui.py", line 36, in train_embedding
embedding, filename = modules.dream_artist.cptuning.train_embedding(*args)
File "D:\SDWU\DreamArtist-stable-diffusion\modules\dream_artist\cptuning.py", line 436, in train_embedding
f"grad:{embedding.vec.grad.detach().cpu().abs().mean().item():.7f}, "
AttributeError: 'NoneType' object has no attribute 'detach'
I'm getting the same error now unfortunately :(
Some findings if anyone can corroborate. This setup has worked for me.
- Create a DreamArtist embedding with any number of positive and negative vectors.
- DreamArtist train the embedding with a prompt template file that is just "[name]" and for only 1 step (or more haven't tested if it makes any long term difference).
- DreamArtist train the embedding again with a prompt template file that is just "[filewords]" and for n steps.
Note you can include fixed text such as "a drawing of" in step 2 or 3, e.g. "a drawing of [name]"
Otherwise I get either the error described in this issue or in #4, if I:
- Perform steps 2 or 3 out of order
- Use any prompt template file that combines "[name]" and "[filewords]", e.g. "a drawing of [name], [filewords]"
Even though training worked fine for 1 embedding I too am now stuck with this error lmao. Reinstalling the addon did nothing for me.
Steps for replicating the issue on my end at least: 1.Create DreamArtist Embedding 2. Train DreamArtist Embedding 3. Interrupt Training, 4. Create 2nd DreamArtist Embedding, 5. Try to train 2nd DreamArtist Embedding, 6. Congratulation it should crash now.
Edit: It is so broken now that even removing everything and reinstalling does not work anymore. What is even happening.
Some findings if anyone can corroborate. This setup has worked for me.
1. Create a DreamArtist embedding with any number of positive and negative vectors. 2. DreamArtist train the embedding with a prompt template file that is just "[name]" and for only 1 step (or more haven't tested if it makes any long term difference). 3. DreamArtist train the embedding again with a prompt template file that is just "[filewords]" and for n steps.
Note you can include fixed text such as "a drawing of" in step 2 or 3, e.g. "a drawing of [name]"
Otherwise I get either the error described in this issue or in #4, if I:
1. Perform steps 2 or 3 out of order 2. Use any prompt template file that combines "[name]" and "[filewords]", e.g. "a drawing of [name], [filewords]"
This works, but I was able to start initial training with both [filewords] and [name] by just not including a comma in the prompt template. So [filewords] [name] instead of [filewords], [name].
After doing a few more tests, the issue is the shuffling tags option. Disable that and it works fine.
It worked before I completely reinstalled WebUI. Weird
All I can say is that it randomly works or not. xd
I updated to the latest version and set the Prompt template file to style.txt and the training started normally. I also tried a second run with the same settings, which also seems to work fine. If you had the same error as I did, please give it a try.
After all this time, I too have figured out that this error is caused by the template file. As mentioned a few days ago, this error occurs when using only [filewords] and not when using [name] etc. and [filewords] at the same time.
My two remaining questions are.
- why does the error occur when only [filewords] is used?
- why does this issue continue to be ignored by developers?
🤔
After all this time, I too have figured out that this error is caused by the template file. As mentioned a few days ago, this error occurs when using only [filewords] and not when using [name] etc. and [filewords] at the same time.
My two remaining questions are.
- why does the error occur when only [filewords] is used?
- why does this issue continue to be ignored by developers?
🤔
What are you training with [filewords] only? If the descriptions used for training do not have a [name] of the embedding that needs to be learned. It is not training anything.
Only [filewords] was so strange that I supposed I misunderstand the question????
I updated to the latest version and set the Prompt template file to style.txt and the training started normally. I also tried a second run with the same settings, which also seems to work fine. If you had the same error as I did, please give it a try.
yep this worked for me. Thank you for sharing your solution. I switched to style.txt. Clicked train then saw it got passed the error and so I stopped it and now I can use whatever template now and it works.