-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix accuracy test config --config-list-file #2163
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,12 @@ def pytest_addoption(parser): | |
| default="./benchmarks/accuracy/Qwen3-8B-Base.md", | ||
| help="Path to the report output file", | ||
| ) | ||
| parser.addoption( | ||
| "--report-dir", | ||
| action="store", | ||
| default="./benchmarks/accuracy", | ||
| help="Directory to store report files when using config list", | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
|
|
@@ -48,26 +54,35 @@ def config(pytestconfig): | |
| return pytestconfig.getoption("--config") | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def report_output(pytestconfig): | ||
| return pytestconfig.getoption("--report_output") | ||
| @pytest.fixture(scope="function") | ||
| def report_output(pytestconfig, config_filename): | ||
| if pytestconfig.getoption("--config-list-file"): | ||
| report_dir = pytestconfig.getoption("--report-dir") | ||
| model_name = Path(config_filename).stem | ||
| report_path = Path(report_dir) / f"{model_name}.md" | ||
| report_path.parent.mkdir(parents=True, exist_ok=True) | ||
| return report_path | ||
|
|
||
| output_path = pytestconfig.getoption("--report_output") | ||
| if output_path: | ||
| output_path = Path(output_path) | ||
| return output_path | ||
|
|
||
|
|
||
| def pytest_generate_tests(metafunc): | ||
| if "config_filename" in metafunc.fixturenames: | ||
| # If config specified, use the --config directly | ||
| single_config = metafunc.config.getoption("--config") | ||
| if single_config: | ||
| metafunc.parametrize("config_filename", | ||
| [Path(single_config).resolve()]) | ||
| if metafunc.config.getoption("--config-list-file"): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why reorder this? the original thoughts is that
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the --config option has default settings, if --config is checked first, the logic for --config-list-file will definitely not be executed. |
||
| rel_path = metafunc.config.getoption("--config-list-file") | ||
| config_list_file = Path(rel_path).resolve() | ||
| config_dir = config_list_file.parent | ||
| with open(config_list_file, encoding="utf-8") as f: | ||
| configs = [ | ||
| config_dir / line.strip() for line in f | ||
| if line.strip() and not line.startswith("#") | ||
| ] | ||
| metafunc.parametrize("config_filename", configs) | ||
| return | ||
| # Otherwise, check --config-list-file | ||
| rel_path = metafunc.config.getoption("--config-list-file") | ||
| config_list_file = Path(rel_path).resolve() | ||
| config_dir = config_list_file.parent | ||
| with open(config_list_file, encoding="utf-8") as f: | ||
| configs = [ | ||
| config_dir / line.strip() for line in f | ||
| if line.strip() and not line.startswith("#") | ||
| ] | ||
| metafunc.parametrize("config_filename", configs) | ||
| single_config = metafunc.config.getoption("--config") | ||
| config_path = Path(single_config).resolve() | ||
|
|
||
| metafunc.parametrize("config_filename", [config_path]) | ||
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.
it's better to keep current path,
./, otherwise the./benchmarks/accuracyis required.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.
The code has ensured the creation of the ./benchmarks/accuracy directory: https://github.com/vllm-project/vllm-ascend/blob/main/tests/e2e/singlecard/models/test_lm_eval_correctness.py#L88