File size: 1,179 Bytes
6c83bf5
 
3cc832b
6c83bf5
3cc832b
6c83bf5
 
 
 
 
 
f46a44a
 
6c83bf5
79fff16
6c83bf5
 
005d6f3
6c83bf5
3cc832b
 
c5729e2
 
 
3cc832b
 
79fff16
 
 
 
 
 
 
 
c5729e2
 
 
 
52bacd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
from datasets import load_dataset, Dataset
from huggingface_hub import HfApi
import pandas as pd

TOKEN = os.environ.get("DEBUG")

api = HfApi(token=TOKEN)

out_dir = sys.argv[1]
all_attempts_read = open("/app/attempts.txt", "r+").readlines()
failed_attempts_read = open("/app/failed_attempts.txt", "r+").readlines()

# Uploading output to the results dataset.
api.upload_folder(
    folder_path=out_dir,
    repo_id="AIEnergyScore/results_debug",
    repo_type="dataset",
)

# Updating requests
requests = load_dataset("AIEnergyScore/requests_debug", split="test",
                        token=TOKEN)
requests_dset = requests.to_pandas()

for line in all_attempts_read:
    experiment_name, model = line.strip().split(',')
    if line not in failed_attempts_read:
        requests_dset.loc[
            requests_dset["model"] == model, ['status']] = "COMPLETED"
    else:
        requests_dset.loc[
            requests_dset["model"] == model, ['status']] = "FAILED"

updated_dset = Dataset.from_pandas(requests_dset)
updated_dset.push_to_hub("AIEnergyScore/requests_debug", split="test",
                         token=TOKEN)
print("Updated model status")