From 34be07e0dfb5c3f66854970e65b4d5591242f9ee Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Sun, 24 Nov 2024 14:18:59 -0800 Subject: [PATCH] Ensure model_local_dir does not mangle "C:\" on Windows --- llama_stack/distribution/utils/model_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llama_stack/distribution/utils/model_utils.py b/llama_stack/distribution/utils/model_utils.py index e104965a5..abd0dc087 100644 --- a/llama_stack/distribution/utils/model_utils.py +++ b/llama_stack/distribution/utils/model_utils.py @@ -4,11 +4,10 @@ # This source code is licensed under the terms described in the LICENSE file in # the root directory of this source tree. -import os +from pathlib import Path from .config_dirs import DEFAULT_CHECKPOINT_DIR def model_local_dir(descriptor: str) -> str: - path = os.path.join(DEFAULT_CHECKPOINT_DIR, descriptor) - return path.replace(":", "-") + return str(Path(DEFAULT_CHECKPOINT_DIR) / (descriptor.replace(":", "-")))