From 54ae9118295011f24a4c1780403e50b30c0828d4 Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 24 Sep 2024 16:37:14 +0530 Subject: [PATCH 1/3] changes for custom sample id generation - SDXL --- script/app-mlperf-inference-mlcommons-python/customize.py | 2 ++ script/get-dataset-coco2014/_cm.yaml | 1 + script/get-dataset-coco2014/customize.py | 3 +++ script/get-dataset-coco2014/run.sh | 3 +++ 4 files changed, 9 insertions(+) diff --git a/script/app-mlperf-inference-mlcommons-python/customize.py b/script/app-mlperf-inference-mlcommons-python/customize.py index d6b1222b0..9d0a64955 100644 --- a/script/app-mlperf-inference-mlcommons-python/customize.py +++ b/script/app-mlperf-inference-mlcommons-python/customize.py @@ -296,6 +296,8 @@ def get_run_cmd_reference(os_info, env, scenario_extra_options, mode_extra_optio scenario_extra_options + mode_extra_options + \ " --output " + env['CM_MLPERF_OUTPUT_DIR'] + \ " --model-path " + env['CM_ML_MODEL_PATH'] + if env.get('CM_COCO2014_SAMPLE_ID_PATH','') != '': + cmd += " --ids-path " + env['CM_COCO2014_SAMPLE_ID_PATH'] elif "llama2-70b" in env['CM_MODEL']: env['RUN_DIR'] = os.path.join(env['CM_MLPERF_INFERENCE_SOURCE'], "language", "llama2-70b") diff --git a/script/get-dataset-coco2014/_cm.yaml b/script/get-dataset-coco2014/_cm.yaml index 690e0926a..aba9b2ea0 100644 --- a/script/get-dataset-coco2014/_cm.yaml +++ b/script/get-dataset-coco2014/_cm.yaml @@ -45,6 +45,7 @@ new_env_keys: - CM_DATASET_ANNOTATIONS_DIR_PATH - CM_DATASET_ANNOTATIONS_FILE_PATH - CM_CALIBRATION_DATASET_PATH +- CM_COCO2014_SAMPLE_ID_PATH posthook_deps: - enable_if_env: diff --git a/script/get-dataset-coco2014/customize.py b/script/get-dataset-coco2014/customize.py index b6984bca1..a38f336bc 100644 --- a/script/get-dataset-coco2014/customize.py +++ b/script/get-dataset-coco2014/customize.py @@ -16,6 +16,9 @@ def preprocess(i): def postprocess(i): env = i['env'] + if env.get('CM_GENERATE_SAMPLE_ID', '') == "yes": + env['CM_COCO2014_SAMPLE_ID_PATH'] = os.path.join(os.getcwd(), 'install', 'sample_ids.txt') + print(env['CM_COCO2014_SAMPLE_ID_PATH']) if env.get('CM_DATASET_CALIBRATION','') == "no": env['CM_DATASET_PATH_ROOT'] = os.path.join(os.getcwd(), 'install') #env['CM_DATASET_PATH'] = os.path.join(os.getcwd(), 'install', 'validation', 'data') diff --git a/script/get-dataset-coco2014/run.sh b/script/get-dataset-coco2014/run.sh index f37ba603b..0324ea162 100644 --- a/script/get-dataset-coco2014/run.sh +++ b/script/get-dataset-coco2014/run.sh @@ -33,6 +33,9 @@ else eval $cmd test $? -eq 0 || exit 1 fi +if [[ ${CM_GENERATE_COCO2014_SAMPLE_ID} == "yes" ]]; then + cmd="python3 sample_ids.py --tsv-path ${INSTALL_DIR}" +fi cd ${INSTALL_DIR} test $? -eq 0 || exit 1 From dc9bf9948bfb888d66167da48a0162a356de1f03 Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 24 Sep 2024 16:37:46 +0530 Subject: [PATCH 2/3] changes for custom sample id generation - SDXL --- script/run-mlperf-inference-app/_cm.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/run-mlperf-inference-app/_cm.yaml b/script/run-mlperf-inference-app/_cm.yaml index 984752102..2d6adfd8b 100644 --- a/script/run-mlperf-inference-app/_cm.yaml +++ b/script/run-mlperf-inference-app/_cm.yaml @@ -246,11 +246,15 @@ variations: adr: coco2014-preprocessed: tags: _size.50 + env: + CM_GENERATE_SAMPLE_ID: 'yes' scc24-main: adr: coco2014-preprocessed: tags: _size.500 + env: + CM_GENERATE_SAMPLE_ID: 'yes' r2.1: env: From d8a33bca6414df42876565a2c7bf0f66c799fd9c Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 24 Sep 2024 11:54:07 +0000 Subject: [PATCH 3/3] fixed bug --- script/get-dataset-coco2014/run.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/get-dataset-coco2014/run.sh b/script/get-dataset-coco2014/run.sh index 0324ea162..9668e3abd 100644 --- a/script/get-dataset-coco2014/run.sh +++ b/script/get-dataset-coco2014/run.sh @@ -33,8 +33,11 @@ else eval $cmd test $? -eq 0 || exit 1 fi -if [[ ${CM_GENERATE_COCO2014_SAMPLE_ID} == "yes" ]]; then - cmd="python3 sample_ids.py --tsv-path ${INSTALL_DIR}" +if [[ ${CM_GENERATE_SAMPLE_ID} == "yes" ]]; then + cmd="python3 sample_ids.py --tsv-path ${INSTALL_DIR}/captions/captions.tsv --output-path ${INSTALL_DIR}/sample_ids.txt" + echo $cmd + eval $cmd + test $? -eq 0 || exit 1 fi cd ${INSTALL_DIR}