import subprocess import re # Output file output_file = "pass_rate_output_lean.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/mariana/auto-info/generate_result/zero_shot/math_train/generation/lean4_random_5k/2/1/", "/opt/tiger/mariana/auto-info/generate_result/zero_shot/math_train/generation/lean4_random_15k_all/2/1/", "/opt/tiger/mariana/auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_5k/2/1/", "/opt/tiger/mariana/auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_15k_all/2/1/", # "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): pattern = r"zero_shot/(\w+)/(.+?)/(\w+)" match = re.search(pattern, input_string) if match: part1 = match.group(1) part2 = match.group(3) + ".jsonl" result = "/".join([part1, part2]) 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: print(f"Running for input path: {input_path}", file=open(output_file, "a")) command = f"python3 pass_rate_notlean.py --input_path {input_path} --output_path {get_output(input_path)}" subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) print("\n\n",file=open(output_file, "a"))