MCPcopy Index your code
hub / github.com/MoonInTheRiver/DiffSinger / run_evaluation

Method run_evaluation

utils/pl_utils.py:1221–1279  ·  view source on GitHub ↗
(self, test=False)

Source from the content-addressed store, hash-verified

1219 return eval_results
1220
1221 def run_evaluation(self, test=False):
1222 # when testing make sure user defined a test step
1223 model = self.get_model()
1224 model.on_pre_performance_check()
1225
1226 # select dataloaders
1227 if test:
1228 dataloaders = self.get_test_dataloaders()
1229 max_batches = self.num_test_batches
1230 else:
1231 # val
1232 dataloaders = self.get_val_dataloaders()
1233 max_batches = self.num_val_batches
1234
1235 # init validation or test progress bar
1236 # main progress bar will already be closed when testing so initial position is free
1237 position = 2 * self.process_position + (not test)
1238 desc = 'Testing' if test else 'Validating'
1239 pbar = tqdm.tqdm(desc=desc, total=max_batches, leave=test, position=position,
1240 disable=not self.show_progress_bar, dynamic_ncols=True,
1241 unit='batch', file=sys.stdout)
1242 setattr(self, f'{"test" if test else "val"}_progress_bar', pbar)
1243
1244 # run evaluation
1245 eval_results = self.evaluate(self.model,
1246 dataloaders,
1247 max_batches,
1248 test)
1249 if eval_results is not None:
1250 _, prog_bar_metrics, log_metrics, callback_metrics, _ = self.process_output(
1251 eval_results)
1252
1253 # add metrics to prog bar
1254 self.add_tqdm_metrics(prog_bar_metrics)
1255
1256 # log metrics
1257 self.log_metrics(log_metrics, {})
1258
1259 # track metrics for callbacks
1260 self.callback_metrics.update(callback_metrics)
1261
1262 # hook
1263 model.on_post_performance_check()
1264
1265 # add model specific metrics
1266 tqdm_metrics = self.training_tqdm_dict
1267 if not test:
1268 self.main_progress_bar.set_postfix(**tqdm_metrics)
1269
1270 # close progress bar
1271 if test:
1272 self.test_progress_bar.close()
1273 else:
1274 self.val_progress_bar.close()
1275
1276 # model checkpointing
1277 if self.proc_rank == 0 and self.checkpoint_callback is not None and not test:
1278 self.checkpoint_callback.on_epoch_end(epoch=self.current_epoch,

Callers 2

run_pretrain_routineMethod · 0.95
run_training_epochMethod · 0.95

Calls 9

get_modelMethod · 0.95
evaluateMethod · 0.95
process_outputMethod · 0.95
add_tqdm_metricsMethod · 0.95
log_metricsMethod · 0.95
updateMethod · 0.80
on_epoch_endMethod · 0.45

Tested by

no test coverage detected