track time
Browse files
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
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 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))
|