Returns a list of all pretrained models with their available weight tags. This shows which pretrained checkpoints are available for each model architecture.
Signature
def list_pretrained(as_str: bool = False):
...
Parameters
If True, returns list of strings in format 'model_name:tag'. If False, returns list of tuples (model_name, tag).
Returns
List of pretrained model/tag combinations. Format depends on as_str parameter:
- If
as_str=False: List of tuples [(model_name, tag), ...]
- If
as_str=True: List of strings ['model_name:tag', ...]
Example
import open_clip
# Get list as tuples (default)
pretrained = open_clip.list_pretrained()
print(f"Total pretrained combinations: {len(pretrained)}")
print(f"First 5: {pretrained[:5]}")
# Output: [('RN50', 'openai'), ('RN50', 'yfcc15m'), ('RN50', 'cc12m'), ...]
# Get list as strings
pretrained_str = open_clip.list_pretrained(as_str=True)
print(f"First 5 as strings: {pretrained_str[:5]}")
# Output: ['RN50:openai', 'RN50:yfcc15m', 'RN50:cc12m', ...]
# Find all pretrained weights for a specific model
vit_b_32_weights = [tag for model, tag in pretrained if model == 'ViT-B-32']
print(f"ViT-B-32 available weights: {vit_b_32_weights}")
# Output: ['openai', 'laion400m_e31', 'laion400m_e32', 'laion2b_e16', ...]
# Find all models with OpenAI weights
openai_models = [model for model, tag in pretrained if tag == 'openai']
print(f"Models with OpenAI weights: {openai_models}")
# Output: ['RN50', 'RN101', 'RN50x4', 'RN50x16', 'RN50x64', 'ViT-B-32', ...]
# Check if a specific combination exists
if ('ViT-L-14', 'datacomp_xl_s13b_b90k') in pretrained:
print("ViT-L-14 with datacomp_xl_s13b_b90k is available")
- openai: Official OpenAI CLIP weights
- laion400m_e31/e32: Trained on LAION-400M dataset
- laion2b_s34b_b88k: Trained on LAION-2B dataset
- datacomp_xl_s13b_b90k: Trained on DataComp-XL
- metaclip_400m/fullcc: MetaCLIP weights
- dfn2b/dfn5b: Apple DFN weights
- webli: Google SigLIP weights trained on WebLI
Helper Functions
For more targeted queries, consider using:
# Get all pretrained tags for a specific model
tags = open_clip.list_pretrained_tags_by_model('ViT-B-32')
print(f"ViT-B-32 tags: {tags}")
# Get all models with a specific tag
models = open_clip.list_pretrained_models_by_tag('openai')
print(f"Models with OpenAI weights: {models}")
# Check if a specific model/tag combination exists
exists = open_clip.is_pretrained_cfg('ViT-B-32', 'openai')
print(f"ViT-B-32:openai exists: {exists}")
See Also