(result_file: Path)
| 31 | |
| 32 | |
| 33 | def load_result(result_file: Path) -> list: |
| 34 | if not result_file.exists(): |
| 35 | os.makedirs(result_file.parent, exist_ok=True) |
| 36 | with open(result_file, "w", encoding="utf-8") as file: |
| 37 | json.dump([], file) |
| 38 | with open(result_file, "r", encoding="utf-8") as file: |
| 39 | return json.load(file) |
| 40 | |
| 41 | |
| 42 | def dataloader(data_list, batch_size, i_batch): |