Skip to content
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

Added model download script for mixtral #74

Closed
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
1 change: 1 addition & 0 deletions script/get-ml-model-mixtral/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please see [https://docs.mlcommons.org/cm4mlops/scripts/AI-ML-models/get-ml-model-llama2](https://docs.mlcommons.org/cm4mlops/scripts/AI-ML-models/get-ml-model-llama2) for the documentation of this CM script.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the readme be deleted? github action will create it for newly added scripts

95 changes: 95 additions & 0 deletions script/get-ml-model-mixtral/_cm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"alias": "get-ml-model-mixtral",
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"cache": true,
"category": "AI/ML models",
"env": {
"CM_ML_MODEL_DATASET": "",
"CM_ML_MODEL_WEIGHT_TRANSFORMATIONS": "no"
},
"input_mapping": {
"checkpoint": "MIXTRAL_CHECKPOINT_PATH"
},
"new_env_keys": [
"CM_ML_MODEL_*",
"MIXTRAL_CHECKPOINT_PATH"
],
"prehook_deps": [
{
"enable_if_env": {
"CM_TMP_REQUIRE_DOWNLOAD": [
"yes"
]
},
"env": {},
"extra_cache_tags": "mixtral",
"force_env_keys": [
"CM_GIT_CHECKOUT_FOLDER"
],
"names": [
"hf-zoo"
],
"tags": "get,ml-model,huggingface,zoo,_clone-repo"
}
],
"print_env_at_the_end": {
"MIXTRAL_CHECKPOINT_PATH": "MIXTRAL checkpoint path"
},
"tags": [
"get",
"raw",
"ml-model",
"language-processing",
"mixtral",
"mixtral-7b"
],
"uid": "0c14127677f34ea2",
"variations": {
"batch_size.#": {
"env": {
"CM_ML_MODEL_BATCH_SIZE": "#"
}
},
"fp32": {
"default": true,
"env": {
"CM_ML_MODEL_INPUT_DATA_TYPES": "fp32",
"CM_ML_MODEL_PRECISION": "fp32",
"CM_ML_MODEL_WEIGHT_DATA_TYPES": "fp32"
},
"group": "precision"
},
"mistralai/Mixtral-8x7B-Instruct-v0.1": {
"adr": {
"hf-zoo": {
"tags": "_model-stub.mistralai/Mixtral-8x7B-Instruct-v0.1"
}
},
"default": true,
"env": {
"CM_GIT_CHECKOUT_FOLDER": "Mixtral-8x7B-Instruct-v0.1",
"CM_MODEL_ZOO_ENV_KEY": "MIXTRAL"
},
"group": "huggingface-stub"
},
"pytorch": {
"default": true,
"env": {
"CM_ML_MODEL_FRAMEWORK": "pytorch"
},
"group": "framework"
},
"stub.#": {
"adr": {
"hf-zoo": {
"tags": "_model-stub.#"
}
},
"env": {
"CM_MODEL_ZOO_ENV_KEY": "MIXTRAL"
},
"group": "huggingface-stub"
}
}
}
24 changes: 24 additions & 0 deletions script/get-ml-model-mixtral/customize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from cmind import utils
import os

def preprocess(i):

os_info = i['os_info']
env = i['env']

path = env.get('MIXTRAL_CHECKPOINT_PATH', '').strip()

if path == '' or not os.path.exists(path):
env['CM_TMP_REQUIRE_DOWNLOAD'] = 'yes'

return {'return':0}

def postprocess(i):

env = i['env']

env['MIXTRAL_CHECKPOINT_PATH'] = env['CM_ML_MODEL_PATH']
env['CM_ML_MODEL_PATH'] = env['MIXTRAL_CHECKPOINT_PATH']
env['CM_GET_DEPENDENT_CACHED_PATH'] = env['CM_ML_MODEL_PATH']

return {'return':0}
Loading