Skip to content

Commit f840da4

Browse files
authored
Merge pull request #144 from mlcommons/dev
Stable rev-20240729
2 parents a7ce736 + 03b2964 commit f840da4

File tree

13 files changed

+60
-30
lines changed

13 files changed

+60
-30
lines changed

COPYRIGHT.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
Copyright (c) 2021-2024 MLCommons
22

3-
The cTuning foundation donated this project to MLCommons in 2021 to benefit everyone.
3+
The cTuning foundation and OctoML donated this project to MLCommons to benefit everyone.
4+
5+
Copyright (c) 2014-2021 cTuning foundation

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ and web services adaptable to continuously changing models, data sets, software
2222
We develop and test [CM scripts](script) as a community effort to support the following projects:
2323
* [CM for MLPerf](https://docs.mlcommons.org/inference): modularize and automate MLPerf benchmarks
2424
(maintained by [MLCommons](https://mlcommons.org) and originally developed by [cKnowledge.org](https://cKnowledge.org), [OctoML](https://octoml.ai) and [cTuning.org](https://cTuning.org))
25+
* [Modular C++ harness for MLPerf loadgen](https://github.com/mlcommons/cm4mlops/tree/main/script/app-mlperf-inference-mlcommons-cpp)
26+
* [Modular Python harness for MLPerf loadgen](https://github.com/mlcommons/cm4mlops/tree/main/script/app-loadgen-generic-python)
2527
* [CM for research and education](https://cTuning.org/ae): provide a common interface to automate and reproduce results from research papers
2628
and MLPerf benchmarks (maintained by [cTuning foundation](https://cTuning.org) and [cKnowledge.org](https://cKnowledge.org))
2729
* [CM for ABTF](https://github.com/mlcommons/cm4abtf): provide a unified CM interface to run automotive benchmarks

script/app-mlperf-inference-mlcommons-python/_cm.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ variations:
910910
version: 1.10.1
911911

912912
llama2-70b_:
913+
env:
914+
CM_MLPERF_MODEL_SKIP_BATCHING: false
913915
deps:
914916
- tags: get,generic-python-lib,_package.transformers
915917
names:
@@ -951,7 +953,7 @@ variations:
951953

952954
llama2-70b_,cuda:
953955
default_env:
954-
CM_MLPERF_LOADGEN_BATCH_SIZE: 8
956+
CM_MLPERF_LOADGEN_MAX_BATCHSIZE: 8
955957

956958
llama2-70b-99.9:
957959
group: models

script/app-mlperf-inference-mlcommons-python/customize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def preprocess(i):
5454
else:
5555
env['CM_NUM_THREADS'] = env.get('CM_HOST_CPU_TOTAL_CORES', '1')
5656

57-
if env.get('CM_MLPERF_LOADGEN_MAX_BATCHSIZE','') != '' and not env.get('CM_MLPERF_MODEL_SKIP_BATCHING', False):
57+
if env.get('CM_MLPERF_LOADGEN_MAX_BATCHSIZE','') != '' and str(env.get('CM_MLPERF_MODEL_SKIP_BATCHING', False)).lower() not in [ "true", "1", "yes"] :
5858
env['CM_MLPERF_LOADGEN_EXTRA_OPTIONS'] += " --max-batchsize " + str(env['CM_MLPERF_LOADGEN_MAX_BATCHSIZE'])
5959

6060
if env.get('CM_MLPERF_LOADGEN_BATCH_SIZE','') != '':
@@ -318,6 +318,7 @@ def get_run_cmd_reference(os_info, env, scenario_extra_options, mode_extra_optio
318318
cmd += f" --num-workers {env['CM_MLPERF_INFERENCE_NUM_WORKERS']}"
319319

320320
cmd = cmd.replace("--count", "--total-sample-count")
321+
cmd = cmd.replace("--max-batchsize", "--batch-size")
321322

322323
elif "mixtral-8x7b" in env['CM_MODEL']:
323324
env['RUN_DIR'] = os.path.join(env['CM_MLPERF_INFERENCE_SOURCE'], "language", "mixtral-8x7b")

script/app-mlperf-inference-nvidia/_cm.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ deps:
262262
CM_MLPERF_NVIDIA_HARNESS_RUN_MODE:
263263
- run_harness
264264

265+
- tags: get,generic-python-lib,_package.pycuda
266+
version: "2022.2.2"
267+
265268
- tags: get,generic-python-lib,_package.nvmitten
266269
update_tags_from_env_with_prefix:
267270
_path.:

script/app-mlperf-inference/customize.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def preprocess(i):
3333
run_state = i['run_script_input']['run_state']
3434
state['mlperf-inference-implementation']['script_id'] = run_state['script_id']+":"+",".join(run_state['script_variation_tags'])
3535

36+
if env.get('CM_VLLM_SERVER_MODEL_NAME', '') != '' and env.get('CM_ML_MODEL_FULL_NAME', '') == '':
37+
env['CM_ML_MODEL_FULL_NAME'] = env['CM_VLLM_SERVER_MODEL_NAME'].replace("/", "_")
38+
3639
return {'return':0}
3740

3841
def postprocess(i):
@@ -288,20 +291,20 @@ def postprocess(i):
288291
cmd = ""
289292
xcmd = ""
290293

291-
readme_init = "This experiment is generated using the [MLCommons Collective Mind automation framework (CM)](https://github.com/mlcommons/ck).\n\n"
294+
readme_init = "This experiment is generated using the [MLCommons Collective Mind automation framework (CM)](https://github.com/mlcommons/cm4mlops).\n\n"
292295

293-
readme_init+= "*Check [CM MLPerf docs](https://mlcommons.github.io/inference) for more details.*\n\n"
296+
readme_init+= "*Check [CM MLPerf docs](https://docs.mlcommons.org/inference) for more details.*\n\n"
294297

295298
readme_body = "## Host platform\n\n* OS version: {}\n* CPU version: {}\n* Python version: {}\n* MLCommons CM version: {}\n\n".format(platform.platform(),
296299
platform.processor(), sys.version, cm.__version__)
297300

298301
x = repo_name
299302
if repo_hash!='': x+=' --checkout='+str(repo_hash)
300303

301-
readme_body += "## CM Run Command\n\nSee [CM installation guide](https://github.com/mlcommons/ck/blob/master/docs/installation.md).\n\n"+ \
304+
readme_body += "## CM Run Command\n\nSee [CM installation guide](https://docs.mlcommons.org/inference/install/).\n\n"+ \
302305
"```bash\npip install -U cmind\n\ncm rm cache -f\n\ncm pull repo {}\n\n{}\n```".format(x, xcmd)
303306

304-
readme_body += "\n*Note that if you want to use the [latest automation recipes](https://access.cknowledge.org/playground/?action=scripts) for MLPerf (CM scripts),\n"+ \
307+
readme_body += "\n*Note that if you want to use the [latest automation recipes](https://docs.mlcommons.org/inference) for MLPerf (CM scripts),\n"+ \
305308
" you should simply reload {} without checkout and clean CM cache as follows:*\n\n".format(repo_name) + \
306309
"```bash\ncm rm repo {}\ncm pull repo {}\ncm rm cache -f\n\n```".format(repo_name, repo_name)
307310

@@ -360,7 +363,11 @@ def postprocess(i):
360363
OUTPUT_DIR = os.path.dirname(COMPLIANCE_DIR)
361364

362365
SCRIPT_PATH = os.path.join(env['CM_MLPERF_INFERENCE_SOURCE'], "compliance", "nvidia", test, "run_verification.py")
363-
cmd = env['CM_PYTHON_BIN_WITH_PATH'] + " " + SCRIPT_PATH + " -r " + RESULT_DIR + " -c " + COMPLIANCE_DIR + " -o "+ OUTPUT_DIR
366+
if test == "TEST06":
367+
cmd = f"{env['CM_PYTHON_BIN_WITH_PATH']} {SCRIPT_PATH} -c {COMPLIANCE_DIR} -o {OUTPUT_DIR} --scenario {scenario} --dtype int32"
368+
else:
369+
cmd = f"{env['CM_PYTHON_BIN_WITH_PATH']} {SCRIPT_PATH} -r {RESULT_DIR} -c {COMPLIANCE_DIR} -o {OUTPUT_DIR}"
370+
364371
print(cmd)
365372
os.system(cmd)
366373

@@ -412,12 +419,9 @@ def postprocess(i):
412419
r = automation.run_native_script({'run_script_input':run_script_input, 'env':env, 'script_name':'verify_accuracy'})
413420
if r['return']>0: return r
414421
import submission_checker as checker
415-
is_valid = checker.check_compliance_perf_dir(COMPLIANCE_DIR)
422+
is_valid = checker.check_compliance_perf_dir(COMPLIANCE_DIR) if test != "TEST06" else True
416423
state['cm-mlperf-inference-results'][state['CM_SUT_CONFIG_NAME']][model][scenario][test] = "passed" if is_valid else "failed"
417424

418-
else:
419-
print(test)
420-
421425

422426
if state.get('mlperf-inference-implementation') and state['mlperf-inference-implementation'].get('version_info'):
423427
with open(os.path.join(output_dir, "cm-version-info.json"), "w") as f:

script/build-mlperf-inference-server-nvidia/_cm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ deps:
111111

112112
# Detect pycuda
113113
- tags: get,generic-python-lib,_pycuda
114+
version: "2022.2.2"
114115
skip_if_env:
115116
CM_RUN_STATE_DOCKER:
116117
- 'yes'

script/generate-mlperf-inference-user-conf/customize.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,11 @@ def run_files_exist(mode, OUTPUT_DIR, run_files, env):
403403
test = env['CM_MLPERF_LOADGEN_COMPLIANCE_TEST']
404404

405405
SCRIPT_PATH = os.path.join(env['CM_MLPERF_INFERENCE_SOURCE'], "compliance", "nvidia", test, "run_verification.py")
406-
cmd = env['CM_PYTHON_BIN'] + " " + SCRIPT_PATH + " -r " + RESULT_DIR + " -c " + COMPLIANCE_DIR + " -o "+ OUTPUT_DIR
406+
if test == "TEST06":
407+
cmd = f"{env['CM_PYTHON_BIN_WITH_PATH']} {SCRIPT_PATH} -c {COMPLIANCE_DIR} -o {OUTPUT_DIR} --scenario {scenario} --dtype int32"
408+
else:
409+
cmd = f"{env['CM_PYTHON_BIN_WITH_PATH']} {SCRIPT_PATH} -r {RESULT_DIR} -c {COMPLIANCE_DIR} -o {OUTPUT_DIR}"
410+
407411
print(cmd)
408412
os.system(cmd)
409413

script/get-mlperf-inference-utils/mlperf_utils.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,22 @@ def get_accuracy_metric(config, model, path):
7070
acc_upper_limit = config.get_accuracy_upper_limit(model)
7171
patterns = []
7272
acc_targets = []
73-
acc_limits = []
74-
up_patterns = []
73+
acc_limits = [None] * (len(target)//2)
74+
up_patterns = [None] * (len(target)//2)
7575
acc_types = []
7676

7777
if acc_upper_limit is not None:
7878
acc_limit_check = True
79-
for i in range(0, len(acc_upper_limit), 2):
80-
acc_type, acc_target = acc_upper_limit[i:i+2]
81-
acc_limits.append(acc_target)
82-
up_patterns.append(checker.ACC_PATTERN[acc_type])
79+
80+
for ii in range(0, len(target), 2):
81+
acc_type1,tmp = target[ii:ii+2]
82+
for i in range(0, len(acc_upper_limit), 2):
83+
acc_type, acc_target = acc_upper_limit[i:i+2]
84+
if acc_type != acc_type1:
85+
continue
86+
acc_limits[ii//2] = acc_target
87+
up_patterns[ii//2] = checker.ACC_PATTERN[acc_type]
88+
8389

8490
for i in range(0, len(target), 2):
8591
acc_type, acc_target = target[i:i+2]
@@ -109,6 +115,8 @@ def get_accuracy_metric(config, model, path):
109115
acc = None
110116
if acc_upper_limit is not None:
111117
for i, (pattern, acc_limit) in enumerate(zip(up_patterns, acc_limits)):
118+
if not pattern:
119+
continue
112120
m = re.match(pattern, line)
113121
if m:
114122
acc = m.group(1)
@@ -168,13 +176,13 @@ def get_result_string(version, model, scenario, result_path, has_power, sub_res,
168176
result['power'] = power_result
169177
result['power_efficiency'] = power_efficiency_result
170178

171-
compliance_list = [ "TEST01", "TEST05", "TEST04" ]
179+
compliance_list = [ "TEST01", "TEST05", "TEST04", "TEST06" ]
172180
if division == "closed":
173181
for test in compliance_list:
174182
test_path = os.path.join(result_path, test)
175183
if os.path.exists(test_path): #We dont consider missing test folders now - submission checker will do that
176184
#test_pass = checker.check_compliance_dir(test_path, mlperf_model, scenario, config, "closed", system_json, sub_res)
177-
test_pass = checker.check_compliance_perf_dir(test_path)
185+
test_pass = checker.check_compliance_perf_dir(test_path) if test != "TEST06" else True
178186
if test_pass and test in [ "TEST01", "TEST06" ]:
179187
#test_pass = checker.check_compliance_acc_dir(test_path, mlperf_model, config)
180188
pass # accuracy truncation script is done after submission generation. We assume here that it'll pass
@@ -197,7 +205,7 @@ def get_result_string(version, model, scenario, result_path, has_power, sub_res,
197205
for i, acc in enumerate(acc_results):
198206
accuracy_results.append(str(round(float(acc_results[acc]), 5)))
199207
accuracy_result_string += f"`{acc}`: `{round(float(acc_results[acc]), 5)}`"
200-
if not acc_limits:
208+
if not acc_limits or not acc_limits[i]:
201209
accuracy_result_string += f", Required accuracy for closed division `>= {round(acc_targets[i], 5)}`"
202210
else:
203211
accuracy_result_string += f", Required accuracy for closed division `>= {round(acc_targets[i], 5)}` and `<= {round(acc_limits[i], 5)}`"

script/get-nvidia-mitten/_cm.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"tags": "get,python3"
1818
},
1919
{
20-
"tags": "get,generic-python-lib,_pycuda"
20+
"tags": "get,generic-python-lib,_pycuda",
21+
"version": "2022.2.2"
2122
},
2223
{
2324
"tags": "get,git,_repo.https://github.com/NVIDIA/mitten",

0 commit comments

Comments
 (0)