Skip to content

Commit fd34624

Browse files
authored
Support mlperf inference submission tar file generation (#267)
* Fix the mlperf inference submission command to include only the submission sub_dirs
1 parent 5df666a commit fd34624

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

script/run-mlperf-inference-submission-checker/meta.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ post_deps:
8080
tags: run,tar
8181
env:
8282
MLC_TAR_INPUT_DIR: <<<MLC_MLPERF_INFERENCE_SUBMISSION_DIR>>>
83+
MLC_TAR_SUB_FOLDERS_TO_INCLUDE: closed,open,network
84+
COPYFILE_DISABLE: 1
8385
- enable_if_env:
8486
MLC_MLPERF_SUBMITTER_ID:
8587
- 'yes'

script/tar-my-folder/customize.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,24 @@ def preprocess(i):
2121
env['MLC_TAR_OUTFILE'] = output_file
2222
from pathlib import Path
2323
input_path = Path(input_dir)
24-
cd_dir = input_path.parent.absolute()
25-
CMD = 'tar --directory ' + \
26-
str(cd_dir) + ' -czf ' + os.path.join(output_dir,
27-
output_file) + ' ' + input_dirname
24+
sub_folders_to_include = env.get('MLC_TAR_SUB_FOLDERS_TO_INCLUDE', '')
25+
if sub_folders_to_include != '':
26+
cd_dir = input_path.absolute()
27+
r = sub_folders_to_include.split(",")
28+
v_sub_folders = []
29+
for sub_folder in r:
30+
f = sub_folder.strip()
31+
if os.path.exists(os.path.join(input_path, f)):
32+
v_sub_folders.append(f)
33+
CMD = 'tar --directory ' + \
34+
str(cd_dir) + ' -czf ' + os.path.join(output_dir,
35+
output_file) + ' ' + ' '.join(v_sub_folders)
36+
else:
37+
cd_dir = input_path.parent.absolute()
38+
CMD = 'tar --directory ' + \
39+
str(cd_dir) + ' -czf ' + os.path.join(output_dir,
40+
output_file) + ' ' + input_dirname
41+
2842
print(CMD)
2943
ret = os.system(CMD)
3044
print("Tar file " + os.path.join(output_dir, output_file) + " created")

script/tar-my-folder/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ input_mapping:
99
input_dir: MLC_TAR_INPUT_DIR
1010
outfile: MLC_TAR_OUTFILE
1111
output_dir: MLC_TAR_OUTPUT_DIR
12+
sub_folders_to_include: MLC_TAR_SUB_FOLDERS_TO_INCLUDE
1213
new_env_keys:
1314
- MLC_TAR_OUTFILE
1415
tags:

0 commit comments

Comments
 (0)