(self, inputs: List[T_INPUT], outputs: List[T_OUTPUT], targets: List[T_TARGET], metrics: Dict[str, Any] = None)
| 151 | f.write(json.dumps(save_obj, ensure_ascii=False) + "\n") |
| 152 | |
| 153 | def save_runs_all(self, inputs: List[T_INPUT], outputs: List[T_OUTPUT], targets: List[T_TARGET], metrics: Dict[str, Any] = None): |
| 154 | if not os.path.exists(self.get_output_dir()): |
| 155 | try: os.makedirs(self.get_output_dir()) |
| 156 | except: pass |
| 157 | for idx, (input, output, target) in enumerate(zip(inputs, outputs, targets)): |
| 158 | save_obj = { |
| 159 | "index": idx, |
| 160 | "input": serialize(input), |
| 161 | "output": serialize(output), |
| 162 | "target": serialize(target) |
| 163 | } |
| 164 | with open(os.path.join(self.get_output_dir(), "runs.jsonl"), "a", encoding="utf-8") as f: |
| 165 | f.write(json.dumps(save_obj, ensure_ascii=False) + "\n") |
| 166 | self.save_metrics_all(metrics) |
| 167 | |
| 168 | def save_metrics_all(self, metrics: Dict[str, Any]): |
| 169 | if not os.path.exists(self.get_output_dir()): |
no test coverage detected