{"record":{"id":"b3274a82748ff06c","repo":"xai-org/x-algorithm","slug":"unknown-model-type-clip-model-type-choices-s","errorCode":null,"errorMessage":"Unknown model type: {clip_model_type}. Choices: {self.MODELS.keys()}","messagePattern":"Unknown model type: (.+?)\\. Choices: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"clip/model.py","lineNumber":70,"sourceCode":"    }\n\n    MODELS = {**PRETRAINED_MODELS, **TWITTER_MODELS}\n\n    MODEL_NAMES = tuple(MODELS.keys())\n\n    def __init__(\n        self,\n        clip_model_type=DEFAULT_CLIP_MODEL_TYPE,\n        top_feedforward=True,\n        final_embedding_dim=DEFAULT_FINAL_EMBEDDING_DIM,\n        truncate_text=True,\n        logit_scale=None,\n        use_gpu=None,\n    ):\n        self.clip_model_type = clip_model_type\n\n        if clip_model_type not in self.MODELS:\n            raise ValueError(\n                f\"Unknown model type: {clip_model_type}. Choices: {self.MODELS.keys()}\"\n            )\n\n        if clip_model_type in self.PRETRAINED_MODELS:\n            self.base_clip_model_type = clip_model_type\n        else:\n            self.base_clip_model_type = self.TWITTER_MODELS_PRETRAINED_BASE[\n                clip_model_type\n            ]\n\n        io_utils.maybe_download_file(self.PRETRAINED_MODELS[self.base_clip_model_type])\n        self.clip_model, self.torch_preprocess_pretrained = clip.load(\n            self.base_clip_model_type, jit=False\n        )\n\n        self.image_encoder = ImageCLIP(\n            self.clip_model,\n            top_feedforward=top_feedforward,","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/clip/model.py#L52-L88","documentation":"The CLIP wrapper keeps a MODELS dict of supported clip_model_type strings; __init__ validates membership and raises with the list of choices when an unknown type is requested (e.g. a typo or a variant not compiled into this build).","triggerScenarios":"Constructing the model with clip_model_type='RN50x16' when MODELS only has 'RN50','RN101','ViT-B/32', etc.; passing a config value with different casing/spacing; referencing a variant added in a newer commit of the repo.","commonSituations":"Copy-pasted model name from another project; config drift after pulling new code; using a fine-tuned checkpoint name where the base type was expected.","solutions":["Print Model.MODELS.keys() and pass one of those exact strings","Check for casing/spacing mismatches in the configured type","If the type should exist, update to a repo version whose MODELS includes it, or register it in MODELS","Pass the base clip type, not a fine-tuned checkpoint name"],"exampleFix":"# before\nmodel = Model(clip_model_type='VIT-B/32')\n# after\nmodel = Model(clip_model_type='ViT-B/32')","handlingStrategy":"type-guard","validationCode":"from clip.model import Model\nassert clip_model_type in Model.MODELS, f\"choices: {list(Model.MODELS)}\"","typeGuard":"def is_supported_clip_type(t: str) -> bool:\n    return t in Model.MODELS","tryCatchPattern":"try:\n    Model(clip_model_type=t)\nexcept ValueError as e:\n    if 'Unknown model type' in str(e):\n        t = nearest_known(t)  # or fail config validation\n    else:\n        raise","preventionTips":["Validate model type against Model.MODELS at config load","Centralize model-name constants","Fail fast in config parsing rather than at model construction"],"tags":["python","clip","model-type","validation"],"backgroundTag":"unsupported-model-version","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}