@@ -356,8 +356,10 @@ def add_model(
356356 raise UnboxValidationError (
357357 "`task_type` must be either TaskType.TabularClassification or TaskType.TextClassification. \n "
358358 )
359- if model_type not in []:
360- pass
359+ if model_type not in [model_framework for model_framework in ModelType ]:
360+ raise UnboxValidationError (
361+ "`model_type` must be one of the supported ModelTypes. Check out our API reference for a full list https://reference.unbox.ai/reference/api/unboxapi.ModelType.html. \n "
362+ )
361363 model_schema = ModelSchema ()
362364 try :
363365 model_schema .load (
@@ -386,14 +388,14 @@ def add_model(
386388 ):
387389 raise UnboxResourceError (
388390 f"The file path `{ requirements_txt_file } ` specified on `requirements_txt_file` does not"
389- " contain a file with the requirements . "
391+ " contain a file with the requirements. \n "
390392 )
391393
392394 # Setup script
393395 if setup_script and not os .path .isfile (os .path .expanduser (setup_script )):
394396 raise UnboxResourceError (
395397 f"The file path `{ setup_script } ` specified on `setup_script` does not"
396- " contain a file with the bash script with commands required before model loading."
398+ " contain a file with the bash script with commands required before model loading. \n "
397399 )
398400
399401 # Dependent dir
@@ -467,7 +469,7 @@ def add_model(
467469 mitigation = "Make sure to specify the additional kwargs needed for the model type." ,
468470 )
469471
470- # ----------------- Resource-schema consistency validations ---------------- #
472+ # ------------------ Resource-schema consistency validations - ---------------- #
471473 # Feature validations
472474 if task_type in [TaskType .TabularClassification , TaskType .TabularRegression ]:
473475 try :
@@ -483,7 +485,7 @@ def add_model(
483485 if feature not in headers
484486 ]
485487 raise UnboxDatasetInconsistencyError (
486- f"The features { features_not_in_dataset } specified as `feature_names` are not on the dataset. \n "
488+ f"The features { features_not_in_dataset } specified in `feature_names` are not on the dataset. \n "
487489 )
488490
489491 required_fields = [
@@ -497,7 +499,6 @@ def add_model(
497499 message = f"TabularClassification task with `{ field } ` missing. \n " ,
498500 mitigation = f"Make sure to specify `{ field } ` for tabular classification tasks." ,
499501 )
500- # --------------------- Subscription plan validations ---------------------- #
501502
502503 with TempDirectory () as dir :
503504 bento_service = create_template_model (
@@ -775,13 +776,13 @@ def add_dataset(
775776 + " preprocessing steps expected by your model." ,
776777 )
777778
778- # ----------------- Resource-schema consistency validations ---------------- #
779+ # ------------------ Resource-schema consistency validations - ---------------- #
779780 # Label column validations
780781 try :
781782 headers .index (label_column_name )
782783 except ValueError :
783784 raise UnboxDatasetInconsistencyError (
784- f"The column { label_column_name } specified as `label_column_name` is not on the dataset. \n "
785+ f"The column ` { label_column_name } ` specified as `label_column_name` is not on the dataset. \n "
785786 )
786787
787788 dataset_classes = list (df [label_column_name ].unique ())
@@ -801,14 +802,14 @@ def add_dataset(
801802 except ValueError :
802803 if text_column_name :
803804 raise UnboxDatasetInconsistencyError (
804- f"The column { text_column_name } specified as `text_column_name` is not on the dataset. \n "
805+ f"The column ` { text_column_name } ` specified as `text_column_name` is not on the dataset. \n "
805806 )
806807 else :
807808 features_not_in_dataset = [
808809 feature for feature in feature_names if feature not in headers
809810 ]
810811 raise UnboxDatasetInconsistencyError (
811- f"The features { features_not_in_dataset } specified as `feature_names` are not on the dataset. \n "
812+ f"The features { features_not_in_dataset } specified in `feature_names` are not on the dataset. \n "
812813 )
813814
814815 # Tag column validation
@@ -820,7 +821,7 @@ def add_dataset(
820821 f"The column `{ tag_column_name } ` specified as `tag_column_name` is not on the dataset. \n "
821822 )
822823
823- # --------------------- Subscription plan validations ---------------------- #
824+ # ----------------------- Subscription plan validations ---------------------- #
824825 if row_count > self .subscription_plan ["datasetSize" ]:
825826 raise UnboxSubscriptionPlanException (
826827 f"The dataset your are trying to upload contains { row_count } rows, which exceeds your plan's"
0 commit comments