| #!/usr/bin/env python3 | |
| # 重组文件 task1_exec.jsonl 的脚本 | |
| import os | |
| from pathlib import Path | |
| def reconstruct_file(): | |
| output_file = "task1_exec.jsonl" | |
| chunk_files = [ | |
| "task1_exec.part000.jsonl", | |
| "task1_exec.part001.jsonl", | |
| "task1_exec.part002.jsonl", | |
| "task1_exec.part003.jsonl", | |
| "task1_exec.part004.jsonl", | |
| ] | |
| print(f"重组文件: {output_file}") | |
| with open(output_file, 'wb') as outfile: | |
| for chunk_file in chunk_files: | |
| if os.path.exists(chunk_file): | |
| print(f"添加分片: {chunk_file}") | |
| with open(chunk_file, 'rb') as infile: | |
| outfile.write(infile.read()) | |
| else: | |
| print(f"警告: 分片文件不存在 {chunk_file}") | |
| print(f"重组完成: {output_file}") | |
| if __name__ == "__main__": | |
| reconstruct_file() | |