MCPcopy Create free account
hub / github.com/ali-vilab/ACE_plus / run_test

Method run_test

modules/ace_plus_solver.py:49–77  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

47
48 @torch.no_grad()
49 def run_test(self):
50 self.test_mode()
51 self.before_all_iter(self.hooks_dict[self._mode])
52 all_results = []
53 for batch_idx, batch_data in tqdm(
54 enumerate(self.datas[self._mode].dataloader)):
55 self.before_iter(self.hooks_dict[self._mode])
56 if self.sample_args:
57 batch_data.update(self.sample_args.get_lowercase_dict())
58 with torch.autocast(device_type='cuda',
59 enabled=self.use_amp,
60 dtype=self.dtype):
61 results = self.run_step_eval(transfer_data_to_cuda(batch_data),
62 batch_idx,
63 step=self.total_iter,
64 rank=we.rank)
65 all_results.extend(results)
66 self.after_iter(self.hooks_dict[self._mode])
67 log_data, log_label = self.save_results(all_results)
68 self.register_probe({'test_label': log_label})
69 self.register_probe({
70 'test_image':
71 ProbeData(log_data,
72 is_image=True,
73 build_html=True,
74 build_label=log_label)
75 })
76
77 self.after_all_iter(self.hooks_dict[self._mode])
78
79 def run_step_val(self, batch_data, batch_idx=0, step=None, rank=None):
80 sample_id_list = batch_data['sample_id']

Callers

nothing calls this directly

Calls 2

save_resultsMethod · 0.95
after_iterMethod · 0.45

Tested by

no test coverage detected