Download bmodel/check_time.py from ml-resources/FunASR-bmodel: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/ml-resources/FunASR-bmodel/resolve/main/bmodel/check_time.py
- Command line
-
hf download hf://ml-resources/FunASR-bmodel/bmodel/check_time.py
-
curl -L -o check_time.py https://huggingface.co/ml-resources/FunASR-bmodel/resolve/main/bmodel/check_time.py
1.07 kB
| import numpy as np | |
| with open("record_sent.txt","r") as f: | |
| sent = f.readlines() | |
| with open("record_recv.txt","r") as f: | |
| recv = f.readlines() | |
| # sent[id] = time from first sent | |
| sent = np.array([ float(item[5:14]) for item in sent ]) | |
| # recv[i][j] for each j | |
| # j=0 -> 0 for online and 1 for offline | |
| # j=1 -> start id | |
| # j=2 -> end id | |
| # j=3 -> time from first sent | |
| recv = [[int(item[0]), int(item[2:6]), int(item[7:11]), float(item[12:21])] for item in recv] | |
| online_time = [] | |
| offline_time = [] | |
| alltime = [] | |
| for item in recv: | |
| proc_time = item[3] - sent[item[2]] | |
| if item[0] == 1: | |
| # offline | |
| offline_time.append(proc_time) | |
| else: | |
| # online | |
| online_time.append(proc_time) | |
| alltime.append(proc_time) | |
| print("online time avg: "+format(np.mean(online_time),'6.3f')+", std = "+format(np.std(online_time),'6.3f')) | |
| print("offline time avg: "+format(np.mean(offline_time),'6.3f')+", std = "+format(np.std(offline_time),'6.3f')) | |
| print("allline time avg: "+format(np.mean(alltime),'6.3f')+", std = "+format(np.std(alltime),'6.3f')) | |