Skip to content

Commit

Permalink
hotfix: change error logging for invalid model formats
Browse files Browse the repository at this point in the history
Signed-off-by: Khaled Sulayman <[email protected]>
  • Loading branch information
khaledsulayman committed Nov 14, 2024
1 parent 66b41e0 commit b1bd62d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/instructlab/sdg/utils/chunkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down

0 comments on commit b1bd62d

Please sign in to comment.