Skip to content

Commit 932db1e

Browse files
committed
add more plots
1 parent 0863ad9 commit 932db1e

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,4 @@ benchmark_configs.txt
149149
Dockerfile
150150
normal_large_wer/
151151
*_large*/
152+
benchmark_configs_gpu.txt

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ torchaudio
33
librosa
44
soundfile
55
faster-whisper
6+
tqdm
7+
py3nvml
8+
psutil

sumup.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def get_values(row, key='segment_latency', mode='max'):
103103

104104
def plot(data, wer=False):
105105
if wer:
106+
print("Plotting WER")
106107
plot_param(data, title="WER streaming vs offline", ylabel="WER", key='wer_score', output_path='plots/wer/', hardware="koios", device="gpu", vad="VAD",method="beam-search", condition_on_previous_text="NoCondition", data_type="speech", model_size="large-v3", offline=None, compute_type="best")
107108
plot_param(data, title="WER model size", ylabel="WER", key='wer_score', output_path='plots/wer/', hardware="koios", device="gpu", vad="VAD",method="beam-search", condition_on_previous_text="NoCondition", data_type="speech", model_size=None, offline="streaming", compute_type="best")
108109
plot_param(data, title="WER depending on precision on 1080TI (GPU) for faster-whisper", ylabel="WER", key='wer_score', output_path='plots/wer/faster', hardware="koios", device="gpu", backend="faster", method="greedy", vad='NoVAD', condition_on_previous_text="NoCondition", data_type="speech", compute_type=None)
@@ -111,10 +112,13 @@ def plot(data, wer=False):
111112
plot_param(data, title="WER depending on method with VAD on 1080TI (GPU)", ylabel="WER", key='wer_score', output_path='plots/wer/', hardware="koios", device="gpu", backend=None, method=None, vad='VAD', condition_on_previous_text="NoCondition", data_type="speech", compute_type="best")
112113
plot_param(data, title="WER depending on VAD on 1080TI (GPU)", ylabel="WER", key='wer_score', output_path='plots/wer/', hardware="koios", device="gpu", backend=None, method="greedy", vad=None, condition_on_previous_text="NoCondition", data_type="speech", compute_type="best")
113114
plot_param(data, title="WER depending on Previous text on 1080TI (GPU)", ylabel="WER", key='wer_score', output_path='plots/wer/', hardware="koios", device="gpu", backend=None, method="greedy", vad="VAD", condition_on_previous_text=None, data_type="speech", compute_type="best")
115+
plot_param(data, title="WER model", ylabel="WER", key='wer_score', output_path='plots/wer/', hardware="koios", device="gpu", vad="NoVAD",method="greedy", condition_on_previous_text="NoCondition", data_type="speech", model_size=None, offline="offline", compute_type="best")
116+
114117

115118

116119

117-
else:
120+
else:
121+
print("Plotting latencies")
118122
data_gpu = search_rows_by_key(data, 'device', 'gpu')
119123
# plot_processting_times_per_params(data_gpu, "GPU processing times", output_path='plots/gpu')
120124

@@ -132,8 +136,9 @@ def plot(data, wer=False):
132136
plot_param(data_gpu, title="Latency depending on VAD on 1080TI (GPU) for whisper-timestamped", key='segment_latency',output_path='plots/gpu/koios/timestamped', hardware="koios", device="gpu", compute_type="float32",backend="timestamped", method="greedy", vad=None, condition_on_previous_text="NoCondition", data_type="speech")
133137
plot_param(data_gpu, title="Latency depending on VAD for silence data on 1080TI (GPU) for whisper-timestamped", key='segment_latency',output_path='plots/gpu/koios/timestamped', hardware="koios", device="gpu", compute_type="float32",backend="timestamped", method="greedy", vad=None, condition_on_previous_text="NoCondition", data_type="silence")
134138
plot_param(data_gpu, title="Latency depending Previous text on 1080TI (GPU)", key='segment_latency', output_path='plots/gpu/koios', hardware="koios", device="gpu", backend=None, method="greedy", compute_type="best", vad="NoVAD", condition_on_previous_text=None, data_type="speech")
135-
136-
139+
plot_param(data_gpu, title="Latency depending on model on 1080TI (GPU) for whisper-timestamped", key='segment_latency',output_path='plots/gpu/koios/timestamped', hardware="koios", device="gpu", compute_type="float32",backend="timestamped", method="greedy", vad="NoVAD", condition_on_previous_text="NoCondition", data_type="speech", model_size=None)
140+
plot_param(data_gpu, title="Latency depending on model on 1080TI (GPU)", key='segment_latency',output_path='plots/gpu/koios/', hardware="koios", device="gpu", compute_type="best",backend=None, method="greedy", vad="NoVAD", condition_on_previous_text="NoCondition", data_type="speech", model_size=None)
141+
137142
plot_param(data_gpu, title="VRAM usage depending on precision on 1080TI (GPU) for faster-whisper", key='max_vram',output_path='plots/gpu/koios/faster', hardware="koios", device="gpu", backend="faster", method="greedy", vad='NoVAD', ylabel="VRAM usage [MB]", plot_data_mode='max', condition_on_previous_text="NoCondition", data_type="speech")
138143
plot_param(data_gpu, title="VRAM usage depending on precision on 1080TI (GPU) for whisper-timestamped", key='max_vram',output_path='plots/gpu/koios/timestamped', hardware="koios", device="gpu", backend="timestamped", method="greedy", vad='NoVAD', ylabel="VRAM usage [MB]", plot_data_mode='max', condition_on_previous_text="NoCondition", data_type="speech")
139144

@@ -153,12 +158,15 @@ def plot(data, wer=False):
153158

154159
plot_param(data_cpu, title="RAM usage depending on precision on CPU for faster-whisper", key='max_vram',output_path='plots/cpu/biggerboi/faster', hardware="biggerboi", device="cpu", backend="faster", method="greedy", vad='NoVAD', ylabel="RAM usage [MB]", plot_data_mode='max', data_type="speech", condition_on_previous_text="NoCondition", cpu_threads="4t")
155160
plot_param(data_cpu, title="RAM usage depending on precision on CPU for whisper-timestamped", key='max_vram',output_path='plots/cpu/biggerboi/timestamped', hardware="biggerboi", device="cpu", backend="timestamped", method="greedy", vad='NoVAD', ylabel="RAM usage [MB]", plot_data_mode='max', data_type="speech", condition_on_previous_text="NoCondition", cpu_threads="4t")
161+
162+
plot_param(data_cpu, title="Latency depending on number of threads on CPU", key='segment_latency', output_path='plots/cpu/lenovo', hardware="lenovo", device="cpu", backend=None, method="greedy", vad='NoVAD', data_type="speech", condition_on_previous_text="NoCondition", cpu_threads=None, compute_type="best")
163+
plot_param(data_cpu, title="Latency depending on hardware and backend", key='segment_latency', output_path='plots/cpu/', hardware=None, device="cpu", backend=None, method="greedy", vad='NoVAD', data_type="speech", condition_on_previous_text="NoCondition", cpu_threads="4t", compute_type="best")
164+
156165

157166
combined_data = data
158-
plot_param(combined_data, title="Latency depending on device and backend", key='segment_latency', output_path='plots/', hardware=None, device=None, backend=None, method="greedy", vad='VAD', condition_on_previous_text="NoCondition", data_type="speech", cpu_threads="4t", compute_type="best")
159-
plot_param(combined_data, title="RTF depending on device and backend", key='segment_processing_time', ylabel="Processing time/duration", plot_data_mode='rtf', output_path='plots/', hardware=None, device=None, backend=None, method="greedy", vad='VAD', condition_on_previous_text="NoCondition", data_type="speech", cpu_threads="4t", compute_type="best")
160-
161-
plot_param(combined_data, title="Memory usage depending on device and backend", key='max_vram', ylabel="RAM/VRAM usage [MB]", plot_data_mode='max', output_path='plots/', hardware=None, device=None, backend=None, method="greedy", vad='VAD', condition_on_previous_text="NoCondition", data_type="speech", cpu_threads="4t", compute_type="best")
167+
plot_param(combined_data, title="Latency depending on device and backend", key='segment_latency', output_path='plots/', hardware=None, device=None, backend=None, method="greedy", vad='NoVAD', condition_on_previous_text="NoCondition", data_type="speech", cpu_threads="4t", compute_type="best")
168+
plot_param(combined_data, title="RTF depending on device and backend", key='segment_processing_time', ylabel="Processing time/duration", plot_data_mode='rtf', output_path='plots/', hardware=None, device=None, backend=None, method="greedy", vad='NoVAD', condition_on_previous_text="NoCondition", data_type="speech", cpu_threads="4t", compute_type="best")
169+
# plot_param(combined_data, title="Memory usage depending on device and backend", key='max_vram', ylabel="RAM/VRAM usage [MB]", plot_data_mode='max', output_path='plots/', hardware=None, device=None, backend=None, method="greedy", vad='NoVAD', condition_on_previous_text="NoCondition", data_type="speech", cpu_threads="4t", compute_type="best")
162170

163171
plot_param(data_gpu, title="Latency depending on hardware", key='segment_latency', output_path='plots/gpu/', hardware=None, device="gpu", backend=None, method="greedy", vad='NoVAD', condition_on_previous_text="NoCondition", data_type="speech", compute_type="best", offline="streaming", model_size="large")
164172
plot_param(data_gpu, title="Latency depending on precision on 4090 Laptop (GPU) for faster-whisper", key='segment_latency', output_path='plots/gpu/lenovo/faster', hardware="lenovo", device="gpu", backend="faster", method="greedy", vad='NoVAD', condition_on_previous_text="NoCondition", data_type="speech")
@@ -254,12 +262,17 @@ def plot_param(data, title="Latency", key='segment_latency', output_path='plots'
254262
plt.savefig(os.path.join(output_path,f'{title}.png'), bbox_inches='tight')
255263
plt.close()
256264

257-
def get_ram_value(path):
258-
with open(os.path.join(path, "ram.txt"), 'r') as f:
259-
line = f.readline()
260-
line = line.split(": ")[1]
261-
line = line.split(" ")[0]
262-
ram_value = int(line) / 1000
265+
def get_ram_value(path, verbose=False):
266+
try:
267+
with open(os.path.join(path, "ram.txt"), 'r') as f:
268+
line = f.readline()
269+
line = line.split(": ")[1]
270+
line = line.split(" ")[0]
271+
ram_value = int(line) / 1000
272+
except Exception as e:
273+
if verbose:
274+
print(f"Error reading ram.txt ({path}): {e}")
275+
ram_value = None
263276
return ram_value
264277

265278
def load_data(data_path, truth_path):
@@ -298,7 +311,7 @@ def load_data(data_path, truth_path):
298311
for x in params:
299312
added=False
300313
for j in x:
301-
if j.startswith('large') or j=="medium" or j=="small" or j=="tiny":
314+
if j.startswith('large') or j.startswith('model') or j=="medium" or j=="small" or j=="tiny":
302315
model_sizes.append(j)
303316
added=True
304317
if not added:
@@ -331,9 +344,8 @@ def load_data(data_path, truth_path):
331344
parser.add_argument('--data_path', type=str, default='../results/wstart/normal_large')
332345
# parser.add_argument('--data_path', type=str, default='normal_large')
333346

334-
# parser.add_argument('--data_path', type=str, default='../faster_n_openai/normal_large_wer')
335347
parser.add_argument('--ground_truth', type=str, default='../ground_truths')
336-
parser.add_argument('--wer', type=bool, default=False)
348+
parser.add_argument('--wer', action="store_true", default=False, help="Plot WER instead of latencies.")
337349
args = parser.parse_args()
338350

339351
data_path = args.data_path

0 commit comments

Comments
 (0)