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

[Bug]: JSONDecodeError on model load

Open composition-cassidy opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

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

What happened?

I reinstalled the webui on the latest version and it just doesn't want to work. I'm using Windows 11

Steps to reproduce the problem

Loading and trying to generate an image

What should have happened?

shouldve made an image like usual

Version or Commit where the problem happens

v1.5.2

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No

List of extensions

None

Console logs

Startup time: 14.3s (launcher: 6.0s, import torch: 2.4s, import gradio: 1.1s, setup paths: 1.9s, other imports: 1.7s, load scripts: 0.5s, create ui: 0.4s, gradio launch: 0.2s).
DiffusionWrapper has 859.52 M params.
Failed to create model quickly; will retry using slow method.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
loading stable diffusion model: JSONDecodeError
Traceback (most recent call last):
  File "C:\Users\Krasen\AppData\Local\Programs\Python\Python310\lib\threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "C:\Users\Krasen\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\Krasen\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\webui.py", line 318, in load_model
    shared.sd_model  # noqa: B018
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\modules\shared.py", line 754, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\modules\sd_models.py", line 439, in get_sd_model
    load_model()
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\modules\sd_models.py", line 504, in load_model
    sd_model = instantiate_from_config(sd_config.model)
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "C:\Users\Krasen\Desktop\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 "C:\Users\Krasen\Desktop\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 "C:\Users\Krasen\Desktop\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 103, in __init__
    self.tokenizer = CLIPTokenizer.from_pretrained(version)
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1801, in from_pretrained
    return cls._from_pretrained(
  File "C:\Users\Krasen\Desktop\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\Krasen\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\Krasen\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Krasen\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\Krasen\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
Applying attention optimization: xformers... done.
Loading weights [84d76a0328] from C:\Users\Krasen\Desktop\stable-diffusion-webui\models\Stable-diffusion\epicrealism_naturalSinRC1VAE.safetensors
Creating model from config: C:\Users\Krasen\Desktop\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Failed to create model quickly; will retry using slow method.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
loading stable diffusion model: JSONDecodeError
Traceback (most recent call last):
  File "C:\Users\Krasen\AppData\Local\Programs\Python\Python310\lib\threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "C:\Users\Krasen\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\modules\ui.py", line 1515, in <lambda>
    update_image_cfg_scale_visibility = lambda: gr.update(visible=shared.sd_model and shared.sd_model.cond_stage_key == "edit")
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\modules\shared.py", line 754, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\modules\sd_models.py", line 439, in get_sd_model
    load_model()
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\modules\sd_models.py", line 504, in load_model
    sd_model = instantiate_from_config(sd_config.model)
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "C:\Users\Krasen\Desktop\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 "C:\Users\Krasen\Desktop\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 "C:\Users\Krasen\Desktop\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\encoders\modules.py", line 103, in __init__
    self.tokenizer = CLIPTokenizer.from_pretrained(version)
  File "C:\Users\Krasen\Desktop\stable-diffusion-webui\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1801, in from_pretrained
    return cls._from_pretrained(
  File "C:\Users\Krasen\Desktop\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\Krasen\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\Krasen\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Krasen\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\Krasen\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)

Additional information

No response

composition-cassidy avatar Aug 27 '23 09:08 composition-cassidy

I am also seeing this issue

Frozair avatar Sep 22 '23 16:09 Frozair

I ran into this issue and managed to track it down to C:\Users\<username>\.cache\huggingface\hub\models--openai--clip-vit-large-patch14\snapshots\32bd64288804d66eefd0ccbe215aa642df71cc41\special_tokens_map.json being corrupted.

I fixed it by deleting the models--openai--clip-vit-large-patch14 folder and restarting the webui to redownload it.

elseLuna avatar Dec 20 '23 02:12 elseLuna