|
import subprocess |
|
import re |
|
|
|
|
|
output_file = "pass_rate_output.txt" |
|
|
|
|
|
with open(output_file, "w") as file: |
|
file.write("") |
|
|
|
|
|
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", |
|
|
|
|
|
|
|
] |
|
|
|
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 |
|
|
|
|
|
|
|
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")) |
|
|