From d8c65cc771060bbd6188fb5161267daffb7ea512 Mon Sep 17 00:00:00 2001 From: reidliu Date: Fri, 21 Feb 2025 16:51:41 +0800 Subject: [PATCH] fix: convert back to model descriptor for model in list --downloaded Signed-off-by: reidliu --- llama_stack/cli/model/list.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/llama_stack/cli/model/list.py b/llama_stack/cli/model/list.py index 2f62cb9ce..622a6b4e7 100644 --- a/llama_stack/cli/model/list.py +++ b/llama_stack/cli/model/list.py @@ -19,6 +19,13 @@ def _get_model_size(model_dir): return sum(f.stat().st_size for f in Path(model_dir).rglob("*") if f.is_file()) +def _convert_to_model_descriptor(model): + for m in all_registered_models(): + if model == m.descriptor().replace(":", "-"): + return str(m.descriptor()) + return str(model) + + def _run_model_list_downloaded_cmd() -> None: headers = ["Model", "Size", "Modified Time"] @@ -30,7 +37,7 @@ def _run_model_list_downloaded_cmd() -> None: modified_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(os.path.getmtime(abs_path))) rows.append( [ - model, + _convert_to_model_descriptor(model), model_size, modified_time, ]