-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update_transform
- Loading branch information
Showing
13 changed files
with
914 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 16 additions & 4 deletions
20
integration/BitNet/create_bitblas_ckpt.py → ...ation/BitNet/maint/create_bitblas_ckpt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
integration/BitNet/maint/generate_bitnet_model_bitblas_format.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# retrieve the native model input and saved model directory | ||
MODEL_DIR=$1 | ||
SAVED_MODEL_DIR=$2 | ||
|
||
# check if the model directory exists | ||
if [ ! -d "$MODEL_DIR" ]; then | ||
echo "Model directory does not exist!" | ||
exit 1 | ||
fi | ||
|
||
# if the saved model directory does not exist, create it | ||
# if SAVED_MODEL_DIR is not provided, we do not pass it to the script | ||
if [ -z "$SAVED_MODEL_DIR" ]; then | ||
python ./maint/create_bitblas_ckpt.py --model_name_or_path $MODEL_DIR | ||
else | ||
python ./maint/create_bitblas_ckpt.py --model_name_or_path $MODEL_DIR --saved_model_path $SAVED_MODEL_DIR | ||
fi | ||
|
||
# get the realpath of the saved model directory | ||
SAVED_MODEL_DIR=$(realpath $SAVED_MODEL_DIR) | ||
|
||
# cp files | ||
cp $MODEL_DIR/quantize_config.json $SAVED_MODEL_DIR/ | ||
cp $MODEL_DIR/tokenizer.json $SAVED_MODEL_DIR/ | ||
cp $MODEL_DIR/tokenizer.model $SAVED_MODEL_DIR/ | ||
cp $MODEL_DIR/tokenizer_config.json $SAVED_MODEL_DIR/ | ||
|
||
echo "Model has been converted and save to $SAVED_MODEL_DIR" |
27 changes: 27 additions & 0 deletions
27
integration/BitNet/maint/generate_bitnet_model_native_format.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# require git lfs | ||
if ! command -v git-lfs &> /dev/null; then | ||
echo "Please install git-lfs first by running 'sudo apt install git-lfs'" | ||
exit 1 | ||
fi | ||
|
||
mkdir -p models | ||
|
||
cd models | ||
|
||
# download the model | ||
git clone https://huggingface.co/1bitLLM/bitnet_b1_58-3B ckpt_bitnet_b1_58-3B --depth 1 | ||
|
||
# copy quantized config into the model directory | ||
cp ../maint/quantize_config.json ckpt_bitnet_b1_58-3B | ||
|
||
# get the realpath of the model directory | ||
MODEL_DIR=$(realpath ckpt_bitnet_b1_58-3B) | ||
|
||
cd .. | ||
|
||
echo "Model has been converted and save to $MODEL_DIR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"bits": 2, | ||
"desc_act": false, | ||
"static_groups": false, | ||
"sym": true, | ||
"lm_head": false, | ||
"model_name_or_path": "1bitLLM/bitnet_b1_58-3B", | ||
"quant_method": "bitnet", | ||
"checkpoint_format": "bitnet" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.