-
Notifications
You must be signed in to change notification settings - Fork 13
Uptake latest bc-eval package for storage options and LMchecklist #647
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
12 commits
Select commit
Hold shift + click to select a range
386a897
add category command to allow extensible bc-eval upload
haoranpb 38f174f
fix core score must match metrics class
haoranpb c25a2a5
fix decripated upload result
haoranpb 903ebd5
fix test every category must have core score
haoranpb 5170186
fix more tests related to core score
haoranpb 572c748
enable LMchecklist in general
haoranpb b6a946a
consistent style for types
haoranpb 5b4c414
Revert "consistent style for types"
haoranpb c2370e6
rename input to task_inpuit avoid naming conflict
haoranpb c28ae6f
enfore category in resutl summery
haoranpb f46360f
remote storage name from description
haoranpb 84ad99c
conditionally include storage options in leaderboard update step
haoranpb 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
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 |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| """CLI commands for bcbench.""" | ||
|
|
||
| from bcbench.commands.category import category_app | ||
| from bcbench.commands.dataset import dataset_app | ||
| from bcbench.commands.evaluate import evaluate_app | ||
| from bcbench.commands.run import run_app | ||
|
|
||
| __all__ = ["dataset_app", "evaluate_app", "run_app"] | ||
| __all__ = ["category_app", "dataset_app", "evaluate_app", "run_app"] |
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,50 @@ | ||
| import os | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| import typer | ||
| from typing_extensions import Annotated | ||
|
|
||
| from bcbench.cli_options import EvaluationCategoryOption | ||
| from bcbench.types import EvaluationCategory | ||
|
|
||
| category_app = typer.Typer(help="Category-specific configuration helpers") | ||
|
|
||
|
|
||
| @category_app.command("list") | ||
| def list_categories() -> None: | ||
| """Print all evaluation category names, one per line.""" | ||
| for category in EvaluationCategory: | ||
| sys.stdout.write(f"{category.value}\n") | ||
|
|
||
|
|
||
| @category_app.command("bceval-config") | ||
| def bceval_config( | ||
| category: EvaluationCategoryOption, | ||
| github_output: Annotated[ | ||
| Path | None, | ||
| typer.Option(envvar="GITHUB_OUTPUT", help="Append outputs to this file (typically $GITHUB_OUTPUT)"), | ||
| ] = None, | ||
| ) -> None: | ||
| """ | ||
| Print the bc-eval evaluator list and core score for a category as key=value lines. | ||
|
|
||
| When run inside a GitHub Actions step with $GITHUB_OUTPUT set, the lines are | ||
| appended to that file so they become step outputs. Otherwise they're written | ||
| to stdout. | ||
| """ | ||
| lines: list[str] = [ | ||
| f"evaluators={','.join(category.evaluators)}", | ||
| f"core_score={category.core_score}", | ||
| ] | ||
| payload: str = "\n".join(lines) + "\n" | ||
|
|
||
| if github_output: | ||
| with open(github_output, "a", encoding="utf-8") as file: | ||
| file.write(payload) | ||
| else: | ||
| sys.stdout.write(payload) | ||
|
|
||
| # Always echo to stderr so workflow logs show what was emitted. | ||
| if os.getenv("GITHUB_ACTIONS"): | ||
| sys.stderr.write(payload) |
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 |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| """Dataset module for querying, validating and analyze dataset entries.""" | ||
|
|
||
| from bcbench.dataset.dataset_entry import BaseDatasetEntry, BugFixEntry, TestEntry, TestGenEntry | ||
| from bcbench.dataset.dataset_entry import BaseDatasetEntry, BugFixEntry, ExpectedOutput, TestEntry, TestGenEntry | ||
|
|
||
| __all__ = [ | ||
| "BaseDatasetEntry", | ||
| "BugFixEntry", | ||
| "ExpectedOutput", | ||
| "TestEntry", | ||
| "TestGenEntry", | ||
| ] |
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
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,51 @@ | ||
| from typer.testing import CliRunner | ||
|
|
||
| from bcbench.cli import app | ||
| from bcbench.types import EvaluationCategory | ||
|
|
||
| runner = CliRunner() | ||
|
|
||
|
|
||
| def test_bceval_config_prints_evaluators_and_core_score_to_stdout_when_no_github_output(monkeypatch): | ||
| monkeypatch.delenv("GITHUB_OUTPUT", raising=False) | ||
| monkeypatch.delenv("GITHUB_ACTIONS", raising=False) | ||
|
|
||
| result = runner.invoke(app, ["category", "bceval-config", "--category", "bug-fix"]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| assert "evaluators=resolution_rate,build_rate" in result.stdout | ||
| assert "core_score=ResolutionRate" in result.stdout | ||
|
|
||
|
|
||
| def test_bceval_config_appends_to_github_output_file_when_set(tmp_path, monkeypatch): | ||
| output_file = tmp_path / "gh_output" | ||
| output_file.write_text("pre_existing=keep\n", encoding="utf-8") | ||
| monkeypatch.setenv("GITHUB_OUTPUT", str(output_file)) | ||
| monkeypatch.delenv("GITHUB_ACTIONS", raising=False) | ||
|
|
||
| result = runner.invoke(app, ["category", "bceval-config", "--category", "test-generation"]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| contents = output_file.read_text(encoding="utf-8") | ||
| assert "pre_existing=keep" in contents | ||
| assert "evaluators=resolution_rate,build_rate,pre_patch_failed_rate,post_patch_passed_rate" in contents | ||
| assert "core_score=ResolutionRate" in contents | ||
|
|
||
|
|
||
| def test_bceval_config_supports_every_category(monkeypatch): | ||
| monkeypatch.delenv("GITHUB_OUTPUT", raising=False) | ||
| monkeypatch.delenv("GITHUB_ACTIONS", raising=False) | ||
|
|
||
| for category in EvaluationCategory: | ||
| result = runner.invoke(app, ["category", "bceval-config", "--category", category.value]) | ||
| assert result.exit_code == 0, f"{category}: {result.stdout}" | ||
| assert f"evaluators={','.join(category.evaluators)}" in result.stdout | ||
| assert f"core_score={category.core_score}" in result.stdout | ||
|
|
||
|
|
||
| def test_list_prints_every_category_one_per_line(): | ||
| result = runner.invoke(app, ["category", "list"]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| lines = [line for line in result.stdout.splitlines() if line] | ||
| assert lines == [c.value for c in EvaluationCategory] |
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
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.