feat: enhance metadata adjustment in CheckpointScanner and ModelScanner for improved model type handling

This commit is contained in:
Will Miao
2025-08-04 17:06:46 +08:00
parent e8a30088ef
commit d8e13de096
2 changed files with 15 additions and 1 deletions

View File

@@ -21,6 +21,14 @@ class CheckpointScanner(ModelScanner):
hash_index=ModelHashIndex()
)
def adjust_metadata(self, metadata, file_path, root_path):
if hasattr(metadata, "model_type"):
if root_path in config.checkpoints_roots:
metadata.model_type = "checkpoint"
elif root_path in config.unet_roots:
metadata.model_type = "diffusion_model"
return metadata
def get_model_roots(self) -> List[str]:
"""Get checkpoint root directories"""
return config.base_models_roots