Not a valid JSON file

Hi - first post here.

I am trying to run the deforum diffusion collab & I’m getting this error when running select & load model

OSError: It looks like the config file at ‘/root/.cache/huggingface/transformers/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142’ is not a valid JSON file.


JSONDecodeError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py in _get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
671 # Load config dict
→ 672 config_dict = cls._dict_from_json_file(resolved_config_file)
673 except (json.JSONDecodeError, UnicodeDecodeError):

14 frames
JSONDecodeError: Expecting property name enclosed in double quotes: line 88 column 3 (char 2317)

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py in _get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
673 except (json.JSONDecodeError, UnicodeDecodeError):
674 raise EnvironmentError(
→ 675 f"It looks like the config file at ‘{resolved_config_file}’ is not a valid JSON file."
676 )
677

OSError: It looks like the config file at ‘/root/.cache/huggingface/transformers/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142’ is not a valid JSON file.

Hi I got exactly the same error, except I installed under my user’s home directory so the .cache directory is under there. The cache filename is exactly the same as yours lol

FYI. I’ve installed SD on fedora linux and am running:

python scripts/txt2img.py --prompt "a fish wearing a hat" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1

This is the full error:

~/Developer/stable-diffusion/ python scripts/txt2img.py --prompt "small man with a big hat wearing pyjamas" --plms --ckpt sd-v1-4-full-ema.ckpt  --skip_grid --n_samples 1
Global seed set to 42
Loading model from sd-v1-4-full-ema.ckpt
Global Step: 470000
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
Traceback (most recent call last):
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/site-packages/transformers/configuration_utils.py", line 650, in _get_config_dict
    config_dict = cls._dict_from_json_file(resolved_config_file)
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/site-packages/transformers/configuration_utils.py", line 734, in _dict_from_json_file
    return json.loads(text)
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 88 column 3 (char 2317)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "scripts/txt2img.py", line 344, in <module>
    main()
  File "scripts/txt2img.py", line 240, in main
    model = load_model_from_config(config, f"{opt.ckpt}")
  File "scripts/txt2img.py", line 54, in load_model_from_config
    model = instantiate_from_config(config.model)
  File "/home/sunny/Developer/stable-diffusion/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/home/sunny/Developer/stable-diffusion/ldm/models/diffusion/ddpm.py", line 461, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "/home/sunny/Developer/stable-diffusion/ldm/models/diffusion/ddpm.py", line 519, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "/home/sunny/Developer/stable-diffusion/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/home/sunny/Developer/stable-diffusion/ldm/modules/encoders/modules.py", line 142, in __init__
    self.transformer = CLIPTextModel.from_pretrained(version)
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/site-packages/transformers/modeling_utils.py", line 1764, in from_pretrained
    config, model_kwargs = cls.config_class.from_pretrained(
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/site-packages/transformers/models/clip/configuration_clip.py", line 126, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/site-packages/transformers/configuration_utils.py", line 553, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/sunny/.conda/envs/ldm/lib/python3.8/site-packages/transformers/configuration_utils.py", line 652, in _get_config_dict
    raise EnvironmentError(
OSError: It looks like the config file at '/home/sunny/.cache/huggingface/transformers/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142' is not a valid JSON file.

Same issue here: was just fine a few hours ago and now I am unable to load SD model in 2 different colab environments.

Should be fixed now!

2 Likes

image

Screen Shot 2022-09-09 at 3.29.02 PM