Cornerstone-OnDemand/modelkit

[Feature request] Add profiler to modelkit model

llin17 opened this issue · 2 comments

I would like to propose a simple feature that can analyze resource consumption for model prediction. The usage is described as follows:

model = modelkit.load_model(...)
profiler = Profiler(model) # Profiler could be customized
result = model(item)
profiler.summary() # output a DataFrame or str

# if there is no profiler, everything works as usual.

The output profile.summary() contains also the profiling result of each sub-models (defined in self.model_dependencies recursively). This requires only a few lines changes in modelkit/core/model.py.

The PR has been merged.