File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,17 @@ def resolve_model_config_path(model: str) -> str:
113113 f"Could not determine model_type for diffusers model: { model } . "
114114 f"Please ensure the model has 'model_type' in transformer/config.json or model_index.json"
115115 )
116+ elif file_or_path_exists (model , "config.json" , revision = None ):
117+ # Try to read config.json manually for custom models like Bagel that fail get_config
118+ # but have a valid config.json with model_type
119+ try :
120+ config_dict = get_hf_file_to_dict ("config.json" , model , revision = None )
121+ if config_dict and "model_type" in config_dict :
122+ model_type = config_dict ["model_type" ]
123+ else :
124+ raise ValueError (f"config.json found but missing 'model_type' for model: { model } " )
125+ except Exception as e :
126+ raise ValueError (f"Failed to read config.json for model: { model } . Error: { e } " ) from e
116127 else :
117128 raise ValueError (
118129 f"Could not determine model_type for model: { model } . "
You can’t perform that action at this time.
0 commit comments