Add return logits compile script
Browse files
gen_models--LiquidAI--LFM2.5-350M_return_logits.sh
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
#**************************************************************************
|
| 3 |
+
#|| SiMa.ai CONFIDENTIAL ||
|
| 4 |
+
#|| Unpublished Copyright (c) 2025 SiMa.ai, All Rights Reserved. ||
|
| 5 |
+
#**************************************************************************
|
| 6 |
+
# NOTICE: All information contained herein is, and remains the property of
|
| 7 |
+
# SiMa.ai. The intellectual and technical concepts contained herein are
|
| 8 |
+
# proprietary to SiMa and may be covered by U.S. and Foreign Patents,
|
| 9 |
+
# patents in process, and are protected by trade secret or copyright law.
|
| 10 |
+
#
|
| 11 |
+
# Dissemination of this information or reproduction of this material is
|
| 12 |
+
# strictly forbidden unless prior written permission is obtained from
|
| 13 |
+
# SiMa.ai. Access to the source code contained herein is hereby forbidden
|
| 14 |
+
# to anyone except current SiMa.ai employees, managers or contractors who
|
| 15 |
+
# have executed Confidentiality and Non-disclosure agreements explicitly
|
| 16 |
+
# covering such access.
|
| 17 |
+
#
|
| 18 |
+
# The copyright notice above does not evidence any actual or intended
|
| 19 |
+
# publication or disclosure of this source code, which includes information
|
| 20 |
+
# that is confidential and/or proprietary, and is a trade secret, of SiMa.ai.
|
| 21 |
+
#
|
| 22 |
+
# ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE, OR PUBLIC
|
| 23 |
+
# DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN
|
| 24 |
+
# CONSENT OF SiMa.ai IS STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE
|
| 25 |
+
# LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR POSSESSION OF THIS SOURCE
|
| 26 |
+
# CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS TO
|
| 27 |
+
# REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, USE, OR
|
| 28 |
+
# SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
|
| 29 |
+
#
|
| 30 |
+
#**************************************************************************
|
| 31 |
+
|
| 32 |
+
# Download the HuggingFace LiquidAI/LFM2.5-350M using the following command.
|
| 33 |
+
# huggingface-cli download LiquidAI/LFM2.5-350M
|
| 34 |
+
|
| 35 |
+
TMPDIR=$(mktemp -d /tmp/sima.XXXXXX)
|
| 36 |
+
|
| 37 |
+
function cleanup () {
|
| 38 |
+
rm -r "${TMPDIR}"
|
| 39 |
+
}
|
| 40 |
+
trap cleanup EXIT
|
| 41 |
+
|
| 42 |
+
cat >"${TMPDIR}/config.py" <<'EOF'
|
| 43 |
+
def get_layer_configuration(model_properties, layer):
|
| 44 |
+
if layer["is_group"]:
|
| 45 |
+
precision = "A_BF16_W_INT8"
|
| 46 |
+
else:
|
| 47 |
+
precision = "A_BF16_W_INT4"
|
| 48 |
+
return {"precision": precision}
|
| 49 |
+
EOF
|
| 50 |
+
|
| 51 |
+
MAX_NUM_TOKENS=2048
|
| 52 |
+
LANGUAGE_GROUP_SIZE=320
|
| 53 |
+
LANGUAGE_GROUP_OFFSETS=0,320,640,960,1280,1600
|
| 54 |
+
FUTURE_TOKEN_MASK_SIZE=128
|
| 55 |
+
|
| 56 |
+
llima-compile \
|
| 57 |
+
-c "${TMPDIR}/config.py" \
|
| 58 |
+
--max_num_tokens ${MAX_NUM_TOKENS} \
|
| 59 |
+
--language_group_size ${LANGUAGE_GROUP_SIZE} \
|
| 60 |
+
--language_group_offsets ${LANGUAGE_GROUP_OFFSETS} \
|
| 61 |
+
--future_token_mask_size ${FUTURE_TOKEN_MASK_SIZE} \
|
| 62 |
+
--return_logits \
|
| 63 |
+
"$@"
|