Skip to content

Commit 9a1f0fa

Browse files
authored
Merge pull request #440 from mlcommons/dev
Sync Dev
2 parents 5858805 + 8b19450 commit 9a1f0fa

File tree

114 files changed

+4748
-883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4748
-883
lines changed

.github/scripts/list_modified_files.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ def get_file_info(filepath):
88
with open(filepath, 'r') as file:
99
content = yaml.safe_load(file)
1010
tests = content.get('tests', [])
11-
if tests:
11+
needs_pat = content.get('needs_pat', False)
12+
if tests and not needs_pat:
1213
num_tests = len(tests.get('run_inputs', []))
1314
else:
1415
num_tests = 0
@@ -17,7 +18,7 @@ def get_file_info(filepath):
1718

1819

1920
def process_files(files):
20-
filenames = files.split()
21+
filenames = files.split(",")
2122
return [
2223
{
2324
"file": file,
@@ -34,4 +35,4 @@ def process_files(files):
3435
changed_files = sys.stdin.read().strip()
3536
processed_files = process_files(changed_files)
3637
json_processed_files = json.dumps(processed_files)
37-
print(f"::set-output name=processed_files::{json_processed_files}")
38+
print(json_processed_files)

.github/workflows/build_wheels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
types: [published]
66
workflow_dispatch: {}
77

8+
89
jobs:
910
build_wheels:
1011
if: github.repository_owner == 'mlcommons'

.github/workflows/run-tests-on-modified-meta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: |
3434
git remote add upstream ${{ github.event.pull_request.base.repo.clone_url }}
3535
git fetch upstream
36-
changed_files=$(git diff upstream/${{ github.event.pull_request.base.ref }} --name-only)
36+
changed_files=$(git diff upstream/${{ github.event.pull_request.base.ref }} --name-only | paste -sd, -)
3737
echo "$changed_files" | python3 .github/scripts/list_modified_files.py
3838
3939
process_modified_files:

.github/workflows/test-mlc-script-features.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,15 @@ jobs:
5050
mlcr get,wkhtmltopdf --quiet
5151
5252
- name: Test versions
53-
continue-on-error: true
54-
if: runner.os == 'linux'
53+
if: runner.os == 'linux' && matrix.python-version == '3.8'
5554
run: |
5655
mlcr get,generic-python-lib,_package.scipy --version=1.9.3 --quiet
5756
test $? -eq 0 || exit $?
5857
mlcr get,generic-python-lib,_package.scipy --version=1.9.2 --quiet
5958
test $? -eq 0 || exit $?
60-
mlc find cache --tags=get,generic-python-lib,_package.scipy,version-1.9.3
59+
mlc find cache --tags=get,generic-python-lib,_package.scipy,version-1.9.2
6160
test $? -eq 0 || exit $?
62-
# Need to add find cache here
63-
# mlcr get,generic-python-lib,_package.scipy --version=1.9.3 --quiet --only_execute_from_cache=True
64-
# test $? -eq 0 || exit 0
61+
6562
6663
- name: Test python install from src
6764
run: |
@@ -94,6 +91,34 @@ jobs:
9491
run: |
9592
mlcr run,docker,container --adr.compiler.tags=gcc --docker_mlc_repo=mlcommons@mlperf-automations --docker_mlc_repo_branch=dev --image_name=mlc-script-app-image-classification-onnx-py --env.MLC_DOCKER_RUN_SCRIPT_TAGS=app,image-classification,onnx,python --env.MLC_DOCKER_IMAGE_BASE=ubuntu:22.04 --env.MLC_DOCKER_IMAGE_REPO=local --quiet
9693
94+
test_experiment:
95+
runs-on: ${{ matrix.os }}
96+
strategy:
97+
fail-fast: false
98+
matrix:
99+
python-version: ["3.12", "3.8"]
100+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
- name: Set up Python ${{ matrix.python-version }}
105+
uses: actions/setup-python@v3
106+
with:
107+
python-version: ${{ matrix.python-version }}
108+
- name: Configure git longpaths (Windows)
109+
if: matrix.os == 'windows-latest'
110+
run: |
111+
git config --system core.longpaths true
112+
- name: Pull MLOps repository
113+
run: |
114+
pip install mlcflow
115+
mlc pull repo ${{ github.event.pull_request.head.repo.html_url }} --branch=${{ github.event.pull_request.head.ref }}
116+
117+
- name: Test mlc experiment script
118+
run: |
119+
mlc experiment script --tags=detect,os --quiet --exp.repeat,=1,2,3
120+
mlc experiment script --tags=detect,cpu --quiet --exp.explore=2:10:2
121+
97122
test_mlperf_retinanet_cpp_venv:
98123
runs-on: ubuntu-latest
99124
strategy:
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test MLPerf automotive
2+
3+
on:
4+
pull_request_target:
5+
branches: [ "main", "dev" ]
6+
paths:
7+
- 'script/**meta.yaml'
8+
9+
jobs:
10+
fetch-secret:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
gdrive_secret: ${{ steps.op-load-secret.outputs.GDRIVE_SERVICE_ACCOUNT_KEY }}
14+
steps:
15+
- name: Load secret from 1Password
16+
id: op-load-secret
17+
uses: 1password/load-secrets-action@v2
18+
with:
19+
export-env: false
20+
env:
21+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
22+
GDRIVE_SERVICE_ACCOUNT_KEY: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential
23+
24+
run-mlperf:
25+
runs-on: ubuntu-latest
26+
needs:
27+
- fetch-secret
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 2
33+
- name: Set RCLONE Service account env var from secret
34+
shell: bash
35+
run: |
36+
echo "::add-mask::${{ needs.fetch-secret.outputs.gdrive_secret }}"
37+
echo "RCLONE_CONFIG_MLC_COGNATA_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV
38+
echo "RCLONE_CONFIG_MLC_NUSCENES_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV
39+
- name: Run MLPerf
40+
run: |
41+
pip install mlcflow
42+
mlc pull repo ${{ github.event.pull_request.head.repo.html_url }} --branch=${{ github.event.pull_request.head.ref }}
43+
mlc test script app,mlperf,automotive

automation/script/docker.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def dockerfile(self_module, input_params):
3636
state_data = input_params.get('state', {})
3737
constant_vars = input_params.get('const', {})
3838
constant_state = input_params.get('const_state', {})
39-
dockerfile_env = input_params.get('dockerfile_env', {})
4039
tag_values = input_params.get('tags', '').split(",")
4140
variation_tags = [tag[1:] for tag in tag_values if tag.startswith("_")]
4241

@@ -56,7 +55,6 @@ def dockerfile(self_module, input_params):
5655
'script_variation_tags': variation_tags
5756
}
5857
docker_settings = metadata.get('docker', {})
59-
docker_settings['dockerfile_env'] = dockerfile_env
6058
state_data['docker'] = docker_settings
6159
add_deps_recursive = input_params.get('add_deps_recursive', {})
6260

@@ -94,8 +92,6 @@ def dockerfile(self_module, input_params):
9492

9593
# Set Docker-specific configurations
9694
docker_settings = state_data['docker']
97-
docker_settings['dockerfile_env'] = dockerfile_env
98-
dockerfile_env['MLC_RUN_STATE_DOCKER'] = True
9995

10096
if not docker_settings.get('run', True) and not input_params.get(
10197
'docker_run_override', False):
@@ -171,13 +167,18 @@ def dockerfile(self_module, input_params):
171167
if input_params.get('docker_push_image') in [True, 'True', 'yes']:
172168
env['MLC_DOCKER_PUSH_IMAGE'] = 'yes'
173169

170+
dockerfile_env = docker_inputs.get('env', {})
171+
dockerfile_build_env = docker_inputs.get('build_env', {})
172+
173+
dockerfile_env['MLC_RUN_STATE_DOCKER'] = True
174174
# Generate Dockerfile
175175
mlc_docker_input = {
176176
'action': 'run', 'automation': 'script', 'tags': 'build,dockerfile',
177177
'fake_run_option': " " if docker_inputs.get('real_run') else " --fake_run",
178178
'comments': comments, 'run_cmd': f"{run_command_string} --quiet",
179179
'script_tags': input_params.get('tags'), 'env': env,
180180
'dockerfile_env': dockerfile_env,
181+
'dockerfile_build_env': dockerfile_build_env,
181182
'quiet': True, 'real_run': True
182183
}
183184

@@ -377,6 +378,9 @@ def docker_run(self_module, i):
377378
env.update({docker_input_mapping[key]: i[key]
378379
for key in docker_input_mapping if key in i})
379380

381+
if docker_inputs.get('user'):
382+
docker_settings['user'] = docker_inputs['user']
383+
380384
# Handle environment variable-based mounts
381385
res = process_mounts(
382386
mounts,
@@ -412,6 +416,7 @@ def docker_run(self_module, i):
412416
'quiet': True, 'real_run': True, 'add_deps_recursive': {'build-docker-image': {'dockerfile': dockerfile_path}},
413417
**docker_inputs
414418
}
419+
415420
r = self_module.action_object.access(mlc_docker_input)
416421
if r['return'] > 0:
417422
return r

automation/script/docker_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def prepare_docker_inputs(input_params, docker_settings,
134134
keys = [
135135
"mlc_repo", "mlc_repo_branch", "base_image", "os", "os_version",
136136
"mlc_repos", "skip_mlc_sys_upgrade", "extra_sys_deps", "image_name",
137-
"gh_token", "fake_run_deps", "run_final_cmds", "real_run", "copy_files", "path", "user"
137+
"gh_token", "fake_run_deps", "run_final_cmds", "real_run", "copy_files", "path", "user", "env", "build_env"
138138
]
139139

140140
if run_stage:
@@ -452,7 +452,10 @@ def get_container_path(value, username="mlcuser", extract_parent_folder=False):
452452

453453
new_value = ''
454454
if "cache" in path_split and "local" in path_split:
455-
new_path_split = ["", "home", username, "MLC", "repos"]
455+
if username == "root":
456+
new_path_split = ["", "root", "MLC", "repos"]
457+
else:
458+
new_path_split = ["", "home", username, "MLC", "repos"]
456459
repo_entry_index = path_split.index("local")
457460
if len(path_split) >= repo_entry_index + 3:
458461
new_path_split1 = new_path_split + \

0 commit comments

Comments
 (0)