File size: 743 Bytes
861f9fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import multiprocessing
import subprocess

def process_file(file_index):
    source_file = f"../redstone_v4_21_32k_mix_json/mix_splits/mixed_32k_redstone_part_{file_index}.jsonl"
    tokenizer_path = "../Qwen2.5-1.5B"
    max_length = 8192
    
    command = [
        "python", "preprocess_longtext_streaming_step1.py",
        "--source_file", source_file,
        "--tokenizer_path", tokenizer_path,
        "--max_length", str(max_length)
    ]
    
    subprocess.run(command)

def process_in_parallel(num_files=20, num_processes=20):
    with multiprocessing.Pool(processes=num_processes) as pool:
        pool.map(process_file, range(1, num_files + 1))

if __name__ == "__main__":
    process_in_parallel(num_files=19, num_processes=19)