-
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.
[Integration] Upload tutorial for making a bitnet ckpt for vLLM (#135)
* fix install with absolute path * efficient inference with torch compile * update vllm ckpt tutorial for bitnet
- Loading branch information
1 parent
c6cc01e
commit 7c6bccf
Showing
12 changed files
with
913 additions
and
10 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
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
#!/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) | ||
|
||
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 bitnet_3B_1.58bits --depth 1 | ||
|
||
# copy quantized config into the model directory | ||
cp ../maint/quant_config.json bitnet_3B_1.58bits | ||
|
||
# get the realpath of the model directory | ||
MODEL_DIR=$(realpath bitnet_3B_1.58bits) | ||
|
||
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.