nnfp
              
                
                
            
          copied
				 4 changed files with 130 additions and 35 deletions
			
			
		@ -0,0 +1,46 @@ | 
				
			|||
# 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() | 
				
			|||
# op = ops.audio_embedding.nnfp( | 
				
			|||
#		    model_path='path/to/torchscript/model.pt') | 
				
			|||
# op = ops.audio_embedding.nnfp( | 
				
			|||
#		    model_path='path/to/model.onnx') | 
				
			|||
 | 
				
			|||
 | 
				
			|||
start = time.time() | 
				
			|||
for _ in range(100): | 
				
			|||
	embs = op(audio) | 
				
			|||
	assert(embs.shape == (10, 128)) | 
				
			|||
end = time.time() | 
				
			|||
 | 
				
			|||
print((end-start) / 100) | 
				
			|||
``` | 
				
			|||
 | 
				
			|||
## Results | 
				
			|||
 | 
				
			|||
- Device: MacOS, 2.3 GHz Quad-Core Intel Core i7, 8 CPUs | 
				
			|||
- Input: 10s audio, loop for 100 times | 
				
			|||
 | 
				
			|||
| inference method | mem usage | avg time | | 
				
			|||
| -- | -- | -- | | 
				
			|||
| pytorch | 0.3G | 0.451s | | 
				
			|||
| torchscript | 0.3G | 0.470s | | 
				
			|||
| onnx | 0.3G | 0.378s | | 
				
			|||
 | 
				
			|||
- Device: MacOS, 2.3 GHz Quad-Core Intel Core i7, 8 CPUs | 
				
			|||
- Input: 188s audio, loop for 100 times | 
				
			|||
 | 
				
			|||
| inference method | mem usage | avg time | | 
				
			|||
| -- | -- | -- | | 
				
			|||
| pytorch | 2.6G | 8.162s | | 
				
			|||
| torchscript | 2.8G | 7.507s | | 
				
			|||
| onnx | 1.7G | 6.769s | | 
				
			|||
					Loading…
					
					
				
		Reference in new issue