我想加载一个拥抱脸模型。 我要加载的模型有大约150K的下载量,所以我认为模型本身没有任何问题。
使用下面的两个加载代码我得到相同的错误:
from transformers import AutoModel
AutoModel.from_pretrained("laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup")
还有
from transformers import CLIPProcessor, CLIPModel
model_id = "laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup"
processor = CLIPProcessor.from_pretrained(model_id)
model = CLIPModel.from_pretrained(model_id)
两者我都得到:
OSError: laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup does not appear to have a file named preprocessor_config.json. Checkout 'https://huggingface.co/laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup/main' for available files.
任何加载模型的帮助将不胜感激。
您应该首先使用
open_clip
安装
pip install open_clip_torch
,然后使用以下代码:
import open_clip
model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup')
tokenizer = open_clip.get_tokenizer('hf-hub:laion/CLIP-convnext_large_d_320.laion2B-s29B-b131K-ft-soup')