-
Notifications
You must be signed in to change notification settings - Fork 106
bug fix - html rendering when multiple percentiles are the same #490
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
Open
sephib
wants to merge
5
commits into
vllm-project:main
Choose a base branch
from
sephib:bug/fix-html-report-with-duplicate-percentile-values
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9573256
fix html rendering when multiple percentiles to collapse to the same …
sephib 8d196a4
add AI authorship comment to test_html_output.py
sephib aa4620e
fix: update duplicate percentile filtering to retain largest values f…
sephib d3b6ecc
Merge branch 'main' into bug/fix-html-report-with-duplicate-percentil…
sephib 9b144b7
fix: line length E501
sephib 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| ## WRITTEN BY AI ## | ||
| from guidellm.benchmark.outputs.html import _filter_duplicate_percentiles | ||
| from guidellm.schemas import Percentiles | ||
|
|
||
|
|
||
| def test_filter_all_same_values(): | ||
| """Test filtering when all percentiles have the same value.""" | ||
| percentiles = { | ||
| "p001": 15.288091352804853, | ||
| "p01": 15.288091352804853, | ||
| "p05": 15.288091352804853, | ||
| "p10": 15.288091352804853, | ||
| "p25": 15.288091352804853, | ||
| "p50": 15.288091352804853, | ||
| "p75": 15.288091352804853, | ||
| "p90": 15.288091352804853, | ||
| "p95": 15.288091352804853, | ||
| "p99": 15.288091352804853, | ||
| "p999": 15.288091352804853, | ||
| } | ||
|
|
||
| filtered = _filter_duplicate_percentiles(percentiles) | ||
|
|
||
| # Should only keep the first one | ||
| assert filtered == {"p001": 15.288091352804853} | ||
|
|
||
|
|
||
| def test_filter_consecutive_duplicates(): | ||
| """Test filtering when some consecutive percentiles have the same value.""" | ||
| percentiles = { | ||
| "p001": 15.288091352804853, | ||
| "p01": 15.288091352804853, | ||
| "p05": 15.288091352804853, | ||
| "p10": 15.288091352804853, | ||
| "p25": 15.288091352804853, | ||
| "p50": 16.41327511776994, # Different value | ||
| "p75": 16.41327511776994, | ||
| "p90": 17.03541629998259, # Different value | ||
| "p95": 17.03541629998259, | ||
| "p99": 17.03541629998259, | ||
| "p999": 17.03541629998259, | ||
| } | ||
|
|
||
| filtered = _filter_duplicate_percentiles(percentiles) | ||
|
|
||
| # Should keep first of each group | ||
| assert filtered == { | ||
| "p001": 15.288091352804853, | ||
| "p50": 16.41327511776994, | ||
| "p90": 17.03541629998259, | ||
| } | ||
|
|
||
|
|
||
| def test_no_duplicates(): | ||
| """Test that unique values are all preserved.""" | ||
| percentiles = { | ||
| "p001": 13.181080445834912, | ||
| "p01": 13.181080445834912, # Same as p001 | ||
| "p05": 13.530595573836457, # Different | ||
| "p10": 13.843972502554365, | ||
| "p25": 14.086376978251748, | ||
| "p50": 14.403258051191058, | ||
| "p75": 14.738608817056042, | ||
| "p90": 15.18136631856698, | ||
| "p95": 15.7213110894772, | ||
| "p99": 15.7213110894772, # Same as p95 | ||
| "p999": 15.7213110894772, # Same as p99 | ||
| } | ||
|
|
||
| filtered = _filter_duplicate_percentiles(percentiles) | ||
|
|
||
| assert filtered == { | ||
| "p001": 13.181080445834912, | ||
| "p05": 13.530595573836457, | ||
| "p10": 13.843972502554365, | ||
| "p25": 14.086376978251748, | ||
| "p50": 14.403258051191058, | ||
| "p75": 14.738608817056042, | ||
| "p90": 15.18136631856698, | ||
| "p95": 15.7213110894772, | ||
| } | ||
|
|
||
|
|
||
| def test_empty_percentiles(): | ||
| """Test with empty percentiles dictionary.""" | ||
| filtered = _filter_duplicate_percentiles({}) | ||
| assert filtered == {} | ||
|
|
||
|
|
||
| def test_single_percentile(): | ||
| """Test with only one percentile.""" | ||
| percentiles = {"p50": 14.403258051191058} | ||
| filtered = _filter_duplicate_percentiles(percentiles) | ||
| assert filtered == {"p50": 14.403258051191058} | ||
|
|
||
|
|
||
| def test_two_different_values(): | ||
| """Test with two different values.""" | ||
| percentiles = { | ||
| "p25": 14.086376978251748, | ||
| "p50": 14.403258051191058, | ||
| } | ||
| filtered = _filter_duplicate_percentiles(percentiles) | ||
| assert filtered == percentiles | ||
|
|
||
|
|
||
| def test_partial_percentiles(): | ||
| """Test that order is maintained even with partial percentiles.""" | ||
| percentiles = { | ||
| "p50": 16.41327511776994, | ||
| "p10": 15.288091352804853, | ||
| "p90": 17.03541629998259, | ||
| } | ||
|
|
||
| filtered = _filter_duplicate_percentiles(percentiles) | ||
|
|
||
| # Should maintain order from percentile_order list | ||
| assert list(filtered.keys()) == ["p10", "p50", "p90"] | ||
|
|
||
|
|
||
| def test_model_dump_filters_duplicates(): | ||
| """Test that model_dump applies percentile filtering.""" | ||
| from guidellm.benchmark.outputs.html import _TabularDistributionSummary | ||
|
|
||
| # Create a distribution with duplicate percentiles (typical of small datasets) | ||
| dist = _TabularDistributionSummary( | ||
| mean=15.5, | ||
| median=15.288091352804853, | ||
| mode=15.288091352804853, | ||
| variance=0.1, | ||
| std_dev=0.316, | ||
| min=15.288091352804853, | ||
| max=17.03541629998259, | ||
| count=3, | ||
| total_sum=46.5, | ||
| percentiles=Percentiles( | ||
| p001=15.288091352804853, | ||
| p01=15.288091352804853, | ||
| p05=15.288091352804853, | ||
| p10=15.288091352804853, | ||
| p25=15.288091352804853, | ||
| p50=16.41327511776994, | ||
| p75=16.41327511776994, | ||
| p90=17.03541629998259, | ||
| p95=17.03541629998259, | ||
| p99=17.03541629998259, | ||
| p999=17.03541629998259, | ||
| ), | ||
| ) | ||
|
|
||
| data = dist.model_dump() | ||
|
|
||
| # Check that percentiles were filtered | ||
| assert data["percentiles"] == { | ||
| "p001": 15.288091352804853, | ||
| "p50": 16.41327511776994, | ||
| "p90": 17.03541629998259, | ||
| } | ||
|
|
||
| # Ensure other fields remain unchanged | ||
| assert data["mean"] == 15.5 | ||
| assert data["median"] == 15.288091352804853 | ||
| assert data["count"] == 3 |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.