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

Error using 'restore faces' after 1.8.0-RC #407

Closed
6 tasks
macacafoo opened this issue Mar 3, 2024 · 13 comments
Closed
6 tasks

Error using 'restore faces' after 1.8.0-RC #407

macacafoo opened this issue Mar 3, 2024 · 13 comments
Labels
directml DirectML related or specific issue

Comments

@macacafoo
Copy link

macacafoo commented Mar 3, 2024

Checklist

  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet

What happened?

After update to 1.8.0-RC when enabling 'restore faces' the image is generated but no face correction is applied.

Steps to reproduce the problem

enable 'restore faces'
press generate

What should have happened?

faces a bit better

What browsers do you use to access the UI ?

No response

Sysinfo

.

Console logs

WARNING:modules.face_restoration_utils:Unable to load face-restoration model
Traceback (most recent call last):
  File "C:\Diffusion\stable-diffusion-webui-directml\modules\face_restoration_utils.py", line 150, in restore_with_helper
    self.net = self.load_net()
  File "C:\Diffusion\stable-diffusion-webui-directml\modules\codeformer_model.py", line 37, in load_net
    return modelloader.load_spandrel_model(
  File "C:\Diffusion\stable-diffusion-webui-directml\modules\modelloader.py", line 150, in load_spandrel_model
    model_descriptor = spandrel.ModelLoader(device=device).load_from_file(str(path))
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\spandrel\__helpers\loader.py", line 41, in load_from_file
    state_dict = self.load_state_dict_from_file(path)
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\spandrel\__helpers\loader.py", line 60, in load_state_dict_from_file
    state_dict = self._load_pth(path)
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\spandrel\__helpers\loader.py", line 82, in _load_pth
    return torch.load(
  File "C:\Diffusion\stable-diffusion-webui-directml\modules\safe.py", line 108, in load
    return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
  File "C:\Diffusion\stable-diffusion-webui-directml\modules\safe.py", line 156, in load_with_extra
    return unsafe_torch_load(filename, *args, **kwargs)
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\torch\serialization.py", line 809, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\torch\serialization.py", line 1172, in _load    result = unpickler.load()
  File "C:\Program Files\Python310\lib\pickle.py", line 1213, in load
    dispatch[key[0]](self)
  File "C:\Program Files\Python310\lib\pickle.py", line 1254, in load_binpersid
    self.append(self.persistent_load(pid))
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\torch\serialization.py", line 1142, in persistent_load
    typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\torch\serialization.py", line 1116, in load_tensor
    wrap_storage=restore_location(storage, location),
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\torch\serialization.py", line 1086, in restore_location
    return default_restore_location(storage, str(map_location))
  File "C:\Diffusion\stable-diffusion-webui-directml\venv\lib\site-packages\torch\serialization.py", line 220, in default_restore_location
    raise RuntimeError("don't know how to restore data location of "
RuntimeError: don't know how to restore data location of torch.storage.UntypedStorage (tagged with privateuseone:0)

Additional information

I have already removed the old 'venv'. Same error with CodeFormer and/or GFPGAN. The models are installed in their respective directories.

@lshqqytiger
Copy link
Owner

lshqqytiger commented Mar 4, 2024

Revert to 1.7 or use ZLUDA or SD.Next. microsoft/DirectML#196

@lshqqytiger lshqqytiger added wontfix This will not be worked on bug-directml directml DirectML related or specific issue labels Mar 4, 2024
@macacafoo
Copy link
Author

Hi lshqqytiger, thanks for your reply. I'll revert back to 1.7 as SD.Next is slow than your fork on my aging GCN card.

@macacafoo macacafoo closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
@lshqqytiger lshqqytiger pinned this issue Mar 6, 2024
@Zira3l137
Copy link

Hi lshqqytiger, thanks for your reply. I'll revert back to 1.7 as SD.Next is slow than your fork on my aging GCN card.

Hi, did reverting back to 1.7 help? If yes, could you please tell me how to do that?

@macacafoo
Copy link
Author

Hi Zira3l137, yes, going back to version 1.7 brought back the function of restoring faces. I chose to go back to commit '601f7e3704707d09ca88241e663a763a2493b11a' (fix sysinfo), from February 16, which was the last update I did and everything worked.

The command I used was (without quotes): "git reset --hard 601f7e3"

Keep in mind that any changes made to 'webui-user.bat' will be lost, so I recommend backing up the settings before reverting to 1.7. As a precaution, make a copy of the 'config.json', 'ui-config.json' and 'styles.csv' files as well, even though these weren't modified when reverting, it's better to be on the safe side.

Another, less drastic, option is to use the CPU for functions that use CodeFormer and GFPGAN, by adding the command '--use-cpu gfpgan codeformer' to your 'webui-user.bat'. As my processor is a Ryzen gen1, using CodeFormer (my favorite) on the CPU was very slow, which is why I personally chose to revert to 1.7.

Hope I've helped and good luck with the process.

@Zira3l137
Copy link

Hi Zira3l137, yes, going back to version 1.7 brought back the function of restoring faces. I chose to go back to commit '601f7e3704707d09ca88241e663a763a2493b11a' (fix sysinfo), from February 16, which was the last update I did and everything worked.

The command I used was (without quotes): "git reset --hard 601f7e3"

Keep in mind that any changes made to 'webui-user.bat' will be lost, so I recommend backing up the settings before reverting to 1.7. As a precaution, make a copy of the 'config.json', 'ui-config.json' and 'styles.csv' files as well, even though these weren't modified when reverting, it's better to be on the safe side.

Another, less drastic, option is to use the CPU for functions that use CodeFormer and GFPGAN, by adding the command '--use-cpu gfpgan codeformer' to your 'webui-user.bat'. As my processor is a Ryzen gen1, using CodeFormer (my favorite) on the CPU was very slow, which is why I personally chose to revert to 1.7.

Hope I've helped and good luck with the process.

Thank you so much my friend, you've no idea how much you've helped me! Cheers!

@HyunJae5463
Copy link

HyunJae5463 commented Mar 9, 2024

Hi Zira3l137, yes, going back to version 1.7 brought back the function of restoring faces. I chose to go back to commit '601f7e3704707d09ca88241e663a763a2493b11a' (fix sysinfo), from February 16, which was the last update I did and everything worked.

The command I used was (without quotes): "git reset --hard 601f7e3"

Keep in mind that any changes made to 'webui-user.bat' will be lost, so I recommend backing up the settings before reverting to 1.7. As a precaution, make a copy of the 'config.json', 'ui-config.json' and 'styles.csv' files as well, even though these weren't modified when reverting, it's better to be on the safe side.

Another, less drastic, option is to use the CPU for functions that use CodeFormer and GFPGAN, by adding the command '--use-cpu gfpgan codeformer' to your 'webui-user.bat'. As my processor is a Ryzen gen1, using CodeFormer (my favorite) on the CPU was very slow, which is why I personally chose to revert to 1.7.

Hope I've helped and good luck with the process.

Thanks, the --use-cpu gfpgan codeformer command works great. However, after one generation, Stable Diffusion crashes and it has to be restarted every time. Any idea why this happens? So I can generate one image, the second one just crashes SD without an Error. It only says "Press any key to continue..."

This command also works on ipex, since the same issue exists there, but it also crashes after one generation, when you use Face Swap Extensions at least.

@macacafoo
Copy link
Author

Hi HyunJae5463, I've never come across this type of error. Maybe you can send the ´logs' to a file and get an error message that will give you a clue.

Using '--use-cpu gfpgan codeformer' I couldn't reproduce the error you mentioned. I generated consecutive images with the 'restore faces' function enabled. No errors either with CodeFormer or GFPGAN. All the images had a satisfactory correction. Using the CPU for face correction works fine here in 1.8.0.

I don't use this extension, so I don't know if it would break here too. Perhaps opening an issue with the developers of the 'FaceSwap' extension would help.

@HyunJae5463
Copy link

HyunJae5463 commented Mar 12, 2024

Hi HyunJae5463, I've never come across this type of error. Maybe you can send the ´logs' to a file and get an error message that will give you a clue.

Using '--use-cpu gfpgan codeformer' I couldn't reproduce the error you mentioned. I generated consecutive images with the 'restore faces' function enabled. No errors either with CodeFormer or GFPGAN. All the images had a satisfactory correction. Using the CPU for face correction works fine here in 1.8.0.

I don't use this extension, so I don't know if it would break here too. Perhaps opening an issue with the developers of the 'FaceSwap' extension would help.

Doesn't seem to be extension related. I noticed it even happens when I go to Extras and just enable CodeFormer for example from there.
image
After that I have to restart SD.
The same happens on A1111 fork, but for some reason not on SD.Next.

@macacafoo
Copy link
Author

Sorry HyunJae5463, inconclusive.

@riccorohl
Copy link

How did you revert to 1.7.0?

@lshqqytiger
Copy link
Owner

How did you revert to 1.7.0?

#407 (comment)

@upright2003
Copy link

How did you revert to 1.6.1?

@lshqqytiger lshqqytiger reopened this Apr 17, 2024
lshqqytiger added a commit that referenced this issue Apr 17, 2024
@lshqqytiger
Copy link
Owner

Fixed

@lshqqytiger lshqqytiger removed the wontfix This will not be worked on label Apr 17, 2024
@lshqqytiger lshqqytiger unpinned this issue Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
directml DirectML related or specific issue
Projects
None yet
Development

No branches or pull requests

6 participants