meg-huggingface commited on
Commit
f470e32
·
1 Parent(s): 8e34882

Removing local .cache directory from snapshot_download

Browse files
Files changed (1) hide show
  1. parse_requests.py +9 -10
parse_requests.py CHANGED
@@ -3,7 +3,7 @@ from huggingface_hub import snapshot_download
3
  import json
4
 
5
  TOKEN = os.environ.get("DEBUG")
6
- requests_dataset = snapshot_download('EnergyStarAI/requests_debug', token=TOKEN, repo_type="dataset")
7
 
8
  def normalize_task(task):
9
  # Makes assumption about how the task names are being written, and called.
@@ -12,12 +12,11 @@ def normalize_task(task):
12
 
13
  for dir, path, files in os.walk(requests_dataset):
14
  for fid in files:
15
- if fid.endswith('.json'):
16
- file_path = os.path.join(dir, fid)
17
- with open(file_path) as fp:
18
- request = json.load(fp)
19
- status = request['status']
20
- if status == 'PENDING':
21
- model = request['model']
22
- task = normalize_task(request['task'])
23
- print("%s,%s" % (model, task))
 
3
  import json
4
 
5
  TOKEN = os.environ.get("DEBUG")
6
+ requests_dataset = snapshot_download('EnergyStarAI/requests_debug', token=TOKEN, repo_type="dataset", allow_patterns="*.json")
7
 
8
  def normalize_task(task):
9
  # Makes assumption about how the task names are being written, and called.
 
12
 
13
  for dir, path, files in os.walk(requests_dataset):
14
  for fid in files:
15
+ file_path = os.path.join(dir, fid)
16
+ with open(file_path) as fp:
17
+ request = json.load(fp)
18
+ status = request['status']
19
+ if status == 'PENDING':
20
+ model = request['model']
21
+ task = normalize_task(request['task'])
22
+ print("%s,%s" % (model, task))