Spaces:
Runtime error
Runtime error
meg-huggingface commited on
Commit ·
27979f6
1
Parent(s): 1bc807f
Attempting reading the requests using snapshot_download instead of the datasets package.
Browse files123456789101112131415from datasets import load_datasetrequests_dataset = load_dataset('EnergyStarAI/requests_debug')['test']def normalize_task(task):# Makes assumption about how the task names are being written, and called.return '_'.join(task.split()).lower()for request in requests_dataset:status = request['status']if status == 'PENDING':model = request['model']task = normalize_task(request['task'])print("%s,%s" % (model, task))1234567891011121314151617181920212223import osfrom huggingface_hub import snapshot_downloadimport jsonTOKEN = 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))
parse_requests.py+17-9