File size: 1,749 Bytes
dddc1ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import subprocess
import re

# Output file
output_file = "pass_rate_output.txt"

# Clearing the output file before appending new content
with open(output_file, "w") as file:
    file.write("")

# List of input paths
input_path_lists = [
    "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/mistral-qa-gsm8kmath-autoform-forml4-rft-math/1/10",
    "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/mistral-qa-gsm8kmath-autoform-forml4-rft-math/2/10",
    "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/mistral-qa-gsm8kmath-autoform-forml4-rft-math/3/10",
    # "test/zero_shot/wild_test/generation/lean4_random_15k_all/2/1/",
    # "test/zero_shot/math_train/generation/lean4_random_15k_all/2/1/",
    # "test/zero_shot/gsm8k_train/generation/lean4_random_15k_all/2/1/",
]

def get_output(input_string, k):
    pattern = r"zero_shot/(\w+)/(.+?)/(\w+)/(\w+)"
    match = re.search(pattern, input_string)
    if match:
        part1 = match.group(1)
        part_model = match.group(2) 
        part2 = match.group(3) 
        part3 = match.group(4) +  f"pass{k}.jsonl"
        result = "/".join([part1, part_model, part2, part3])
        print(result)
    else:
        print("No match found.")
        assert True
    return result


# Iterate through the input paths and run the command
for input_path in input_path_lists:
    k = 10
    print(f"Running for input path: {input_path}", file=open(output_file, "a"))
    command = f"python3 pass_rate_notlean_test.py --input_path {input_path} --output_path {get_output(input_path, k)}  --k {k}"
    subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT)
    print("\n\n",file=open(output_file, "a"))