efficient-prompt-to-prompt icon indicating copy to clipboard operation
efficient-prompt-to-prompt copied to clipboard

Error loading model from Hugging Face in ddim-inversion.ipynb on Colab

Open euminds opened this issue 1 year ago • 1 comments

I am trying to run ddim-inversion.ipynb on Colab. When load a model from Hugging Face using the diffusers library, it seems an error.

pipe = StableDiffusionPipeline.from_pretrained(path) pipe.scheduler = DDIMScheduler.from_config(path / "scheduler") pipe = pipe.to("cuda")

HFValidationError Traceback (most recent call last) /usr/local/lib/python3.8/dist-packages/diffusers/configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs) 222 # Load from URL or cache if already cached --> 223 config_file = hf_hub_download( 224 pretrained_model_name_or_path,

4 frames /usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, **kwargs) 113 if arg_name == "repo_id": --> 114 validate_repo_id(arg_value) 115

/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_validators.py in validate_repo_id(repo_id) 165 if repo_id.count("/") > 1: --> 166 raise HFValidationError( 167 "Repo id must be in the form 'repo_name' or 'namespace/repo_name':"

HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/root/models/stable-diffusion-v1-4'. Use repo_type argument if needed.

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last) in ----> 1 pipe = StableDiffusionPipeline.from_pretrained(path) 2 pipe.scheduler = DDIMScheduler.from_config(path / "scheduler") 3 pipe = pipe.to("cuda")

/usr/local/lib/python3.8/dist-packages/diffusers/pipeline_utils.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs) 343 # use snapshot download here to get it working from from_pretrained 344 if not os.path.isdir(pretrained_model_name_or_path): --> 345 config_dict = cls.get_config_dict( 346 pretrained_model_name_or_path, 347 cache_dir=cache_dir,

/usr/local/lib/python3.8/dist-packages/diffusers/configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs) 258 ) 259 except ValueError: --> 260 raise EnvironmentError( 261 f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load this model, couldn't find it" 262 f" in the cached files and it looks like {pretrained_model_name_or_path} is not the path to a"

OSError: We couldn't connect to 'https://huggingface.co/' to load this model, couldn't find it in the cached files and it looks like /root/models/stable-diffusion-v1-4 is not the path to a directory containing a model_index.json file. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/diffusers/installation#offline-mode'.

Where path is path = "~/models/stable-diffusion-v1-4" path = Path(path).expanduser()

euminds avatar Mar 02 '23 03:03 euminds

That’s because the path is pointing to my local model. You can change that to your local model or model id on huggingface hub

cccntu avatar Mar 02 '23 03:03 cccntu