mlfoundations / open_clip

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

On mismatch of model input, does not give correct list of valid ones #833

Closed ppbrown closed 4 months ago

ppbrown commented 4 months ago

I gave an invalid pretrained= model name to open_clip.create_model_and_transforms()

This is actually a bug-in-a-bug, because it claims the problem was "model not found", when the ACTUAL problem was that I give a pretrained name that was not in the matching cases for the model type. As you can see, I gave ViT-H-14-quickgelu, which IS a valid model type.

That being said, its list of valid model names printed, is truncated. it stops at ViT-L, when it should also include all the other newer ones like ViT-H, ViT-g, and so on.

    raise RuntimeError(f"Model {name} not found; available models = {list_openai_models()}")
RuntimeError: Model ViT-H-14-quickgelu not found; available models = ['RN50', 'RN50-quickgelu', 'RN101', 'RN101-quickgelu', 'RN50x4', 'RN50x16', 'RN50x64', 'ViT-B-32', 'ViT-B-32-quickgelu', 'ViT-B-16', 'ViT-L-14', 'ViT-L-14-336']
rwightman commented 4 months ago

@ppbrown Did you happen to have openai as a pretrained tag? it's correct if that's the case, 'openai' is a special case that needs to take a different codepath for loading correctly, so it's only reporting the openai models and there is no ViT-H-14-quickgelu in the openai set.