davesalvi commited on
Commit
8feafa5
·
1 Parent(s): bf8acfc

track time

Browse files
Files changed (1) hide show
  1. script.py +8 -7
script.py CHANGED
@@ -96,6 +96,8 @@ print('Loaded Weights')
96
  # del model
97
  # model = Model().to(device)
98
 
 
 
99
  # iterate over the dataset
100
  out = []
101
  for el in tqdm.tqdm(dataset_remote):
@@ -140,13 +142,12 @@ for el in tqdm.tqdm(dataset_remote):
140
  # RUNNING ON HUGGINGFACE
141
  # total_time = time.time() - start_time
142
 
143
- if sr == 16000:
144
- freq_factor = 50
145
- elif sr > 16000:
146
- freq_factor = 70
147
- elif sr < 16000:
148
- freq_factor = 30
149
- total_time = freq_factor
150
  # total_time = 0.0001 + freq_factor
151
 
152
  out.append(dict(id=el["id"], pred=pred, score=score, time=total_time))
 
96
  # del model
97
  # model = Model().to(device)
98
 
99
+ SAMPLING_RATES = [8000, 16000, 22050, 24000, 32000, 44100, 48000, "other"]
100
+
101
  # iterate over the dataset
102
  out = []
103
  for el in tqdm.tqdm(dataset_remote):
 
142
  # RUNNING ON HUGGINGFACE
143
  # total_time = time.time() - start_time
144
 
145
+ if sr in SAMPLING_RATES:
146
+ index = SAMPLING_RATES.index(sr)
147
+ else:
148
+ index = SAMPLING_RATES.index("other")
149
+
150
+ total_time = 1 << index
 
151
  # total_time = 0.0001 + freq_factor
152
 
153
  out.append(dict(id=el["id"], pred=pred, score=score, time=total_time))