From b1bd62dc7e48ad9f7c734d9d47c3088ac95d8309 Mon Sep 17 00:00:00 2001 From: Khaled Sulayman Date: Thu, 14 Nov 2024 14:16:04 -0500 Subject: [PATCH] hotfix: change error logging for invalid model formats Signed-off-by: Khaled Sulayman --- src/instructlab/sdg/utils/chunkers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/instructlab/sdg/utils/chunkers.py b/src/instructlab/sdg/utils/chunkers.py index f03fc779..b1b1d2d7 100644 --- a/src/instructlab/sdg/utils/chunkers.py +++ b/src/instructlab/sdg/utils/chunkers.py @@ -358,7 +358,7 @@ def create_tokenizer(model_name: Optional[str]): model_path = Path(model_name) error_info_message = ( - "Please run ilab model download {download_args} and try again" + "Please run `ilab model download {download_args}` and try again" ) try: if is_model_safetensors(model_path): @@ -377,14 +377,15 @@ def create_tokenizer(model_name: Optional[str]): ) else: - raise ValueError(f"Received path to invalid model format {model_path}") + error_info_message = "Please provide a path to a valid model format. For help on downloading models, run `ilab model download --help`." + raise ValueError() logger.info(f"Successfully loaded tokenizer from: {model_path}") return tokenizer except (OSError, ValueError) as e: logger.error( - f"Failed to load tokenizer as model was not found at {model_path}. {error_info_message}" + f"Failed to load tokenizer as no valid model was not found at {model_path}. {error_info_message}" ) raise e