|
import argparse |
|
import os |
|
|
|
from datasets import load_dataset, Dataset |
|
from huggingface_hub import HfApi |
|
|
|
TOKEN = os.environ.get("DEBUG") |
|
api = HfApi(token=TOKEN) |
|
|
|
parser = argparse.ArgumentParser() |
|
parser.add_argument( |
|
"--run_dir", |
|
default=None, |
|
type=str, |
|
required=True, |
|
help="Path to the run directory.", |
|
) |
|
parser.add_argument( |
|
"--model_name", |
|
default=None, |
|
type=str, |
|
required=True, |
|
help="Model to benchmark.", |
|
) |
|
|
|
args = parser.parse_args() |
|
|
|
|
|
dataset = load_dataset("AIEnergyScore/requests_debug", split="test", |
|
token=TOKEN).to_pandas() |
|
|
|
|
|
|
|
try: |
|
|
|
with open(f"{args.run_dir}/error.log", 'r') as file: |
|
for f in file.readlines(): |
|
if 'Traceback (most recent call last):' in f: |
|
error_message = f |
|
dataset.loc[dataset["model"].isin([args.model_name]), [ |
|
'status']] = "FAILED" |
|
print("Status set to FAILED") |
|
else: |
|
dataset.loc[dataset["model"].isin([args.model_name]), [ |
|
'status']] = "COMPLETED" |
|
|
|
except FileNotFoundError as e: |
|
print(f"Could not find {args.run_dir}/error.log") |
|
|
|
updated_dataset = Dataset.from_pandas(dataset) |
|
updated_dataset.push_to_hub("AIEnergyScore/requests_debug", split="test", |
|
token=TOKEN) |
|
|