File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -668,17 +668,25 @@ def get_model_by_reference_paths(model_file_description: dict):
668
668
fine_tune_output_path = UNKNOWN
669
669
models = model_file_description ["models" ]
670
670
671
- if models :
672
- if len (models ) > 0 :
673
- base_model_artifact = models [0 ]
674
- base_model_path = f"oci://{ base_model_artifact ['bucketName' ]} @{ base_model_artifact ['namespace' ]} /{ base_model_artifact ['prefix' ]} " .rstrip (
675
- "/"
676
- )
677
- if len (models ) == 2 :
678
- ft_model_artifact = models [1 ]
679
- fine_tune_output_path = f"oci://{ ft_model_artifact ['bucketName' ]} @{ ft_model_artifact ['namespace' ]} /{ ft_model_artifact ['prefix' ]} " .rstrip (
680
- "/"
681
- )
671
+ if not models :
672
+ raise AquaValueError (
673
+ f"Model path is not available in the model json artifact. "
674
+ f"Please check if the model created by reference has the correct artifact."
675
+ )
676
+
677
+ if len (models ) > 0 :
678
+ # since the model_file_description json does not have a flag to identify the base model, we consider
679
+ # the first instance to be the base model.
680
+ base_model_artifact = models [0 ]
681
+ base_model_path = f"oci://{ base_model_artifact ['bucketName' ]} @{ base_model_artifact ['namespace' ]} /{ base_model_artifact ['prefix' ]} " .rstrip (
682
+ "/"
683
+ )
684
+ if len (models ) > 1 :
685
+ # second model is considered as fine-tuned model
686
+ ft_model_artifact = models [1 ]
687
+ fine_tune_output_path = f"oci://{ ft_model_artifact ['bucketName' ]} @{ ft_model_artifact ['namespace' ]} /{ ft_model_artifact ['prefix' ]} " .rstrip (
688
+ "/"
689
+ )
682
690
683
691
return base_model_path , fine_tune_output_path
684
692
You can’t perform that action at this time.
0 commit comments