Skip to content

Refactored pointpainting model download script #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def get_run_cmd_reference(
cmd = env['MLC_PYTHON_BIN_WITH_PATH'] + " main.py " \
" --dataset waymo" + \
" --dataset-path " + env['MLC_DATASET_WAYMO_PATH'] + \
" --lidar-path " + env['MLC_ML_MODEL_POINT_PILLARS_PATH'] + \
" --lidar-path " + env['MLC_ML_MODEL_POINT_PAINTING_PATH'] + \
" --segmentor-path " + env['MLC_ML_MODEL_DPLAB_RESNET50_PATH'] + \
" --scenario " + env['MLC_MLPERF_LOADGEN_SCENARIO'] + \
" --output " + env['MLC_MLPERF_OUTPUT_DIR'] + \
Expand Down
13 changes: 2 additions & 11 deletions script/app-mlperf-inference-mlcommons-python/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ input_mapping:
multistream_target_latency: MLC_MLPERF_LOADGEN_MULTISTREAM_TARGET_LATENCY
network: MLC_NETWORK_LOADGEN
sut_servers: MLC_NETWORK_LOADGEN_SUT_SERVERS
pointpillars_checkpoint_path: MLC_ML_MODEL_POINT_PILLARS_PATH
pointpainting_checkpoint_path: MLC_ML_MODEL_POINT_PAINTING_PATH
deeplab_resnet50_path: MLC_ML_MODEL_DPLAB_RESNET50_PATH
waymo_path: MLC_DATASET_WAYMO_PATH

Expand Down Expand Up @@ -505,7 +505,7 @@ deps:
- "yes"

## pointpainting
- tags: get,ml-model,pointpillars
- tags: get,ml-model,pointpainting
names:
- pointpillars-model
enable_if_env:
Expand All @@ -514,15 +514,6 @@ deps:
skip_if_env:
MLC_RUN_STATE_DOCKER:
- "yes"
- tags: get,ml-model,resnet50-deeplab
enable_if_env:
MLC_MODEL:
- pointpainting
skip_if_env:
MLC_RUN_STATE_DOCKER:
- "yes"
names:
- resnet50-deeplab-model

########################################################################
# Install datasets
Expand Down
12 changes: 3 additions & 9 deletions script/app-mlperf-inference/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -846,18 +846,12 @@ variations:
- 'yes'
names:
- waymo-dataset
- tags: get,ml-model,pointpillars
- tags: get,ml-model,pointpainting
enable_if_env:
MLC_USE_DATASET_FROM_HOST:
- 'yes'
names:
- pointpillars-model
- tags: get,ml-model,resnet50-deeplab
enable_if_env:
MLC_USE_DATASET_FROM_HOST:
- 'yes'
names:
- resnet50-deeplab-model
- pointpainting-model
posthook_deps:
- enable_if_env:
MLC_MLPERF_LOADGEN_MODE:
Expand Down Expand Up @@ -1956,7 +1950,7 @@ docker:
- "${{ MLC_DATASET_IGBH_PATH }}:${{ MLC_DATASET_IGBH_PATH }}"
- "${{ MLC_ML_MODEL_RGAT_CHECKPOINT_PATH }}:${{ MLC_ML_MODEL_RGAT_CHECKPOINT_PATH }}"
- "${{ MLC_DATASET_WAYMO_PATH }}:${{ MLC_DATASET_WAYMO_PATH }}"
- "${{ MLC_ML_MODEL_POINT_PILLARS_PATH }}:${{ MLC_ML_MODEL_POINT_PILLARS_PATH }}"
- "${{ MLC_ML_MODEL_POINT_PAINTING_PATH }}:${{ MLC_ML_MODEL_POINT_PAINTING_PATH }}"
- "${{ MLC_ML_MODEL_DPLAB_RESNET50_PATH }}:${{ MLC_ML_MODEL_DPLAB_RESNET50_PATH }}"
skip_run_cmd: 'no'
shm_size: '32gb'
Expand Down
59 changes: 59 additions & 0 deletions script/get-ml-model-pointpainting/customize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from mlc import utils
import os


def preprocess(i):

os_info = i['os_info']

env = i['env']

if os_info['platform'] == "windows":
return {'return': 1, 'error': 'Script not supported in windows yet!'}

if env.get('MLC_ML_MODEL_POINT_PAINTING_PATH', '') != '':
if not os.path.exists(env['MLC_ML_MODEL_POINT_PAINTING']):
return {
'return': 1, 'error': f"Provided model path {env['MLC_ML_MODEL_POINT_PAINTING']} does not exist."}

if env.get('MLC_ML_MODEL_DPLAB_RESNET50_PATH', '') != '':
if not os.path.exists(env['MLC_ML_MODEL_DPLAB_RESNET50_PATH']):
return {
'return': 1, 'error': f"Provided model path {env['MLC_ML_MODEL_DPLAB_RESNET50_PATH']} does not exist."}

if env.get('MLC_ML_MODEL_POINT_PAINTING_PATH', '') == '' or env.get(
'MLC_ML_MODEL_DPLAB_RESNET50_PATH', '') == '':
env['MLC_TMP_REQUIRE_DOWNLOAD'] = "yes"
if env['MLC_DOWNLOAD_SRC'] == "mlcommons":
i['run_script_input']['script_name'] = 'run-rclone'
if env.get('MLC_OUTDIRNAME', '') != '':
env['MLC_ML_MODEL_POINT_PAINTING_TMP_PATH'] = env['MLC_OUTDIRNAME']
else:
env['MLC_ML_MODEL_POINT_PAINTING_TMP_PATH'] = os.path.join(
os.getcwd(), "model")

return {'return': 0}


def postprocess(i):

env = i['env']

if env.get('MLC_ML_MODEL_POINT_PAINTING_PATH', '') == '':
if env['MLC_ML_MODEL_PP_FORMAT'] == "onnx":
env['MLC_ML_MODEL_POINT_PAINTING_PATH'] = os.path.join(
env['MLC_ML_MODEL_POINT_PAINTING_TMP_PATH'], "pp.onnx")
else:
env['MLC_ML_MODEL_POINT_PAINTING_PATH'] = os.path.join(
env['MLC_ML_MODEL_POINT_PAINTING_TMP_PATH'], "pp_ep36.pth")

if env.get('MLC_ML_MODEL_DPLAB_RESNET50_PATH', '') == '':
if env['MLC_ML_MODEL_DPLAB_RESNET50_FORMAT'] == "onnx":
env['MLC_ML_MODEL_DPLAB_RESNET50_PATH'] = os.path.join(
env['MLC_ML_MODEL_POINT_PAINTING_TMP_PATH'], "deeplabv3+.onnx")
else:
env['MLC_ML_MODEL_DPLAB_RESNET50_PATH'] = os.path.join(
env['MLC_ML_MODEL_POINT_PAINTING_TMP_PATH'],
"best_deeplabv3plus_resnet50_waymo_os16.pth")

return {'return': 0}
45 changes: 45 additions & 0 deletions script/get-ml-model-pointpainting/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
alias: get-ml-model-pointpillars
automation_alias: script
automation_uid: 5b4e0237da074764
cache: true
tags:
- get
- ml-model
- ml
- model
- pointpainting
uid: 3562621a8994411d
new_env_keys:
- MLC_ML_MODEL_POINT_PAINTING_PATH
- MLC_ML_MODEL_DPLAB_RESNET50_PATH
input_mapping:
pp_path: MLC_ML_MODEL_POINT_PAINTING_PATH
dp_resnet50_path: MLC_ML_MODEL_DPLAB_RESNET50_PATH
variations:
gpu:
default: true
group: device
env:
MLC_ML_MODEL_PP_FORMAT: pth
MLC_ML_MODEL_DPLAB_RESNET50_FORMAT: pth
cpu:
group: device
env:
MLC_ML_MODEL_PP_FORMAT: onnx
MLC_ML_MODEL_DPLAB_RESNET50_FORMAT: onnx
mlc:
group: download-src
default: true
prehook_deps:
- tags: get,rclone
enable_if_env:
MLC_TMP_REQUIRE_DOWNLOAD:
- yes
- tags: get,rclone-config,_waymo
force_cache: true
enable_if_env:
MLC_TMP_REQUIRE_DOWNLOAD:
- yes
env:
MLC_DOWNLOAD_SRC: mlcommons

4 changes: 4 additions & 0 deletions script/get-ml-model-pointpainting/run-rclone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmd="rclone sync mlc-waymo:waymo_preprocessed_dataset/model ${MLC_ML_MODEL_POINT_PAINTING_TMP_PATH} -P"
echo $cmd
eval $cmd
test $? -eq 0 || exit $?
32 changes: 0 additions & 32 deletions script/get-ml-model-pointpillars/customize.py

This file was deleted.

26 changes: 0 additions & 26 deletions script/get-ml-model-pointpillars/meta.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions script/get-ml-model-resnet50-deeplab/COPYRIGHT.md

This file was deleted.

33 changes: 0 additions & 33 deletions script/get-ml-model-resnet50-deeplab/customize.py

This file was deleted.

27 changes: 0 additions & 27 deletions script/get-ml-model-resnet50-deeplab/meta.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions script/get-ml-model-resnet50-deeplab/run.sh

This file was deleted.

2 changes: 1 addition & 1 deletion script/run-mlperf-inference-app/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ input_mapping:
use_dataset_from_host: MLC_USE_DATASET_FROM_HOST
use_model_from_host: MLC_USE_MODEL_FROM_HOST
rgat_checkpoint_path: RGAT_CHECKPOINT_PATH
pointpillars_checkpoint_path: MLC_ML_MODEL_POINT_PILLARS_PATH
pointpainting_checkpoint_path: MLC_ML_MODEL_POINT_PILLARS_PATH
deeplab_resnet50_path: MLC_ML_MODEL_DPLAB_RESNET50_PATH
waymo_path: MLC_DATASET_WAYMO_PATH
nm_model_zoo_stub: MLC_MLPERF_NEURALMAGIC_MODEL_ZOO_STUB
Expand Down
Loading