Skip to content

Commit

Permalink
Merge from GO (#201)
Browse files Browse the repository at this point in the history
* Update flow.md

* Download imagenet dataset to host by default

* Added template script for MLC
  • Loading branch information
arjunsuresh authored Feb 8, 2025
1 parent dce8947 commit b04b084
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 2 deletions.
8 changes: 6 additions & 2 deletions flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
```mermaid
flowchart TD
A[MLC interface] --> B{Script Automation}
A[MLC interface] --> C{Cache Automation}
B[Script Automation] --> C{Cache Automation}
A[MLC interface] --> C{Cache Action}
B[Script Automation] --> C{Cache Action}
A[MLC interface] --> E{Docker Action}
B[Script Automation] --> E{Docker Action}
A[MLC interface] --> F{Test Action}
B[Script Automation] --> F{Test Action}
B[Script Automation] --> D{MLPerf Scripts}
```
2 changes: 2 additions & 0 deletions script/app-mlperf-inference/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ variations:
model
default:
true
default_env:
MLC_USE_DATASET_FROM_HOST: yes
env:
MLC_MODEL:
resnet50
Expand Down
9 changes: 9 additions & 0 deletions script/template-script/COPYRIGHT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright Notice

© 2022-2025 MLCommons. All Rights Reserved.

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:

[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)

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.
23 changes: 23 additions & 0 deletions script/template-script/customize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from mlc import utils
import os
import subprocess


def preprocess(i):

env = i['env']
state = i['state']

os_info = i['os_info']

return {'return': 0}


def postprocess(i):

env = i['env']
state = i['state']

os_info = i['os_info']

return {'return': 0}
24 changes: 24 additions & 0 deletions script/template-script/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
alias: template-script
automation_alias: script
automation_uid: 5b4e0237da074764

category: MLC Script Template

# 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
new_env_keys: []
new_state_keys: []

# Deps are executed first before the preprocess function inside customize.py
deps: []
# Prehook deps are executed after the preprocess function inside customize.py but before the run script
prehook_deps: []
# Posthook deps are executed after the run script but before the postprocess function inside customize.py
posthook_deps: []
# Post deps are executed after the postprocess function inside customize.py
post_deps: []

tags:
- generic
- template

uid: fc3e6915a29342d8
23 changes: 23 additions & 0 deletions script/template-script/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@echo off
setlocal enabledelayedexpansion

:: Function to exit if the last command failed
:exit_if_error
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
exit /b 0

:: Function to run a command
:run
echo Running:
echo %1
echo.

if /I "%MLC_FAKE_RUN%" NEQ "yes" (
call %1
call :exit_if_error
)
exit /b 0

:: Add your run commands here...
:: call :run "%MLC_RUN_CMD%"

17 changes: 17 additions & 0 deletions script/template-script/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
function exit_if_error() {
test $? -eq 0 || exit $?
}

function run() {
echo "Running: "
echo "$1"
echo ""
if [[ ${MLC_FAKE_RUN} != 'yes' ]]; then
eval "$1"
exit_if_error
fi
}

#Add your run commands here...
# run "$MLC_RUN_CMD"

0 comments on commit b04b084

Please sign in to comment.