Skip to content

Commit

Permalink
update logging level
Browse files Browse the repository at this point in the history
  • Loading branch information
VipulMascarenhas committed Dec 16, 2024
1 parent 6b2e4aa commit 71269a7
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions ads/aqua/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,14 @@ def get_model_files(os_path: str, model_format: ModelFormat) -> List[str]:
config_file_name=AQUA_MODEL_ARTIFACT_CONFIG,
)
except Exception as ex:
logger.warning(str(ex))
message = (
f"The model path {os_path} does not contain the file config.json. "
f"Please check if the path is correct or the model artifacts are available at this location."
)
logger.warning(
f"{message}\n"
f"Details: {ex.reason if isinstance(ex, AquaFileNotFoundError) else str(ex)}\n"
)
else:
model_files.append(AQUA_MODEL_ARTIFACT_CONFIG)

Expand Down Expand Up @@ -1208,17 +1215,21 @@ def _validate_safetensor_format(
config_file_name=AQUA_MODEL_ARTIFACT_CONFIG,
)
except Exception as ex:
logger.error(
f"Exception occurred while loading config file from {import_model_details.os_path}"
)
logger.error(
ex.reason if isinstance(ex, AquaFileNotFoundError) else str(ex)
message = (
f"The model path {import_model_details.os_path} does not contain the file config.json. "
f"Please check if the path is correct or the model artifacts are available at this location."
)
if not import_model_details.ignore_model_artifact_check:
raise AquaRuntimeError(
f"The model path {import_model_details.os_path} does not contain the file config.json. "
f"Please check if the path is correct or the model artifacts are available at this location."
) from ex
logger.error(
f"{message}\n"
f"Details: {ex.reason if isinstance(ex, AquaFileNotFoundError) else str(ex)}"
)
raise AquaRuntimeError(message) from ex
else:
logger.warning(
f"{message}\n"
f"Proceeding with model registration as ignore_model_artifact_check field is set."
)

if verified_model:
# model_type validation, log message if metadata field doesn't match.
Expand Down Expand Up @@ -1446,7 +1457,6 @@ def register(
).rstrip("/")
else:
artifact_path = import_model_details.os_path.rstrip("/")

# Create Model catalog entry with pass by reference
ds_model = self._create_model_catalog_entry(
os_path=artifact_path,
Expand Down

0 comments on commit 71269a7

Please sign in to comment.