CTranslate2 [Feature Request] Expose Profiler to Python

bttbmeg0  于 2个月前  发布在  Python
关注(0)|答案(1)|浏览(49)

Problem

We am working on analyzing the performance of different layers of a workload and comparing the performance with different backends.
The current issue is that we are running whisper via python and were not able to use the built in profiler
I came across this comment which surprised me it still has not been implemented.

Solution

As a workaround, I exposed the profiler to python with some small code modifications and it seemed to function smoothly on my linux env.
see changes here:
master...yehudaorel:CTranslate2:python_profiler
I am aware I hard coded threads and device but this can easily be fixed.

Usage:

import ctranslate2

ctranslate2.init_profiler()
 # Translate/Transcribe
ctranslate2.dump_profiler()

I understand this is a very niche request but would be extremely beneficial to have integrated and properly documented. Let me know if you would like me to refine the implementation and open a PR for the fix.
Either way I thought to leave this hear in case someone else would like to use it in the future.

bjg7j2ky

bjg7j2ky1#

你好,你能为这个功能打开一个PR吗?非常感谢

相关问题