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

def process_file(file_index):
    source_file = f"mixed_32k_redstone_part_{file_index}_streaming_4096.jsonl"
    batch_size = 16
    
    command = [
        "python", "preprocess_longtext_streaming_step2.py",
        "--source_file", source_file,
        "--batch_size", str(batch_size)
    ]
    
    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)