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

Method probe_data

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

Source from the content-addressed store, hash-verified

128 return log_data, log_label
129 @property
130 def probe_data(self):
131 if not we.debug and self.mode == 'train':
132 batch_data = transfer_data_to_cuda(self.current_batch_data[self.mode])
133 self.eval_mode()
134 with torch.autocast(device_type='cuda',
135 enabled=self.use_amp,
136 dtype=self.dtype):
137 batch_data['log_num'] = self.log_train_num
138 batch_data.update(self.sample_args.get_lowercase_dict())
139 results = self.run_step_eval(batch_data)
140 self.train_mode()
141 log_data, log_label = self.save_results(results)
142 self.register_probe({
143 'train_image':
144 ProbeData(log_data,
145 is_image=True,
146 build_html=True,
147 build_label=log_label)
148 })
149 self.register_probe({'train_label': log_label})
150 if self.probe_prompt:
151 self.eval_mode()
152 all_results = []
153 for prompt in self.probe_prompt:
154 with torch.autocast(device_type='cuda',
155 enabled=self.use_amp,
156 dtype=self.dtype):
157 batch_data = {
158 "prompt": [[prompt]],
159 "image": [torch.zeros(3, self.probe_hw[0], self.probe_hw[1])],
160 "image_mask": [torch.ones(1, self.probe_hw[0], self.probe_hw[1])],
161 "src_image_list": [[]],
162 "modify_image_list": [[]],
163 "src_mask_list": [[]],
164 "edit_id": [[]],
165 "height": self.probe_hw[0],
166 "width": self.probe_hw[1]
167 }
168 batch_data.update(self.sample_args.get_lowercase_dict())
169 results = self.run_step_eval(batch_data)
170 all_results.extend(results)
171 self.train_mode()
172 log_data, log_label = self.save_results(all_results)
173 self.register_probe({
174 'probe_image':
175 ProbeData(log_data,
176 is_image=True,
177 build_html=True,
178 build_label=log_label)
179 })
180
181 return super(LatentDiffusionSolver, self).probe_data

Callers

nothing calls this directly

Calls 1

save_resultsMethod · 0.95

Tested by

no test coverage detected