-
Notifications
You must be signed in to change notification settings - Fork 243
add benchmark configuration and case for codeflash #1254
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4282a24
add benchmark configuration and case for codeflash
KRRT7 c540267
Merge branch 'main' into cf-e2e
KRRT7 fc11c7f
Merge branch 'main' into cf-e2e
grzegorz-roboflow 44a5498
more workflows to benchmark
aseembits93 96f8879
Merge branch 'main' into cf-e2e
aseembits93 60bcb22
testing benchmark in CI
aseembits93 62874fc
workflow works
aseembits93 a3d5184
Merge branch 'main' into cf-e2e
aseembits93 f04f9c8
Update requirements.code_analysis.txt
aseembits93 245924a
Update test_speed_benchmark.py
aseembits93 6806f83
Update requirements.code_analysis.txt
aseembits93 3f0d553
Merge branch 'main' into cf-e2e
grzegorz-roboflow 03fa15d
Merge branch 'main' into cf-e2e
grzegorz-roboflow c7484fd
skip benchmarks in ci
aseembits93 a105b21
cleaning up
aseembits93 b3aa6f4
cleaning up
aseembits93 846d763
reorganizing requirements
aseembits93 a7d1495
moving the benchmark dir outside test subdirs
aseembits93 1360c2b
Merge branch 'main' into cf-e2e
aseembits93 2a3099b
Merge branch 'main' into cf-e2e
PawelPeczek-Roboflow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import numpy as np | ||
| import pytest | ||
| from inference import get_model | ||
| from inference_cli.lib.benchmark.dataset import load_dataset_images | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def dataset_reference() -> tuple[list[np.ndarray], set[tuple[int, int]]]: | ||
| dataset_images = load_dataset_images( | ||
| dataset_reference="coco", | ||
| ) | ||
| return dataset_images, {i.shape[:2] for i in dataset_images} | ||
|
|
||
|
|
||
| # args of inference benchmark python-package-speed -m yolov8n-seg-640 -bi 10000 command | ||
| args = { | ||
| "dataset_reference": "coco", | ||
| "warm_up_inferences": 10, | ||
| "benchmark_inferences": 10000, | ||
| "batch_size": 1, | ||
| "api_key": None, | ||
| "model_configuration": None, | ||
| "output_location": None, | ||
| } | ||
|
|
||
| def test_benchmark_equivalent_rfdetr(benchmark, dataset_reference): | ||
| images, image_sizes = dataset_reference | ||
|
|
||
| model = get_model(model_id="rfdetr-base", api_key=None) | ||
|
|
||
| benchmark(model.infer, images) | ||
|
|
||
| def test_benchmark_equivalent_yolov8n_seg(benchmark, dataset_reference): | ||
| images, image_sizes = dataset_reference | ||
|
|
||
| model = get_model(model_id="yolov8n-seg-640", api_key=None) | ||
|
|
||
| benchmark(model.infer, images) | ||
|
|
||
| def test_benchmark_equivalent_yolov8n(benchmark, dataset_reference): | ||
| images, image_sizes = dataset_reference | ||
|
|
||
| model = get_model(model_id="yolov8n-640", api_key=None) | ||
|
|
||
| benchmark(model.infer, images) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is this symbol imported?
Uh oh!
There was an error while loading. Please reload this page.
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.
Hi @PawelPeczek-Roboflow , We follow the style of pytest-benchmark in writing tests (https://pytest-benchmark.readthedocs.io/en/latest/) but override the benchmark keyword to suit our style of benchmarking. The 'benchmark' keyword is injected by codeflash during execution. This file is only executed by codeflash during
codeflash --benchmark, it is outside any test subdirectory and won't be encountered by any of the CI workflows except the codeflash workflow.