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

[Bug]: TypeError: argument of type 'NoneType' is not iterable

Open suddenlag opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

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

What happened?

(base) jhin@Jonathans-Mac-mini ~ % cd documents (base) jhin@Jonathans-Mac-mini documents % cd stable-diffusion-webui (base) jhin@Jonathans-Mac-mini stable-diffusion-webui % ./run_webui_mac.sh To make your changes take effect please reactivate your environment WARNING: overwriting environment variables set in the machine overwriting variable {'PYTORCH_ENABLE_MPS_FALLBACK'} Collecting torchsde Using cached torchsde-0.2.5-py3-none-any.whl (59 kB) Collecting trampoline>=0.1.2 Using cached trampoline-0.1.2-py3-none-any.whl (5.2 kB) Requirement already satisfied: torch>=1.6.0 in /Users/jhin/opt/anaconda3/envs/web-ui/lib/python3.10/site-packages (from torchsde) (1.12.1) Requirement already satisfied: scipy>=1.5 in /Users/jhin/opt/anaconda3/envs/web-ui/lib/python3.10/site-packages (from torchsde) (1.9.3) Requirement already satisfied: numpy>=1.19.* in /Users/jhin/opt/anaconda3/envs/web-ui/lib/python3.10/site-packages (from torchsde) (1.23.4) Collecting boltons>=20.2.1 Using cached boltons-21.0.0-py2.py3-none-any.whl (193 kB) Requirement already satisfied: typing-extensions in /Users/jhin/opt/anaconda3/envs/web-ui/lib/python3.10/site-packages (from torch>=1.6.0->torchsde) (4.4.0) Installing collected packages: trampoline, boltons, torchsde Successfully installed boltons-21.0.0 torchsde-0.2.5 trampoline-0.1.2 Already up to date. Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels Loading weights [e3b0c442] from /Users/jhin/Documents/stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt Error verifying pickled file from /Users/jhin/Documents/stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt: Traceback (most recent call last): File "/Users/jhin/Documents/stable-diffusion-webui/modules/safe.py", line 83, in check_pt with zipfile.ZipFile(filename) as z: File "/Users/jhin/opt/anaconda3/envs/web-ui/lib/python3.10/zipfile.py", line 1267, in init self._RealGetContents() File "/Users/jhin/opt/anaconda3/envs/web-ui/lib/python3.10/zipfile.py", line 1334, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/jhin/Documents/stable-diffusion-webui/modules/safe.py", line 131, in load_with_extra check_pt(filename, extra_handler) File "/Users/jhin/Documents/stable-diffusion-webui/modules/safe.py", line 98, in check_pt unpickler.load() _pickle.UnpicklingError: invalid load key, 'A'.

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

Traceback (most recent call last): File "/Users/jhin/Documents/stable-diffusion-webui/webui.py", line 202, in webui() File "/Users/jhin/Documents/stable-diffusion-webui/webui.py", line 146, in webui initialize() File "/Users/jhin/Documents/stable-diffusion-webui/webui.py", line 82, in initialize modules.sd_models.load_model() File "/Users/jhin/Documents/stable-diffusion-webui/modules/sd_models.py", line 254, in load_model load_model_weights(sd_model, checkpoint_info) File "/Users/jhin/Documents/stable-diffusion-webui/modules/sd_models.py", line 184, in load_model_weights if "global_step" in pl_sd: TypeError: argument of type 'NoneType' is not iterable (base) jhin@Jonathans-Mac-mini stable-diffusion-webui %

Steps to reproduce the problem

normal process

What should have happened?

...

Commit where the problem happens

...

What platforms do you use to access UI ?

MacOS

What browsers do you use to access the UI ?

Apple Safari

Command Line Arguments

run_webui_mac.sh =

#!/usr/bin/env bash -l

# This should not be needed since it's configured during installation, but might as well have it here.
conda env config vars set PYTORCH_ENABLE_MPS_FALLBACK=1

# Activate conda environment
conda activate web-ui
Pip install torchsde

# Pull the latest changes from the repo
git pull --rebase

# Run the web ui
python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@

# Deactivate conda environment
conda deactivate

Additional information, context and logs

...

suddenlag avatar Nov 13 '22 13:11 suddenlag

If you look towards the first reference of the error: "Error verifying pickled file from /Users/jhin/Documents/stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt"

This probably happened because you did not accept the model term and conditions before generating your token from HuggingFace, therefore the model did not download during the initial setup script.

You should visit https://huggingface.co/CompVis/stable-diffusion-v-1-4-original and accept the terms, as indicated by the original prompt. Then rerun setup_mac.sh so that you are prompted to download the model again. I don't think you need a new token, but if that doesn't work try it one more time with a new token.

mattddoran avatar Nov 14 '22 15:11 mattddoran

如果您查看错误的第一个参考: “Error verifying pickled file from /Users/jhin/Documents/stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt”

这可能是因为您在从 HuggingFace 生成令牌之前没有接受模型条款和条件,因此在初始设置脚本期间没有下载模型。

您应该访问https://huggingface.co/CompVis/stable-diffusion-v-1-4-original并接受条款,如原始提示所示。然后重新运行setup_mac.sh,系统会提示您再次下载模型。我认为您不需要新令牌,但如果这不起作用,请使用新令牌再试一次。

你这有用哦 ,我重新执行setup_mac.sh,然后就把模型下载了,现在可以用了哦。tks

kekekekekeshi avatar Nov 17 '22 09:11 kekekekekeshi