From 2a7359202c101d0cb460c3367b3e5b023e7bfc23 Mon Sep 17 00:00:00 2001 From: Anton Osika Date: Sat, 17 Jun 2023 14:16:20 +0200 Subject: [PATCH] Script to wipe all files apart from prompts from benchmark --- scripts/clean_benchmarks.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 scripts/clean_benchmarks.py diff --git a/scripts/clean_benchmarks.py b/scripts/clean_benchmarks.py new file mode 100644 index 0000000..21cb536 --- /dev/null +++ b/scripts/clean_benchmarks.py @@ -0,0 +1,38 @@ +# list all folders in benchmark folder +# for each folder, run the benchmark + +import os +import sys +import subprocess +import time +import datetime +import shutil +import argparse +import json +from pathlib import Path +from typer import run +from itertools import islice + +def main( +): + benchmarks = Path('benchmark') + + for benchmark in benchmarks.iterdir(): + if benchmark.is_dir(): + print(f'Cleaning {benchmark}') + for path in benchmark.iterdir(): + if path.name == 'main_prompt': + continue + + # Get filename of Path object + if path.is_dir(): + # delete the entire directory + shutil.rmtree(path) + else: + # delete the file + os.remove(path) + +if __name__ == '__main__': + run(main) + +