stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Embedding select list is empty when trning

Open AugustZTR opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

When I tried training, after creating a new .pt file, I switched to Train tab and wanted to select pt file in drop down list of embeddings. It is empty though I tried the refresh button nearby. An I have checked the folder stable-diffusion-webui-master\embeddings, there did have a pt file that I created before.

Steps to reproduce the problem

  1. Go to the Create embedding tab under Train
  2. Create a new embedding and switch to Train tab
  3. Click the down arrow of embedding selection drop down list

What should have happened?

List all embeddings including the newly created one.

Commit where the problem happens

it shows

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

No response

Additional information, context and logs

No response

AugustZTR avatar Oct 30 '22 07:10 AugustZTR

I've encountered the same problem on my M1 pro. When running ./run_webui_mac.sh, I got the following traceback:

Model loaded.
Error verifying pickled file from /Users/svena33/Documents/GitHub/stable-diffusion-webui/embeddings/my_pet.pt:
Traceback (most recent call last):
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/safe.py", line 97, in load
    check_pt(filename)
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/safe.py", line 81, in check_pt
    unpickler.load()
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/safe.py", line 55, in find_class
    raise pickle.UnpicklingError(f"global '{module}/{name}' is forbidden")
_pickle.UnpicklingError: global 'torch._utils/_rebuild_device_tensor_from_numpy' is forbidden

-----> !!!! The file is most likely corrupted !!!! <-----
You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you.


Error loading emedding my_pet.pt:
Traceback (most recent call last):
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 133, in load_textual_inversion_embeddings
    process_file(fullfn, fn)
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 103, in process_file
    if 'string_to_param' in data:
TypeError: argument of type 'NoneType' is not iterable

Error verifying pickled file from /Users/svena33/Documents/GitHub/stable-diffusion-webui/embeddings/my_pet:
Traceback (most recent call last):
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/safe.py", line 97, in load
    check_pt(filename)
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/safe.py", line 81, in check_pt
    unpickler.load()
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/safe.py", line 55, in find_class
    raise pickle.UnpicklingError(f"global '{module}/{name}' is forbidden")
_pickle.UnpicklingError: global 'torch._utils/_rebuild_device_tensor_from_numpy' is forbidden

-----> !!!! The file is most likely corrupted !!!! <-----
You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you.


Error loading emedding my_pet:
Traceback (most recent call last):
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 133, in load_textual_inversion_embeddings
    process_file(fullfn, fn)
  File "/Users/svena33/Documents/GitHub/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 103, in process_file
    if 'string_to_param' in data:
TypeError: argument of type 'NoneType' is not iterable

Loaded a total of 0 textual inversion embeddings.

From the traceback, I looks like the created (empty) embedding cannot be loaded.

FYI: When I created the empty embedding using my linux machine and copied it to my mac, the embedding could be loaded and training seems works fine.

svena33 avatar Oct 30 '22 09:10 svena33

Hi, Same issue but with a different environement :

  • webui is hosted on a linux machine (dedicated, not a VM)
  • Edge browser on a Windows 11 machine

I tried to create an (empty) embedding file on the windows machine but the auto installer script for windows is broken for me and can't download few dependencies ... (but that's not the main concern here)

However I managed to launch the training by renaming a .pt file from a "working" embedding to make it show up in the list. Had the "indeces should be on the same device" error (corrected with issue #3958 ) and I'm not sure the training will work but yet another thing to consider later !

Ragot-Pierre avatar Nov 01 '22 11:11 Ragot-Pierre

I have the same problem on M1Ultra/128Gb. I can create a hyper network and select it in the Train section, the Embedding shows nothing, even though the file is in the right directory.

TroySeins avatar Nov 07 '22 04:11 TroySeins

It looks like an issue on creating a fresh new embedding. Copy a working *.pt file downloaded elsewhere to embedding folder works.

julianko13 avatar Nov 07 '22 08:11 julianko13

just add --disable-safe-unpickle in the start script at the end of the python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@ line could work around this issue for now...

lenciel avatar Nov 09 '22 09:11 lenciel

That works! Thanks!

AugustZTR avatar Nov 12 '22 11:11 AugustZTR

where is the file I'm gonna edit and change the things you said?

mrfentr avatar Dec 19 '22 11:12 mrfentr

I'm having the same issue , Can someone interpret lenciel's comment so that a noob can understand it? Where do I put that code? Those lines are not in my webui batch file or webui python file in the stable-diffusion-webui folder. .. There is no line of code saying "--precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@" in either of those files to add the --disable-safe-unpickle text to... Am I missing something? I just want to play around with the embedding stuff.

zarklon avatar Dec 24 '22 06:12 zarklon

just add --disable-safe-unpickle in the start script at the end of the python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@ line could work around this issue for now...

can you please name the exact file because i can't find it.

Birukbuilder avatar Jan 03 '23 13:01 Birukbuilder

--disable-safe-unpickle

I was having the same problem. In your stabble-diffusion-webui folder you should have a file called webui-macos-env.sh, open it with any code editor, then add the disable-safe-unpickle command in the command line arguments.

Like this: export COMMANDLINE_ARGS="--skip-torch-cuda-test --disable-safe-unpickle --no-half --use-cpu interrogate"

You should now see your embedding :)

Ozcz avatar Jan 16 '23 16:01 Ozcz