Skip to content

Commit

Permalink
Support mlperf inference llama3.1 model (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsuresh authored Feb 14, 2025
1 parent 33da462 commit a2f0887
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ wheels/
.coverage
htmlcov
*tmp/
*tmp-ck-*/
tmp-*
local/cache/

mlc-log.txt
repos.json
index_script.json
index_cache.json
index_experiment.json
3 changes: 3 additions & 0 deletions script/get-ml-model-llama2/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ variations:
default: true
env:
MLC_DOWNLOAD_SRC: mlcommons
prehook_deps:
- tags: get,rclone-config,_mlperf-llama2
force_cache: yes
hf:
group: download-source
env:
Expand Down
2 changes: 0 additions & 2 deletions script/get-ml-model-llama2/run-rclone.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
rclone config create mlc-llama2 drive config_is_local=false scope=drive.readonly root_folder_id=11tBZvvrh0FCm3XuR5E849K42TqftYdUF
rclone config reconnect mlc-llama2:
cmd="rclone sync mlc-llama2:${MLC_GIT_CHECKOUT_FOLDER} ${LLAMA2_CHECKPOINT_PATH}/${MLC_GIT_CHECKOUT_FOLDER} -P"
echo $cmd
eval $cmd
Expand Down
6 changes: 6 additions & 0 deletions script/get-ml-model-llama3/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ def preprocess(i):
env['MLC_GIT_CHECKOUT_FOLDER'] = os.path.join(
path, env['MLC_ML_MODEL_NAME'])

if env['MLC_DOWNLOAD_SRC'] == "mlcommons":
i['run_script_input']['script_name'] = 'run-rclone'
if env.get('MLC_OUTDIRNAME', '') != '':
env['LLAMA3_CHECKPOINT_PATH'] = env['MLC_OUTDIRNAME']
else:
env['LLAMA3_CHECKPOINT_PATH'] = os.getcwd()
env['MLC_TMP_REQUIRE_DOWNLOAD'] = 'yes'

return {'return': 0}
Expand Down
35 changes: 32 additions & 3 deletions script/get-ml-model-llama3/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ prehook_deps:
- enable_if_env:
MLC_TMP_REQUIRE_DOWNLOAD:
- 'yes'
MLC_DOWNLOAD_SRC:
- huggingface
env: {}
extra_cache_tags: llama3,llama-3
force_env_keys:
Expand All @@ -37,21 +39,48 @@ variations:
MLC_ML_MODEL_PRECISION: fp16
MLC_ML_MODEL_WEIGHT_DATA_TYPES: fp16
group: precision
405b:
group: model-size
default: true
env:
MLC_ML_MODEL_NAME: Llama-3.1-405B-Instruct
8b:
group: model-size
env:
MLC_ML_MODEL_NAME: Llama-3.1-8b-Instruct
mlc:
group: download-src
default: true
prehook_deps:
- tags: get,rclone-config,_mlperf-llama3-1
force_cache: true
env:
MLC_DOWNLOAD_SRC: mlcommons
hf:
group: download-src
default_variations:
huggingface-stub: meta-llama/Llama-3.1-405B-Instruct
env:
MLC_DOWNLOAD_SRC: huggingface

meta-llama/Llama-3.1-405B-Instruct:
base:
- 405b
adr:
hf-zoo:
tags: _model-stub.meta-llama/Llama-3.1-405B-Instruct
default: true
env:
MLC_ML_MODEL_NAME: Llama-3-405b-instruct
MLC_ML_MODEL_NAME: Llama-3.1-405B-Instruct
MLC_MODEL_ZOO_ENV_KEY: LLAMA3
group: huggingface-stub
meta-llama/Llama-3.1-8B-Instruct:
base:
- 8b
adr:
hf-zoo:
tags: _model-stub.meta-llama/Llama-3.1-8B-Instruct
env:
MLC_ML_MODEL_NAME: Llama-3-8b-instruct
MLC_ML_MODEL_NAME: Llama-3.1-8b-Instruct
MLC_MODEL_ZOO_ENV_KEY: LLAMA3
group: huggingface-stub
vllm:
Expand Down
4 changes: 4 additions & 0 deletions script/get-ml-model-llama3/run-rclone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmd="rclone sync mlc-llama3-1:inference/${MLC_ML_MODEL_NAME} ${LLAMA3_CHECKPOINT_PATH}/${MLC_ML_MODEL_NAME} -P"
echo $cmd
eval $cmd
test $? -eq 0 || exit $?
8 changes: 7 additions & 1 deletion script/get-rclone-config/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ def preprocess(i):

quiet = (env.get('MLC_QUIET', False) == 'yes')

run_cmds = []
if env.get('MLC_RCLONE_CONFIG_CMD', '') != '':
env['MLC_RUN_CMD'] = env['MLC_RCLONE_CONFIG_CMD']
run_cmds.append(env['MLC_RCLONE_CONFIG_CMD'])

if env.get('MLC_RCLONE_CONNECT_CMD', '') != '':
run_cmds.append(env['MLC_RCLONE_CONNECT_CMD'])

env['MLC_RUN_CMD'] = ' && '.join(run_cmds)

return {'return': 0}

Expand Down
8 changes: 8 additions & 0 deletions script/get-rclone-config/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ variations:
mlc-inference:
env:
MLC_RCLONE_CONFIG_CMD: 'rclone config create mlc-inference s3 provider=Cloudflare access_key_id=f65ba5eef400db161ea49967de89f47b secret_access_key=fbea333914c292b854f14d3fe232bad6c5407bf0ab1bebf78833c2b359bdfd2b endpoint=https://c2686074cb2caf5cbaf6d134bdba8b47.r2.cloudflarestorage.com'
mlperf-llama2:
env:
MLC_RCLONE_CONFIG_CMD: 'rclone config create mlc-llama2 drive config_is_local=false scope=drive.readonly root_folder_id=11tBZvvrh0FCm3XuR5E849K42TqftYdUF'
MLC_RCLONE_CONNECT_CMD: 'rclone config reconnect mlc-llama2:'
mlperf-llama3-1:
env:
MLC_RCLONE_CONFIG_CMD: 'rclone config create mlc-llama3-1 drive config_is_local=false scope=drive.readonly root_folder_id=12K-2yvmr1ZSZ7SLrhidCbWc0BriN98am'
MLC_RCLONE_CONNECT_CMD: 'rclone config reconnect mlc-llama3-1:'

0 comments on commit a2f0887

Please sign in to comment.