This component is used to benchmark the system and to profile models.
It can perform a benchmark of the system or it can be used to profile a single model. A benchmark can be implemented extending the base Benchmark class.
- init the benchmark with a parameters file containing information about how to run the benchmark
endpoints_benchmark
: the endpoints of the dispatchersendpoint_profiler
: the TF Serving endpoint for profiling the modelbench_folder
: the folder where are the data for benchmarking and profilingvalidation_folder
: the folder where are the data for validationrepeat_measure
: the number of times needed to repeat the response time measurewarm_up_times
: the number of requests needed to warm up the model
- start a benchmark with
profiler.run_benchmark()
: it will profile the system using the data into the folder specified in the parameters file before_benchmark()
is called before the benchmark is startedafter_benchmark()
is called after the benchmark is completed
- start a profiling with
profiler.run_profiling()
: it will profile the model using the data into the folder specified in the parameters file before_profiling()
is called before the profiling is startedafter_profiling()
is called after the profiling is completed
- start a validation with
profiler.validate()
: it will validate the model using the data into the folder given in the parameters file before_validate()
is called before the validation is startedafter_validate()
is called after the validation is completedshow_data()
is called before submitting the request, e.g. to show the input datashow_response()
is called after receiving the response, e.g. to show the output data
The profiler class provides some useful functions:
before_profiling
: executed before profiling is started, e.g.:- load the requests data,
- perform some pre profile works
- warm up the model, etc.
after_profiling
: executed after profiling is done, e.g.:- save profiling data.
- elaborate response data,
- save response, etc.
load_requests_from_file
: used to load test requests from a filewarm_up_model
: used to perform some requests in order to warm-up the model
self.bench_data
: it is the list of requests used to profile the modelself.validate_data
: it is the list of requests used to validate the model
Each entry in the lists is a dict with the following fields:
"data"
: the raw data read"request
: the data converted in a ready to be submitted request
It is a specialized benchmark used with imagenet models such as AlexNet, GooLeNet, VGG16.