File size: 784 Bytes
27979f6
 
 
58b7eaf
27979f6
f470e32
58b7eaf
 
 
 
 
27979f6
 
 
f470e32
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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", allow_patterns="*.json")

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:
        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))