Skip to content

Commit b04b084

Browse files
authored
Merge from GO (#201)
* Update flow.md * Download imagenet dataset to host by default * Added template script for MLC
1 parent dce8947 commit b04b084

File tree

7 files changed

+104
-2
lines changed

7 files changed

+104
-2
lines changed

flow.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
```mermaid
44
flowchart TD
55
A[MLC interface] --> B{Script Automation}
6-
A[MLC interface] --> C{Cache Automation}
7-
B[Script Automation] --> C{Cache Automation}
6+
A[MLC interface] --> C{Cache Action}
7+
B[Script Automation] --> C{Cache Action}
8+
A[MLC interface] --> E{Docker Action}
9+
B[Script Automation] --> E{Docker Action}
10+
A[MLC interface] --> F{Test Action}
11+
B[Script Automation] --> F{Test Action}
812
B[Script Automation] --> D{MLPerf Scripts}
913
```

script/app-mlperf-inference/meta.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ variations:
676676
model
677677
default:
678678
true
679+
default_env:
680+
MLC_USE_DATASET_FROM_HOST: yes
679681
env:
680682
MLC_MODEL:
681683
resnet50

script/template-script/COPYRIGHT.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright Notice
2+
3+
© 2022-2025 MLCommons. All Rights Reserved.
4+
5+
This file is licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License can be obtained at:
6+
7+
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
8+
9+
Unless required by applicable law or agreed to in writing, software distributed under the License is provided on an "AS IS" basis, without warranties or conditions of any kind, either express or implied. Please refer to the License for the specific language governing permissions and limitations under the License.

script/template-script/customize.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from mlc import utils
2+
import os
3+
import subprocess
4+
5+
6+
def preprocess(i):
7+
8+
env = i['env']
9+
state = i['state']
10+
11+
os_info = i['os_info']
12+
13+
return {'return': 0}
14+
15+
16+
def postprocess(i):
17+
18+
env = i['env']
19+
state = i['state']
20+
21+
os_info = i['os_info']
22+
23+
return {'return': 0}

script/template-script/meta.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
alias: template-script
2+
automation_alias: script
3+
automation_uid: 5b4e0237da074764
4+
5+
category: MLC Script Template
6+
7+
# ENV keys matching the regular expression in new_env_keys will be exported by this script to the caller script, similar for new_state_keys too
8+
new_env_keys: []
9+
new_state_keys: []
10+
11+
# Deps are executed first before the preprocess function inside customize.py
12+
deps: []
13+
# Prehook deps are executed after the preprocess function inside customize.py but before the run script
14+
prehook_deps: []
15+
# Posthook deps are executed after the run script but before the postprocess function inside customize.py
16+
posthook_deps: []
17+
# Post deps are executed after the postprocess function inside customize.py
18+
post_deps: []
19+
20+
tags:
21+
- generic
22+
- template
23+
24+
uid: fc3e6915a29342d8

script/template-script/run.bat

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
:: Function to exit if the last command failed
5+
:exit_if_error
6+
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
7+
exit /b 0
8+
9+
:: Function to run a command
10+
:run
11+
echo Running:
12+
echo %1
13+
echo.
14+
15+
if /I "%MLC_FAKE_RUN%" NEQ "yes" (
16+
call %1
17+
call :exit_if_error
18+
)
19+
exit /b 0
20+
21+
:: Add your run commands here...
22+
:: call :run "%MLC_RUN_CMD%"
23+

script/template-script/run.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
function exit_if_error() {
3+
test $? -eq 0 || exit $?
4+
}
5+
6+
function run() {
7+
echo "Running: "
8+
echo "$1"
9+
echo ""
10+
if [[ ${MLC_FAKE_RUN} != 'yes' ]]; then
11+
eval "$1"
12+
exit_if_error
13+
fi
14+
}
15+
16+
#Add your run commands here...
17+
# run "$MLC_RUN_CMD"

0 commit comments

Comments
 (0)