Raise InvalidModelConfigException when unable to detect load class in ModelLoader

This commit is contained in:
Brandon Rising 2024-02-14 13:16:15 -05:00 committed by Brandon Rising
parent 5728da5132
commit 7a36cd2832

View File

@ -169,6 +169,8 @@ class ModelLoader(ModelLoaderBase):
if config.get("model_type", None) == "clip_vision_model": if config.get("model_type", None) == "clip_vision_model":
class_name = config.get("architectures")[0] class_name = config.get("architectures")[0]
return self._hf_definition_to_type(module="transformers", class_name=class_name) return self._hf_definition_to_type(module="transformers", class_name=class_name)
if not class_name:
raise InvalidModelConfigException("Unable to decifer Load Class based on given config.json")
except KeyError as e: except KeyError as e:
raise InvalidModelConfigException("An expected config.json file is missing from this model.") from e raise InvalidModelConfigException("An expected config.json file is missing from this model.") from e