fix(mm): ModelOnDisk skips dirs when looking for weights

Previously a path w/ any of the known weights suffixes would be seen as
a weights file, even if it was a directory. We now check to ensure the
candidate path is actually a file before adding it to the list of
weights.
This commit is contained in:
psychedelicious
2025-10-09 12:02:51 +11:00
parent c873d054b9
commit 255327840b

View File

@@ -45,7 +45,7 @@ class ModelOnDisk:
if self.path.is_file():
return {self.path}
extensions = {".safetensors", ".pt", ".pth", ".ckpt", ".bin", ".gguf"}
return {f for f in self.path.rglob("*") if f.suffix in extensions}
return {f for f in self.path.rglob("*") if f.suffix in extensions and f.is_file()}
def metadata(self, path: Optional[Path] = None) -> dict[str, str]:
path = path or self.path