Fix model detection logic in is_diffusion_model function to ensure config_dict is checked for None before accessing its fields. This improves robustness against missing model_index.json files.
Signed-off-by: Taichang Zhou <tzhouam@connect.ust.hk>
This commit is contained in:
1 parent
f945d2a30d
commit
68bad871bc
1 file changed
+1
-3
@@ -53,10 +53,8 @@ def is_diffusion_model(model_name: str) -> bool:
|
|||||||
|
|
||||||
# Strategy 2: Check using vllm's utility (works for both local and remote models)
|
# Strategy 2: Check using vllm's utility (works for both local and remote models)
|
||||||
try:
|
try:
|
||||||
# Try to get model_index.json using vllm's utility
|
|
||||||
config_dict = get_hf_file_to_dict("model_index.json", model_name)
|
config_dict = get_hf_file_to_dict("model_index.json", model_name)
|
||||||
# Verify it has the required fields for a diffusers model
|
if config_dict is not None and config_dict.get("_class_name") and config_dict.get("_diffusers_version"):
|
||||||
if config_dict.get("_class_name") and config_dict.get("_diffusers_version"):
|
|
||||||
logger.debug("Detected diffusion model via model_index.json")
|
logger.debug("Detected diffusion model via model_index.json")
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in new issue
Block a user