Skip to content

Commit fc75330

Browse files
Remove keep_in_memory and fix lintrunner errors
1 parent 9a5c458 commit fc75330

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

examples/mediatek/aot_utils/llm_utils/sanity_checks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ def check_weights_exist(weight_dir):
204204
f"No weight files found in {weight_dir}! Weight files should be either .bin or .safetensors file types."
205205
)
206206
safetensors_l = [f for f in os.listdir(weight_dir) if f.endswith(".safetensors")]
207-
bin_l = [f for f in os.listdir(weight_dir) if f.endswith(".bin") and "embedding" not in f]
207+
bin_l = [
208+
f for f in os.listdir(weight_dir) if f.endswith(".bin") and "embedding" not in f
209+
]
208210
if len(safetensors_l) & len(bin_l):
209211
raise RuntimeError(
210212
"Weights should only be in either .bin or .safetensors format, not both."

examples/mediatek/model_export_scripts/llama.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ def main():
462462
"eos_token_id_tensor": torch.tensor(tokenizer.eos_token_id),
463463
"response_cap": args.response_cap,
464464
},
465-
keep_in_memory=True
466465
)
467466

468467
for chunk_idx, chunk in enumerate(models):

examples/mediatek/models/llm_models/modeling_common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ def get_example_inputs(
751751
for _ in range(2 * self.num_blocks)
752752
],
753753
)
754+
# Specify dims that would be dynamic during calibration
754755
# Note: Assume cache size fixed shape as torch dynamic shape cannot handle dim 3 being
755756
# combination of 2 dynamic dims
756757
if get_dym_shape:

examples/mediatek/shell_scripts/export_llama.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
model=${1:-'llama3'}
1+
model=${1:-'llama3.2-3b'}
22
chunks=${2:-4}
33
tok=${3:-128}
44
cache=${4:-512}
55
cal=${5:-None}
66
pres=${6:-A16W4}
77

8-
if [ $model = "llama3" ]
8+
if [ $model = "llama3.2-3b" ]
9+
then
10+
config_path=Llama-3.2-3B-Instruct/config.json
11+
pref="--preformatter aot_utils/llm_utils/preformatter_templates/llama3.json"
12+
elif [ $model = "llama3.2-1b" ]
13+
then
14+
config_path=Llama-3.2-1B-Instruct/config.json
15+
pref="--preformatter aot_utils/llm_utils/preformatter_templates/llama3.json"
16+
elif [ $model = "llama3" ]
917
then
1018
config_path=llama3-8B-instruct/config.json
1119
pref="--preformatter aot_utils/llm_utils/preformatter_templates/llama3.json"
1220
elif [ $model = "llama2" ]
1321
then
1422
config_path=llama2-7B-chat/config.json
1523
pref="--preformatter aot_utils/llm_utils/preformatter_templates/llama2_short.json"
16-
else
17-
# will remove once stable
18-
config_path=llama_1b_50k/config.json
19-
pref=""
2024
fi
25+
2126
if [ $cal = "None" ]
2227
then
2328
data=""

0 commit comments

Comments
 (0)