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 ~/.cache/huggingface/transformers/clip-vit-large-patch14 is not the path to a directory containing a config.json file.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.huggingface上的模型下载不下来,使用os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'也无法解决,仍然是同样的错误,推荐在https://www.kaggle.com/datasets/ferruccioliu/openai-clip-vit-large-patch14
https://www.kaggle.com/datasets/ferruccioliu/openai-clip-vit-large-patch14上下载这个模型文件,使用上面的链接下载,也可以使用上面的python程序下载,如下:
import kagglehub
# Download latest version
path = kagglehub.dataset_download("ferruccioliu/openai-clip-vit-large-patch14")
print("Path to dataset files:", path)
这段程序将模型下载到本地,会将本地路径打印下来,方便查找,然后再将文件移动到.cache/huggingface/transformers/clip-vit-large-patch14下面,若是还不行直接暴力将绝对路径添加到上面如:
就可以正常使用了