-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark Script for Pipelines #1150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall - could you add an example of the expected output format either to the PR or readme?
Added to the README! |
…e into pipeline-benchmark
…e into pipeline-benchmark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks very close, had a few comments, and nits: mostly around docstrings.
Additionally, something to think about, as we generally support yaml for all our recipes and other configs(like deepsparse server); would it make sense to use yaml over json here too for consistency? We could also support both I'm in favor of that, but really think we should atleast support yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GHA failures unrelated, merging |
Adding a script for benchmarking pipelines, which reports the amount of compute time spent in each phase of the pipeline. This allows us to identify bottlenecks outside the engine in pre or post processing.
Example Usage
Based on the pipeline argument, the script will infer what type of data to generate or search for (See
get_input_schema_type
for details)Config File Documentation
Configurations for generating or loading data to the pipeline are specified as JSON, documented in the README. A quick summary:
data_type
to "real" to pull text or image data fromdata_folder
, or set it to "dummy" to use randomly generated data. * In dummy mode, string lengths are set withgen_sequence_length
and image shapes are set byinput_image_shape
max_string_length
will truncate input text if >0, set to -1 for no truncationdata_folder
is a path to either images(.jpg, .jpeg, .gif) or text(.txt) files, to be read in real modeto true to recursively search
data_folder`pipeline.Pipeline()
can be added topipeline_kwargs
Pipeline.input_schema()
can be added toinput_schema_kwargs
Example:
Testing
Added unit tests to
test_pipeline_benchmark.py
, and also manually tested the following pipelines:deepsparse.benchmark_pipeline text_classification zoo:nlp/sentiment_analysis/distilbert-none/pytorch/huggingface/sst2/pruned90-none -c tests/test_data/pipeline_bench_config.json
deepsparse.benchmark_pipeline image_classification zoo:cv/classification/resnet_v1-50_2x/pytorch/sparseml/imagenet/base-none -c tests/test_data/pipeline_bench_config.json
deepsparse.benchmark_pipeline text_generation zoo:nlg/text_generation/codegen_mono-350m/pytorch/huggingface/bigpython_bigquery_thepile/base_quant-none -c tests/test_data/pipeline_bench_config.json
deepsparse.benchmark_pipeline yolo zoo:cv/detection/yolov5-l/pytorch/ultralytics/coco/pruned_quant-aggressive_95-c tests/test_data/pipeline_bench_config.json
deepsparse.benchmark_pipeline question_answering zoo:nlp/question_answering/bert-base/pytorch/huggingface/squad/12layer_pruned80_quant-none-vnni -c tests/test_data/pipeline_bench_config.json
deepsparse.benchmark_pipeline token_classification zoo:nlp/token_classification/distilbert-none/pytorch/huggingface/conll2003/pruned90-none -c tests/test_data/pipeline_bench_config.json