Skip to content

Commit 8c4738e

Browse files
committed
Adds model file description for the FTed models
1 parent 22ef5e9 commit 8c4738e

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

ads/aqua/model/model.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ def create_multi(
337337
"Please register the model with a file description."
338338
)
339339

340+
# Track model file description in a validated structure
341+
model_file_description_list.append(
342+
ModelFileDescription(**model_file_description)
343+
)
344+
340345
# Ensure base model has a valid artifact
341346
if not source_model.artifact:
342347
logger.error(
@@ -362,11 +367,6 @@ def create_multi(
362367
# Extract model task metadata from source model
363368
self._extract_model_task(model, source_model)
364369

365-
# Track model file description in a validated structure
366-
model_file_description_list.append(
367-
ModelFileDescription(**model_file_description)
368-
)
369-
370370
# Process fine-tuned weights if provided
371371
for ft_model in model.fine_tune_weights or []:
372372
fine_tune_source_model: DataScienceModel = source_models.get(
@@ -381,6 +381,26 @@ def create_multi(
381381
f"Unable to retrieve metadata for fine-tuned model ID: {ft_model.model_id}."
382382
)
383383

384+
# Validate model file description
385+
ft_model_file_description = (
386+
fine_tune_source_model.model_file_description
387+
)
388+
if not ft_model_file_description:
389+
logger.error(
390+
"Model '%s' (%s) has no file description.",
391+
fine_tune_source_model.display_name,
392+
ft_model.model_id,
393+
)
394+
raise AquaValueError(
395+
f"Model '{fine_tune_source_model.display_name}' (ID: {ft_model.model_id}) has no file description. "
396+
"Please register the model with a file description."
397+
)
398+
399+
# Track model file description in a validated structure
400+
model_file_description_list.append(
401+
ModelFileDescription(**ft_model_file_description)
402+
)
403+
384404
# Extract fine-tuned model path
385405
_, fine_tune_path = extract_fine_tune_artifacts_path(
386406
fine_tune_source_model

0 commit comments

Comments
 (0)