AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: JSONDecodeError | Failed to create model #8334

Open jeartisteanonyme opened 1 year ago

jeartisteanonyme commented 1 year ago

Is there an existing issue for this?

What happened?

When I press the webui-user batch, I get this error on the cmd This happened at first time, when installation started and it happens every time

Steps to reproduce the problem

  1. Git clone AUTOMATIC1111 repository
  2. Run webui-user.bat

What should have happened?

The programm should start by connecting to the local server

Commit where the problem happens

0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

--medvram

List of extensions

No

Console logs

venv "D:\Stable Diffusion Web UI\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
Installing requirements for Web UI
Launching Web UI with arguments:
No module 'xformers'. Proceeding without it.
Loading weights [c6bbc15e32] from D:\Stable Diffusion Web UI\stable-diffusion-webui\models\Stable-diffusion\sd-v1-5-inpainting.ckpt
Creating model from config: D:\Stable Diffusion Web UI\stable-diffusion-webui\configs\v1-inpainting-inference.yaml
LatentInpaintDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.54 M params.
Failed to create model quickly; will retry using slow method.
LatentInpaintDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.54 M params.
loading stable diffusion model: JSONDecodeError
Traceback (most recent call last):
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\webui.py", line 111, in initialize
    modules.sd_models.load_model()
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\modules\sd_models.py", line 406, in load_model
    sd_model = instantiate_from_config(sd_config.model)
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 79, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1644, in __init__
    super().__init__(concat_keys, *args, **kwargs)
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1509, in __init__
    super().__init__(*args, **kwargs)
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 563, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 630, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 79, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 99, in __init__
    self.tokenizer = CLIPTokenizer.from_pretrained(version)
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1801, in from_pretrained
    return cls._from_pretrained(
  File "D:\Stable Diffusion Web UI\stable-diffusion-webui\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1972, in _from_pretrained
    special_tokens_map = json.load(special_tokens_map_handle)
  File "C:\Users\jeart\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\jeart\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\jeart\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\jeart\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Stable diffusion model failed to load, exiting
Для продолжения нажмите любую клавишу . . .

Additional information

That happened after reinstalling windows. Before reinstall it worked well and nothing happened unless I had faced a conflict with NVIDIA driver. After autoinstallation of NVIDIA driver version 531.18 by NVIDIA GeFroce Experience, my system started to crush every time when Stable Diffusion Web UI was used. Now, With NVIDIA driver 528.49 version, I guess this problem is solved, but suddenly this JSONDecodeError problem appeared and I don't know what am I supposed to do.

ViolentFran commented 1 year ago

I am running on the same issue, "Failed to create model quickly;" followed by "loading stable diffusion model: JSONDecodeError...". I am running windows 10 64bit with a gtx960, 2gb of vram. I had a previous version of the web-ui working on this same system a few months ago. I Tried updating the gpu drivers, cuda, downgrading from python 3.10.7 to 3.10.6, and updating pip... nothing worked so far.

ghost commented 1 year ago

Deleting cache.json and cache.json.lock in the root dir ended up fixing it for me. Was running some code refactoring and it ended up messing up a lot of stuff (all of my embeddings are corrupted yay), and then i was suddenly getting this error.

ViolentFran commented 1 year ago

I tried deleting cache.json already, but it didn't do it for me. I do not have a cache.json.lock file anywhere tough. I am not doing anything funny with the files other than trying suggested fixes. I also re-downloaded it from git multiple times and it's always the same problem.

KeypressHAPPY commented 1 year ago

same problem here to with windows 11

KeypressHAPPY commented 1 year ago

found it, Delete the "huggingface" dir in .cache folder. the relaunch .bat C:\Users\CURRENTUSER\ .cache\huggingface

ViolentFran commented 1 year ago

found it, Delete the "huggingface" dir in .cache folder. the relaunch .bat C:\Users\CURRENTUSER\ .cache\huggingface

This worked for me too! Thank you so much KeypressHAPPY.

Anatoly03 commented 1 year ago

Mac User here, I have a similar error, but a different trace. This happens after trying to run prompts in the browser:

  File "/Users/wein/Documents/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/Users/wein/Documents/stable-diffusion-webui/modules/ui_common.py", line 46, in save_files
    data = json.loads(js_data)
  File "/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python@3.10/3.10.10_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
AndySkaura commented 1 year ago

found it, Delete the "huggingface" dir in .cache folder. the relaunch .bat C:\Users\CURRENTUSER\ .cache\huggingface

TKU!!! I downloaded the model files again and deleted the following directories C:\Users\kura.cache\huggingface and files cache.json in the root directory.

fmd129 commented 8 months ago

KeypressHAPPY's solution fixed my issue as well, I wish I knew what caused it in the first place as it was fairly random, but glad to have it working again. Thanks a ton!