File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ def concat(
85
85
@model_validator (mode = "before" )
86
86
@classmethod
87
87
def _set_dataset_params (cls , params : Dict ) -> Dict :
88
+ if "data_schema" not in params :
89
+ raise ValueError (
90
+ f"Cannot create instance of class '{ cls .class_name } ' without passing `data_schema` parameter."
91
+ )
88
92
data_schema : Union [Schema , MLTypeSchema ] = params ["data_schema" ]
89
93
if isinstance (data_schema , dict ):
90
94
## We need to infer the schema:
Original file line number Diff line number Diff line change 36
36
MLTypeSchema ,
37
37
TaskOrStr ,
38
38
)
39
- from fmcore .framework ._task_mixins import InputOutputDataMixin , SchemaValidationError
40
39
from fmcore .framework ._dataset import Dataset
40
+ from fmcore .framework ._task_mixins import InputOutputDataMixin , SchemaValidationError
41
41
42
42
Predictions = "Predictions"
43
43
Visualization = "Visualization"
@@ -69,6 +69,11 @@ def _pre_registration_hook(cls):
69
69
@model_validator (mode = "before" )
70
70
@classmethod
71
71
def _set_predictions_params (cls , params : Dict ) -> Dict :
72
+ if "data_schema" not in params :
73
+ raise ValueError (
74
+ f"Cannot create instance of class '{ cls .class_name } ' without passing `data_schema` parameter."
75
+ )
76
+
72
77
params ["data_schema" ]: Schema = Schema .of (params ["data_schema" ], schema_template = cls .schema_template )
73
78
# data_schema: Union[Schema, MLTypeSchema] = params['data_schema']
74
79
# if isinstance(data_schema, dict):
You can’t perform that action at this time.
0 commit comments