-
Notifications
You must be signed in to change notification settings - Fork 639
Update endpoints structure #2630
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
base: master
Are you sure you want to change the base?
Changes from all commits
50d4a29
7d8ae1a
5ae81f7
eaa98a7
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 |
|---|---|---|
|
|
@@ -24,7 +24,9 @@ | |
| "sample_logs") | ||
|
|
||
| _RESULT_SUMMARY_FILE = "results_summary.json" | ||
| _RESULTS_FILE = "results.json" | ||
| _ACCURACY_RESULTS_FILE = "accuracy_results.json" | ||
| _PERF_SUBDIR = os.path.join("performance", "run_1") | ||
| _ACC_SUBDIR = "accuracy" | ||
| _CONFIG_FILES = ("config.yaml", "config.yml") | ||
|
|
||
|
|
||
|
|
@@ -94,22 +96,23 @@ def _resolve_value(stripped, summary_data, results_data, yaml_data): | |
|
|
||
|
|
||
| class EndpointsParser(BaseParser): | ||
| def __init__(self, run_dir): | ||
| def __init__(self, scenario_dir): | ||
| """ | ||
| run_dir: path to the run directory containing: | ||
| - result_summary.json (highest priority) | ||
| - results.json | ||
| - config.yaml / config.yml (lowest priority) | ||
| scenario_dir: path to the scenario directory containing: | ||
| - config.yaml (scenario root) | ||
| - performance/run_1/results_summary.json (performance metrics) | ||
|
Contributor
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. It will not have run_1 folder in endpoints
Contributor
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. cc: @zihaok
Contributor
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. correct, run_1 is not needed |
||
| - accuracy/accuracy_results.json (accuracy metrics) | ||
| """ | ||
| super().__init__(run_dir) | ||
| super().__init__(scenario_dir) | ||
|
|
||
| self.logger = logging.getLogger("MLPerfLog") | ||
| self.messages = {} | ||
|
|
||
| summary_data = self._load_json( | ||
| os.path.join(run_dir, _RESULT_SUMMARY_FILE)) | ||
| results_data = self._load_json(os.path.join(run_dir, _RESULTS_FILE)) | ||
| yaml_data = self._load_yaml(run_dir) | ||
| os.path.join(scenario_dir, _PERF_SUBDIR, _RESULT_SUMMARY_FILE)) | ||
| results_data = self._load_json( | ||
| os.path.join(scenario_dir, _ACC_SUBDIR, _ACCURACY_RESULTS_FILE)) | ||
| yaml_data = self._load_yaml(scenario_dir) | ||
|
|
||
| for endpoints_key, loadgen_key in ENDPOINTS_MAPPINGS.items(): | ||
| stripped = endpoints_key.strip() | ||
|
|
@@ -153,7 +156,9 @@ def __init__(self, run_dir): | |
| ) | ||
|
|
||
| self.keys = set(self.messages.keys()) | ||
| self.logger.info("Successfully loaded endpoints log from %s.", run_dir) | ||
| self.logger.info( | ||
| "Successfully loaded endpoints log from %s.", | ||
| scenario_dir) | ||
|
|
||
| def _load_json(self, path): | ||
| try: | ||
|
|
@@ -162,7 +167,6 @@ def _load_json(self, path): | |
| except BaseException: | ||
| self.logger.error("Could not load json file from %s", path) | ||
| return {} | ||
| return {} | ||
|
|
||
| def _load_yaml(self, run_dir): | ||
| for name in _CONFIG_FILES: | ||
|
|
@@ -212,18 +216,20 @@ def main(): | |
|
|
||
| backwards_map = _load_field_map("backwards.json") | ||
|
|
||
| # Collect all run directories (those containing at least one JSON and one | ||
| # YAML) | ||
| # Collect scenario-level directories (those containing config.yaml and | ||
| # the performance/run_1 subdirectory with results_summary.json) | ||
| run_dirs = [] | ||
| for root, _dirs, files in os.walk(_SAMPLE_LOGS_DIR): | ||
| has_json = any(f.endswith(".json") for f in files) | ||
| has_yaml = any(f.endswith(".yaml") or f.endswith(".yml") | ||
| for f in files) | ||
| if has_json and has_yaml: | ||
| for root, dirs, files in os.walk(_SAMPLE_LOGS_DIR): | ||
| has_yaml = any(f in _CONFIG_FILES for f in files) | ||
| has_perf = os.path.exists( | ||
| os.path.join(root, _PERF_SUBDIR, _RESULT_SUMMARY_FILE)) | ||
| if has_yaml and has_perf: | ||
| run_dirs.append(root) | ||
|
|
||
| if not run_dirs: | ||
| logger.error("No run directories found under %s.", _SAMPLE_LOGS_DIR) | ||
| logger.error( | ||
| "No scenario directories found under %s.", | ||
| _SAMPLE_LOGS_DIR) | ||
| return 1 | ||
|
|
||
| for run_dir in sorted(run_dirs): | ||
|
|
||
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.
this should be result_summary.json instead of results_summary.json https://github.com/mlcommons/endpoints/blob/bf9d12b105a833c1bfeb3365efce091b6bc93a15/src/inference_endpoint/commands/benchmark/execute.py#L1565