File size: 825 Bytes
27979f6
 
 
58b7eaf
27979f6
 
58b7eaf
 
 
 
 
27979f6
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from huggingface_hub import snapshot_download
import json

TOKEN = os.environ.get("DEBUG")
requests_dataset = snapshot_download('EnergyStarAI/requests_debug', token=TOKEN, repo_type="dataset")

def normalize_task(task):
    # Makes assumption about how the task names are being written, and called.
    return '_'.join(task.split()).lower()


for dir, path, files in os.walk(requests_dataset):
    for fid in files:
        if fid.endswith('.json'):
            file_path = os.path.join(dir, fid)
            with open(file_path) as fp:
                request = json.load(fp)
                status = request['status']
                if status == 'PENDING':
                    model = request['model']
                    task = normalize_task(request['task'])
                    print("%s,%s" % (model, task))