[Bugfix] Fix 'NoneType' AttributeError in stable-diffusion model detect (#1254)

Signed-off-by: Yan Ma <yan.ma@intel.com>
This commit is contained in:
Yan Ma authored and GitHub committed 2026-02-10 15:25:08 +08:00
1 parent f73fa1fbe7
commit 9327cccde6
1 file changed
+5 -5
+5 -5
View File
@@ -18,13 +18,13 @@ def _looks_like_bagel(model_name: str) -> bool:
"""Best-effort detection for Bagel (non-diffusers) diffusion models."""
try:
cfg = get_hf_file_to_dict("config.json", model_name)
model_type = cfg.get("model_type")
if model_type == "bagel":
return True
architectures = cfg.get("architectures") or []
return "BagelForConditionalGeneration" in architectures
except Exception:
return False
model_type = cfg.get("model_type")
if model_type == "bagel":
return True
architectures = cfg.get("architectures") or []
return "BagelForConditionalGeneration" in architectures
@lru_cache