nnfp
copied
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions
54 lines
1.3 KiB
54 lines
1.3 KiB
2 years ago
|
# Inference Performance
|
||
|
|
||
|
## Test Scripts
|
||
|
|
||
|
```python
|
||
|
from towhee import ops
|
||
|
import time
|
||
|
|
||
|
decode = ops.audio_decode.ffmpeg()
|
||
|
audio = [x[0] for x in decode('path/to/test.wav')]
|
||
|
|
||
|
op = ops.audio_embedding.nnfp()
|
||
2 years ago
|
# op = ops.audio_embedding.nnfp(model_path='path/to/torchscript/model.pt')
|
||
|
# op = ops.audio_embedding.nnfp(model_path='path/to/model.onnx')
|
||
2 years ago
|
|
||
|
|
||
|
start = time.time()
|
||
|
for _ in range(100):
|
||
|
embs = op(audio)
|
||
|
assert(embs.shape == (10, 128))
|
||
|
end = time.time()
|
||
|
|
||
|
print((end-start) / 100)
|
||
|
```
|
||
|
|
||
2 years ago
|
## Performance (Default model)
|
||
2 years ago
|
|
||
|
- Device: MacOS, 2.3 GHz Quad-Core Intel Core i7, 8 CPUs
|
||
2 years ago
|
- Input: 10s stereo audio, shape (2, 441344), sr 44100, loop for 100 times
|
||
2 years ago
|
|
||
|
| inference method | mem usage | avg time |
|
||
|
| -- | -- | -- |
|
||
2 years ago
|
| pytorch | 0.3G | 0.160s |
|
||
|
| torchscript | 0.3G | 0.167s |
|
||
|
| onnx | 0.4G | 0.093s |
|
||
2 years ago
|
|
||
|
- Device: MacOS, 2.3 GHz Quad-Core Intel Core i7, 8 CPUs
|
||
2 years ago
|
- Input: 188s stereo audio, shape (2, 8328408), sr 44100, loop for 100 times
|
||
2 years ago
|
|
||
|
| inference method | mem usage | avg time |
|
||
|
| -- | -- | -- |
|
||
2 years ago
|
| pytorch | 2.7G | 2.29s |
|
||
|
| torchscript | 2.5G | 2.30s |
|
||
|
| onnx | 1.3G | 1.77s |
|
||
2 years ago
|
|
||
|
- Device: MacOS, 2.3 GHz Quad-Core Intel Core i7, 8 CPUs
|
||
2 years ago
|
- Input: 600s mono audio, shape (1, 9600000), sr 16000, loop for 20 times
|
||
2 years ago
|
|
||
|
| inference method | mem usage | avg time |
|
||
|
| -- | -- | -- |
|
||
2 years ago
|
| pytorch | 4.9G | 9.04s |
|
||
|
| torchscript | 4.9G | 9.302s |
|
||
|
| onnx | 2.7G | 4.586s |
|