mlfoundations / open_clip

An open source implementation of CLIP.
Other
9.29k stars 923 forks source link

Model Download fails on Mac, works on Linux #810

Closed thomasf1 closed 5 months ago

thomasf1 commented 5 months ago

The following line downloads the model on Colab / Linux, but fails locally on my Mac which seems odd:

model, _, preprocess = open_clip.create_model_and_transforms('ViT-B-16-SigLIP', pretrained='webli')

with the following exception:

    model, _, preprocess = open_clip.create_model_and_transforms('ViT-B-16-SigLIP', pretrained='webli')
  File "/opt/homebrew/lib/python3.10/site-packages/open_clip/factory.py", line 384, in create_model_and_transforms
    model = create_model(
  File "/opt/homebrew/lib/python3.10/site-packages/open_clip/factory.py", line 250, in create_model
    model = CustomTextCLIP(**model_cfg, cast_dtype=cast_dtype)
  File "/opt/homebrew/lib/python3.10/site-packages/open_clip/model.py", line 336, in __init__
    self.visual = _build_vision_tower(embed_dim, vision_cfg, quick_gelu, cast_dtype)
  File "/opt/homebrew/lib/python3.10/site-packages/open_clip/model.py", line 119, in _build_vision_tower
    visual = TimmModel(
  File "/opt/homebrew/lib/python3.10/site-packages/open_clip/timm_model.py", line 65, in __init__
    self.trunk = timm.create_model(
  File "/opt/homebrew/lib/python3.10/site-packages/timm/models/factory.py", line 67, in create_model
    raise RuntimeError('Unknown model (%s)' % model_name)
RuntimeError: Unknown model (vit_base_patch16_siglip_224)

The line downloading the Tokenizer works fine on both: tokenizer = open_clip.get_tokenizer('ViT-B-16-SigLIP')

Would you have any Pointers on how to fix that?

rwightman commented 5 months ago

@thomasf1 your version of timn is likely too old on mac

thomasf1 commented 5 months ago

Thanks, that did the trick :)

A pointer in the error message or version check would be great as an improvement :)