Skip to content

openai/clip-vit-large-patch14 not detected #6321

@alexblattner

Description

@alexblattner

Describe the bug

In my cog environment, for some reason, it refuses to detect the already downloaded clip.

Reproduction

clip_model=CLIPModel.from_pretrained("openai/clip-vit-large-patch14",local_files_only=True,cache_dir="model_cache")
tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14",local_files_only=True,cache_dir="model_cache")
config = AutoConfig.from_pretrained("config.json", local_files_only=True,cache_dir="model_cache")
self.pipe = StableDiffusionPipeline.from_single_file(
            "./poselabs.safetensors",
            load_safety_checker=False,
            cache_dir="model_cache",
            clip_model=clip_model,
            tokenizer=tokenizer,
            safety_checker=None,
            local_files_only=True
)

Logs

Traceback (most recent call last):
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/transformers/utils/hub.py", line 430, in cached_file
resolved_file = hf_hub_download(
^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1362, in hf_hub_download
raise LocalEntryNotFoundError(
huggingface_hub.utils._errors.LocalEntryNotFoundError: Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable hf.co look-ups and downloads online, set 'local_files_only' to False.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py", line 792, in convert_ldm_clip_checkpoint
config = CLIPTextConfig.from_pretrained(config_name, local_files_only=local_files_only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/transformers/models/clip/configuration_clip.py", line 141, in from_pretrained
config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/transformers/configuration_utils.py", line 622, in get_config_dict
config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/transformers/configuration_utils.py", line 677, in _get_config_dict
resolved_config_file = cached_file(
^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/transformers/utils/hub.py", line 470, in cached_file
raise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like openai/clip-vit-large-patch14 is not the path to a directory containing a file named config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/cog/server/worker.py", line 185, in _setup
run_setup(self._predictor)
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/cog/predictor.py", line 66, in run_setup
predictor.setup()
File "/src/predict.py", line 59, in setup
self.pipe = StableDiffusionRubberPipeline.from_single_file(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/diffusers/loaders/single_file.py", line 263, in from_single_file
pipe = download_from_original_stable_diffusion_ckpt(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py", line 1650, in download_from_original_stable_diffusion_ckpt
text_model = convert_ldm_clip_checkpoint(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.7/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py", line 794, in convert_ldm_clip_checkpoint
raise ValueError(
ValueError: With local_files_only set to True, you must first locally save the configuration in the following path: 'openai/clip-vit-large-patch14'.
ⅹ Model setup failed

System Info

  • diffusers version: 0.25.0.dev0
  • Platform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
  • Python version: 3.10.12
  • PyTorch version (GPU?): 2.1.2+cu121 (True)
  • Huggingface_hub version: 0.19.4
  • Transformers version: 4.36.2
  • Accelerate version: 0.25.0
  • xFormers version: not installed
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Who can help?

@yiyixuxu @DN6 @sayakpaul @patrickvonplaten

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleIssues that haven't received updates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions