Skip to content

Commit 71269a7

Browse files
update logging level
1 parent 6b2e4aa commit 71269a7

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

ads/aqua/model/model.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,14 @@ def get_model_files(os_path: str, model_format: ModelFormat) -> List[str]:
985985
config_file_name=AQUA_MODEL_ARTIFACT_CONFIG,
986986
)
987987
except Exception as ex:
988-
logger.warning(str(ex))
988+
message = (
989+
f"The model path {os_path} does not contain the file config.json. "
990+
f"Please check if the path is correct or the model artifacts are available at this location."
991+
)
992+
logger.warning(
993+
f"{message}\n"
994+
f"Details: {ex.reason if isinstance(ex, AquaFileNotFoundError) else str(ex)}\n"
995+
)
989996
else:
990997
model_files.append(AQUA_MODEL_ARTIFACT_CONFIG)
991998

@@ -1208,17 +1215,21 @@ def _validate_safetensor_format(
12081215
config_file_name=AQUA_MODEL_ARTIFACT_CONFIG,
12091216
)
12101217
except Exception as ex:
1211-
logger.error(
1212-
f"Exception occurred while loading config file from {import_model_details.os_path}"
1213-
)
1214-
logger.error(
1215-
ex.reason if isinstance(ex, AquaFileNotFoundError) else str(ex)
1218+
message = (
1219+
f"The model path {import_model_details.os_path} does not contain the file config.json. "
1220+
f"Please check if the path is correct or the model artifacts are available at this location."
12161221
)
12171222
if not import_model_details.ignore_model_artifact_check:
1218-
raise AquaRuntimeError(
1219-
f"The model path {import_model_details.os_path} does not contain the file config.json. "
1220-
f"Please check if the path is correct or the model artifacts are available at this location."
1221-
) from ex
1223+
logger.error(
1224+
f"{message}\n"
1225+
f"Details: {ex.reason if isinstance(ex, AquaFileNotFoundError) else str(ex)}"
1226+
)
1227+
raise AquaRuntimeError(message) from ex
1228+
else:
1229+
logger.warning(
1230+
f"{message}\n"
1231+
f"Proceeding with model registration as ignore_model_artifact_check field is set."
1232+
)
12221233

12231234
if verified_model:
12241235
# model_type validation, log message if metadata field doesn't match.
@@ -1446,7 +1457,6 @@ def register(
14461457
).rstrip("/")
14471458
else:
14481459
artifact_path = import_model_details.os_path.rstrip("/")
1449-
14501460
# Create Model catalog entry with pass by reference
14511461
ds_model = self._create_model_catalog_entry(
14521462
os_path=artifact_path,

0 commit comments

Comments
 (0)