diff --git a/.github/workflows/mlperf-inference-resnet50.yml b/.github/workflows/mlperf-inference-resnet50.yml index 1a656babb..777e71cca 100644 --- a/.github/workflows/mlperf-inference-resnet50.yml +++ b/.github/workflows/mlperf-inference-resnet50.yml @@ -44,6 +44,7 @@ jobs: - name: Test MLPerf inference ResNet50 on Windows (prebuilt loadgen) if: runner.os == 'Windows' run: | + git config --system core.longpaths true mlc run script --tags=run-mlperf,inference,_submission,_short --submitter="MLCommons" --hw_name=gh_action --model=resnet50 --implementation=${{ matrix.implementation }} --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=100 --target_qps=1 -v --quiet --adr.loadgen.tags=_from-pip --pip_loadgen=yes - name: Test MLPerf inference ResNet50 on Unix systems diff --git a/mlc/main.py b/mlc/main.py index 27e05e337..f38dc1caf 100644 --- a/mlc/main.py +++ b/mlc/main.py @@ -125,6 +125,14 @@ def process_console_output(res, target, action, run_args): log_flag_aliases = {'-v': '--verbose', '-s': '--silent'} log_levels = {'--verbose': logging.DEBUG, '--silent': logging.WARNING} +def convert_hyphen_to_underscore_in_args(): + for i, arg in enumerate(sys.argv): + if arg.startswith("--") and "=" not in arg: + prefix = "--" + rest = arg[2:].replace("-", "_") + a = prefix + rest + sys.argv[i] = a + def build_pre_parser(): pre_parser = argparse.ArgumentParser(add_help=False) @@ -265,6 +273,7 @@ def main(): """ check_raw_arguments_for_non_ascii() + convert_hyphen_to_underscore_in_args() pre_parser = build_pre_parser() pre_args, remaining_args = pre_parser.parse_known_args() diff --git a/mlc/repo_action.py b/mlc/repo_action.py index 7d6908302..4717f144c 100644 --- a/mlc/repo_action.py +++ b/mlc/repo_action.py @@ -143,10 +143,13 @@ def register_repo(self, repo_path, repo_meta): with open(repos_file_path, 'w') as f: json.dump(repos_list, f, indent=2) logger.info(f"Updated repos.json at {repos_file_path}") + + return {'return': 0} def unregister_repo(self, repo_path): repos_file_path = os.path.join(self.repos_path, 'repos.json') + return unregister_repo(repo_path, repos_file_path) @@ -366,6 +369,7 @@ def pull_repo(self, repo_url, branch=None, checkout = None, tag = None, pat = No r = self.register_repo(repo_path, meta_data) if r['return'] > 0: return r + return {"return": 0} except subprocess.CalledProcessError as e: @@ -441,6 +445,7 @@ def pull(self, run_args): if res['return'] > 0: return res + return {'return': 0} @@ -546,6 +551,8 @@ def rm_repo(repo_path, repos_file_path, force_remove): unregister_repo(repo_path, repos_file_path) else: logger.info("rm repo ooperation cancelled by user!") + + else: logger.warning(f"Repo {repo_name} was not found in the repo folder. repos.json will be checked for any corrupted entry. If any, that will be removed.") unregister_repo(repo_path, repos_file_path) @@ -565,5 +572,6 @@ def unregister_repo(repo_path, repos_file_path): logger.info(f"Path: {repo_path} has been removed.") else: logger.info(f"Path: {repo_path} not found in {repos_file_path}. Nothing to be unregistered!") + return {'return': 0} diff --git a/mlc/script_action.py b/mlc/script_action.py index aebe08825..5e2f12eb4 100644 --- a/mlc/script_action.py +++ b/mlc/script_action.py @@ -2,6 +2,8 @@ import os import sys import importlib +import json +from .index import Index from . import utils from .logger import logger @@ -228,8 +230,11 @@ def call_script_module_function(self, function_name, run_args): "repo": "mlcommons@mlperf-automations", "branch": "dev" }) - + if result['return'] == 0: + self.repos = self.load_repos_and_meta() + self.index = Index(self.repos_path, self.repos) + # Try to find the script path again after pulling script_path = self.find_target_folder("script") if not script_path: @@ -267,6 +272,15 @@ def call_script_module_function(self, function_name, run_args): if result['return'] > 0: error = result.get('error', "") raise ScriptExecutionError(f"Script {function_name} execution failed. Error : {error}") + + if str(run_args.get("mlc_output")).lower() in ["on", "true", "yes", "1"]: + with open("tmp-state.json", "w") as f: + json.dump(result['new_state'], f, indent=2) + + with open("tmp-run-env.out", "w") as f: + for key,val in result['new_env'].items(): + f.write(f"""{key}="{val}"\n""") + return result else: logger.info("ScriptAutomation class not found in the script.")