Overview
Profilers¶
In order to analyze/benchmark model inference time, custom profiler can be defined by inheriting BaseProfiler. The following functions need to be overwritten:
summary(self, *args, **kwargs): define how to print the resultstart(self, model_name): define how to start recordingend(self, model_name): define how to end recordingprofile(self, *args, **kwargs): (context manager) define how to compute elapsed time
Here, we implement SimpleProfiler that uses a simple context manager to profile each call of predict(...) by models and its sub-models defined in model_dependencies as an exameple. More sophisticated profiler that records CPU, RAM usages could be implemented using cProfile and pstats.