focus-data / merge.py
leezythu's picture
Add files using upload-large-folder tool
861f9fc verified
import os
# 定义文件前缀和范围
file_prefix = 'mixed_32k_redstone_part_'
file_suffix = '_streaming_4096_bs_16.jsonl'
start_index = 1
end_index = 19
output_file = 'mixed_32k_redstone_qwen_4096_bs16.jsonl'
with open(output_file, 'w') as outfile:
for i in range(start_index, end_index + 1):
input_file = f'{file_prefix}{i}{file_suffix}'
if os.path.isfile(input_file):
with open(input_file, 'r') as infile:
for line in infile:
outfile.write(line)
else:
print(f'Warning: {input_file} does not exist.')
print(f'All files merged into {output_file}')