AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
131.72k stars 25.28k forks source link

[Bug]: #15650

Open AlexysLovesLexxie opened 3 weeks ago

AlexysLovesLexxie commented 3 weeks ago

Checklist

What happened?

Errors when trying to use 4xUltrasharp_4xUltrasharpV10.pt and 4xNMKDSuperscale_4xNMKDSuperscale.pt.

Steps to reproduce the problem

  1. Enter any prompt.
  2. turn on upscaling.
  3. select 4xUltrasharp_4xUltrasharpV10 or 4xNMKDSuperscale_4xNMKDSuperscale from the dropdown menu.
  4. Press "Generate"
  5. watch console output

What should have happened?

Scaler should have loaded and properly executed without error, as per previous versions (I was on 1.7.0 until recently).

What browsers do you use to access the UI ?

Mozilla Firefox, Google Chrome, Brave

Sysinfo

sysinfo-2024-04-28-09-23.json

Console logs

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.9.3
Commit hash: 1c0a0c4c26f78c32095ebc7f8af82f5c04fca8c0
Launching Web UI with arguments: --xformers --api --skip-python-version-check --gradio-allowed-path D:\SM\Data\Images
Loading weights [ce9ee58e2a] from D:\SM\Data\Packages\A1111_193_test\models\Stable-diffusion\animesh_FullV22.safetensors
Creating model from config: D:\SM\Data\Packages\A1111_193_test\configs\v1-inference.yaml
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 11.4s (prepare environment: 2.1s, import torch: 3.5s, import gradio: 0.8s, setup paths: 1.0s, initialize shared: 1.6s, other imports: 0.7s, load scripts: 0.7s, create ui: 0.4s, gradio launch: 0.4s, add APIs: 0.2s).
Applying attention optimization: xformers... done.
Model loaded in 4.3s (load weights from disk: 0.3s, create model: 0.6s, apply weights to model: 2.2s, calculate empty prompt: 0.9s).
100%|██████████| 20/20 [00:04<00:00,  4.54it/s]
*** Unable to load ESRGAN model D:\SM\Data\Packages\A1111_193_test\models\ESRGAN\4xUltrasharp_4xUltrasharpV10.pt
    Traceback (most recent call last):
      File "D:\SM\Data\Packages\A1111_193_test\modules\esrgan_model.py", line 31, in do_upscale
        model = self.load_model(selected_model)
      File "D:\SM\Data\Packages\A1111_193_test\modules\esrgan_model.py", line 49, in load_model
        return modelloader.load_spandrel_model(
      File "D:\SM\Data\Packages\A1111_193_test\modules\modelloader.py", line 150, in load_spandrel_model
        model_descriptor = spandrel.ModelLoader(device=device).load_from_file(str(path))
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\spandrel\__helpers\loader.py", line 41, in load_from_file
        state_dict = self.load_state_dict_from_file(path)
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\spandrel\__helpers\loader.py", line 58, in load_state_dict_from_file
        state_dict = self._load_torchscript(path)
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\spandrel\__helpers\loader.py", line 89, in _load_torchscript
        return torch.jit.load(  # type: ignore
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\torch\jit\_serialization.py", line 162, in load
        cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files, _restore_shapes)  # type: ignore[call-arg]
    RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

---
100%|██████████| 20/20 [00:21<00:00,  1.08s/it]
Total progress: 100%|██████████| 40/40 [00:29<00:00,  1.36it/s]t]
100%|██████████| 20/20 [00:04<00:00,  4.73it/s]
*** Unable to load ESRGAN model D:\SM\Data\Packages\A1111_193_test\models\ESRGAN\4xNMKDSuperscale_4xNMKDSuperscale.pt
    Traceback (most recent call last):
      File "D:\SM\Data\Packages\A1111_193_test\modules\esrgan_model.py", line 31, in do_upscale
        model = self.load_model(selected_model)
      File "D:\SM\Data\Packages\A1111_193_test\modules\esrgan_model.py", line 49, in load_model
        return modelloader.load_spandrel_model(
      File "D:\SM\Data\Packages\A1111_193_test\modules\modelloader.py", line 150, in load_spandrel_model
        model_descriptor = spandrel.ModelLoader(device=device).load_from_file(str(path))
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\spandrel\__helpers\loader.py", line 41, in load_from_file
        state_dict = self.load_state_dict_from_file(path)
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\spandrel\__helpers\loader.py", line 58, in load_state_dict_from_file
        state_dict = self._load_torchscript(path)
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\spandrel\__helpers\loader.py", line 89, in _load_torchscript
        return torch.jit.load(  # type: ignore
      File "D:\SM\Data\Packages\A1111_193_test\venv\lib\site-packages\torch\jit\_serialization.py", line 162, in load
        cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files, _restore_shapes)  # type: ignore[call-arg]
    RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

---
100%|██████████| 20/20 [00:21<00:00,  1.08s/it]
Total progress: 100%|██████████| 40/40 [00:28<00:00,  1.40it/s]t]

Additional information

No response

w-e-w commented 3 weeks ago

@akx any insight

akx commented 3 weeks ago

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Corrupt download, delete and re-download is my best guess.

w-e-w commented 3 weeks ago

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Corrupt download, delete and re-download is my best guess.

maybe you're right I assume that he's using the same known good file because he wrote

Scaler should have loaded and properly executed without error, as per previous versions (I was on 1.7.0 until recently).

I take this as fine 1.7 but in 1.8 when we switch to spandrel it stoped not working not sure now

AlexysLovesLexxie commented 3 weeks ago

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Corrupt download, delete and re-download is my best guess.

I'm sorry, I guess I wasn't 100% clear.

This was tested on not one, but two installs of 1.9.3, done days apart. Logs are taken from a minutes-old, fresh, clean install, which I did in order to satisfy the The issue exists on a clean installation of webui checkbox on my report. The two scaler files in question, 4xUltrasharp_4xUltrasharpV10.pt and 4xNMKDSuperscale_4xNMKDSuperscale.pt were copied directly from my 1.7.0 install, which is functioning correctly.

[EDIT] I do not know why it is even mentioning a zip file in the error log - the .pt files aren't zipped, unless there is something I do not understand about the .pt format?

AlexysLovesLexxie commented 3 weeks ago

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Corrupt download, delete and re-download is my best guess.

maybe you're right I assume that he's using the same known good file because he wrote

Scaler should have loaded and properly executed without error, as per previous versions (I was on 1.7.0 until recently).

I take this as fine 1.7 but in 1.8 when we switch to spandrel it stoped not working not sure now

I skipped from 1.7.0 to 1.9.3 - doing a fresh install, not an update. Then to get the information for this report, I did another fresh, clean install. Copied the previously working .pt files over from my 1.7.0 install.

akx commented 3 weeks ago

Well, just working off the error message: If the .pt files are actually intact .pt files (i.e. zips) you should be able to rename them to e.g. 4xUltrasharp_4xUltrasharpV10.zip and open them with your favorite archiver. Alternately, if you're on an UNIX system, file 4xUltrasharp_4xUltrasharpV10.pt and/or zipinfo -l 4xUltrasharp_4xUltrasharpV10.pt should show you what they actually are.

It's possible our earlier architecture had been happy loading files with the wrong extension.

w-e-w commented 3 weeks ago

Youtube video: File Types That Are Secretly Just .Zip Files In Disguise

w-e-w commented 3 weeks ago

F I think I found the issue try rename the .pt to .pth btw I don't think 4xUltrasharp(ESRGAN) are zip files

AlexysLovesLexxie commented 3 weeks ago

Renaming the ,pt files to .pth worked a treat.

interestingly enough, renaming them to .zip and trying to open them was a no-go, even on re-download. but your fix actually fixed it. I will suggest to the uploaders of these files on CivitAI that they may want to update the file extension, unless you guys plan on changing the code so that they work as they used to?

cheers!

On Sun, Apr 28, 2024 at 8:43 AM w-e-w @.***> wrote:

F I think I found the issue try rename the .pt .pth

— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/15650#issuecomment-2081525082, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6I5UHOTDR5DOYUPKJFDQCTY7UKJPAVCNFSM6AAAAABG42YYAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGUZDKMBYGI . You are receiving this because you authored the thread.Message ID: @.***>