From 144a7ec3a4c7bd98696bfd18609ff5891205bea0 Mon Sep 17 00:00:00 2001 From: brian khuu Date: Sun, 14 Jul 2024 12:12:23 +1000 Subject: [PATCH] convert-*.py: pathlib.Path exist() --> is_file() or is_dir() --- gguf-py/gguf/metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gguf-py/gguf/metadata.py b/gguf-py/gguf/metadata.py index 103e489e2..fc7c1cb9e 100644 --- a/gguf-py/gguf/metadata.py +++ b/gguf-py/gguf/metadata.py @@ -99,7 +99,7 @@ class Metadata: @staticmethod def load_metadata_override(metadata_override_path: Optional[Path] = None) -> dict[str, Any]: - if metadata_override_path is None or not metadata_override_path.exists(): + if metadata_override_path is None or not metadata_override_path.is_file(): return {} with open(metadata_override_path, "r", encoding="utf-8") as f: @@ -125,12 +125,12 @@ class Metadata: @staticmethod def load_hf_parameters(model_path: Optional[Path] = None) -> dict[str, Any]: - if model_path is None or not model_path.exists(): + if model_path is None or not model_path.is_dir(): return {} config_path = model_path / "config.json" - if not config_path.exists(): + if not config_path.is_file(): return {} with open(config_path, "r", encoding="utf-8") as f: