Download scripts/codec_speed.py from matthiastl/gepard-onnx: direct link, hf CLI and curl.
- Browser
- Download file 643 Bytes
-
https://huggingface.co/matthiastl/gepard-onnx/resolve/main/scripts/codec_speed.py
- Command line
-
hf download hf://matthiastl/gepard-onnx/scripts/codec_speed.py
-
curl -L -o codec_speed.py https://huggingface.co/matthiastl/gepard-onnx/resolve/main/scripts/codec_speed.py
643 Bytes
| import sys, time | |
| import numpy as np, onnxruntime as ort | |
| for th in (1, 4): | |
| o = ort.SessionOptions(); o.intra_op_num_threads = th; o.inter_op_num_threads = 1 | |
| s = ort.InferenceSession("export/codec_decoder.onnx", o, providers=["CPUExecutionProvider"]) | |
| for T in (12, 38, 80, 200): | |
| z = np.zeros((1, 32, T), np.float32); s.run(None, {"z": z}); t = [] | |
| for _ in range(4): a = time.perf_counter(); s.run(None, {"z": z}); t.append(time.perf_counter() - a) | |
| m = min(t); print(f"codec, {th} thread(s), {T} frames ({T * 46.44 / 1000:.2f} s of sound): {m * 1e3:.0f} ms = {m / (T * 0.04644):.2f} of real time", flush=True) | |