diff --git a/cm-mlops/script/app-loadgen-generic-python/_cm.yaml b/cm-mlops/script/app-loadgen-generic-python/_cm.yaml index 913814e3bd..6feb46f271 100644 --- a/cm-mlops/script/app-loadgen-generic-python/_cm.yaml +++ b/cm-mlops/script/app-loadgen-generic-python/_cm.yaml @@ -31,6 +31,7 @@ input_mapping: modelpath: CM_ML_MODEL_FILE_WITH_PATH modelcodepath: CM_ML_MODEL_CODE_WITH_PATH modelcfgpath: CM_ML_MODEL_CFG_WITH_PATH + modelcfg: CM_ML_MODEL_CFG modelsamplepath: CM_ML_MODEL_SAMPLE_WITH_PATH output_dir: CM_MLPERF_OUTPUT_DIR scenario: CM_MLPERF_LOADGEN_SCENARIO diff --git a/cm-mlops/script/app-loadgen-generic-python/customize.py b/cm-mlops/script/app-loadgen-generic-python/customize.py index 5ac7b57cbb..9e15f45a08 100644 --- a/cm-mlops/script/app-loadgen-generic-python/customize.py +++ b/cm-mlops/script/app-loadgen-generic-python/customize.py @@ -10,6 +10,7 @@ def preprocess(i): env = i['env'] + if 'CM_ML_MODEL_FILE_WITH_PATH' not in env: return {'return': 1, 'error': 'Please select a variation specifying the model to run'} @@ -51,8 +52,27 @@ def preprocess(i): if env.get('CM_ML_MODEL_CODE_WITH_PATH', '') != '': run_opts +=" --model_code "+env['CM_ML_MODEL_CODE_WITH_PATH'] + if env.get('CM_ML_MODEL_CFG_WITH_PATH', '') != '': run_opts +=" --model_cfg "+env['CM_ML_MODEL_CFG_WITH_PATH'] + else: + # Check cfg from command line + cfg = env.get('CM_ML_MODEL_CFG', {}) + if len(cfg)>0: + del (env['CM_ML_MODEL_CFG']) + + import json, tempfile + tfile = tempfile.NamedTemporaryFile(mode="w+", suffix='.json') + + fd, tfile = tempfile.mkstemp(suffix='.json', prefix='cm-cfg-') + os.close(fd) + + with open(tfile, 'w') as fd: + json.dump(cfg, fd) + + env['CM_APP_LOADGEN_GENERIC_PYTHON_TMP_CFG_FILE'] = tfile + + run_opts +=" --model_cfg " + tfile if env.get('CM_ML_MODEL_SAMPLE_WITH_PATH', '') != '': run_opts +=" --model_sample_pickle "+env['CM_ML_MODEL_SAMPLE_WITH_PATH'] @@ -72,4 +92,10 @@ def preprocess(i): def postprocess(i): env = i['env'] + + tfile = env.get('CM_APP_LOADGEN_GENERIC_PYTHON_TMP_CFG_FILE', '') + + if tfile!='' and os.path.isfile(tfile): + os.remove(tfile) + return {'return':0} diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/_common.bat b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/_common.bat similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/_common.bat rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/_common.bat diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/_common.sh b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/_common.sh similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/_common.sh rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/_common.sh diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/build.bat b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/build.bat similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/build.bat rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/build.bat diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/build.sh b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/build.sh similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/build.sh rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/build.sh diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/loadgen-generic-python--ubuntu-cpu.Dockerfile b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/loadgen-generic-python--ubuntu-cpu.Dockerfile similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/loadgen-generic-python--ubuntu-cpu.Dockerfile rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/loadgen-generic-python--ubuntu-cpu.Dockerfile diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/loadgen-generic-python-auto.Dockerfile b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/loadgen-generic-python-auto.Dockerfile similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/loadgen-generic-python-auto.Dockerfile rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/loadgen-generic-python-auto.Dockerfile diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/run.bat b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/run.bat similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/run.bat rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/run.bat diff --git a/cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/run.sh b/cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/run.sh similarity index 100% rename from cm-mlops/script/app-loadgen-generic-python/modular-cm-containers/run.sh rename to cm-mlops/script/app-loadgen-generic-python/tests/modular-cm-containers/run.sh