lean4-compile / pass_rate_multi_notlean_pass.py
rookiemango's picture
Upload folder using huggingface_hub
dddc1ae verified
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"))