@@ -141,6 +141,13 @@ def fit(
141141 context .configure_vector_index (self .vector_index_config )
142142
143143 self .validate_modules (dataset )
144+
145+ test_utterances = context .data_handler .test_utterances ()
146+ if test_utterances is None :
147+ self ._logger .warning (
148+ "Test data is not provided. Final test metrics won't be calculated after pipeline optimization."
149+ )
150+
144151 self ._fit (context , sampler )
145152
146153 if context .is_ram_to_clear ():
@@ -153,15 +160,17 @@ def fit(
153160 self .nodes = {node .node_type : node for node in nodes_list }
154161
155162 if refit_after :
163+ # TODO reflect this refitting in dumped version of pipeline
156164 self ._refit (context )
157165
158- predictions = self .predict (context .data_handler .test_utterances ())
159- for metric_name , metric in DECISION_METRICS .items ():
160- context .optimization_info .pipeline_metrics [metric_name ] = metric (
161- context .data_handler .test_labels (),
162- predictions ,
163- )
164- context .callback_handler .log_final_metrics (context .optimization_info .pipeline_metrics )
166+ if test_utterances is not None :
167+ predictions = self .predict (test_utterances )
168+ for metric_name , metric in DECISION_METRICS .items ():
169+ context .optimization_info .pipeline_metrics [metric_name ] = metric (
170+ context .data_handler .test_labels (),
171+ predictions ,
172+ )
173+ context .callback_handler .log_final_metrics (context .optimization_info .pipeline_metrics )
165174
166175 return context
167176
0 commit comments