Skip to content

Commit

Permalink
chore: update script for ops (#647)
Browse files Browse the repository at this point in the history
* add llama model converter

* update

* chore: update scripts for ops
  • Loading branch information
wsxiaoys authored Oct 26, 2023
1 parent 39879ab commit d6c1324
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 141 deletions.
18 changes: 13 additions & 5 deletions experimental/copy-to-modelscope/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ if [ -z "${MODEL_ID}" ]; then
usage
fi

git clone https://oauth2:${ACCESS_TOKEN}@www.modelscope.cn/$MODEL_ID.git ms_model --depth 1
git clone https://huggingface.co/$MODEL_ID hf_model --depth 1
git clone https://oauth2:${ACCESS_TOKEN}@www.modelscope.cn/$MODEL_ID.git ms_model --depth 1 || true
git clone https://huggingface.co/$MODEL_ID hf_model --depth 1 || true

echo "Sync directory"
rsync -avh --exclude '.git' --delete hf_model/ ms_model/
Expand Down Expand Up @@ -48,12 +48,20 @@ cat <<EOF >ms_model/configuration.json
}
EOF

push_origin() {
git lfs push origin --all
git push origin
}

set -x
pushd ms_model
git add .
git commit -m "sync with upstream"
git lfs push origin
git push origin
git commit -m "sync with upstream" || true

while true; do
push_origin && break
done

popd

echo "Success!"
Expand Down
Empty file.
27 changes: 0 additions & 27 deletions experimental/model-converter/args.py

This file was deleted.

106 changes: 0 additions & 106 deletions experimental/model-converter/main.py

This file was deleted.

3 changes: 0 additions & 3 deletions experimental/model-converter/requirements.txt

This file was deleted.

58 changes: 58 additions & 0 deletions experimental/model-converter/update-llama-model.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
set -e

ACCESS_TOKEN=$1

usage() {
echo "Usage: $0 <access_token>"
exit 1
}

if [ -z "${ACCESS_TOKEN}" ]; then
usage
fi

prepare_llama_cpp() {
git clone https://github.com/ggerganov/llama.cpp.git
pushd llama.cpp

git checkout 6961c4bd0b5176e10ab03b35394f1e9eab761792
mkdir build
pushd build
cmake ..
make quantize
popd
popd
}

update_model() {
MODEL_ID=$1

git clone https://${ACCESS_TOKEN}@huggingface.co/$MODEL_ID hf_model --depth 1

pushd hf_model
huggingface-cli lfs-enable-largefiles .

python ../llama.cpp/convert-starcoder-hf-to-gguf.py . --outfile ./ggml/f16.v2.gguf 1
../llama.cpp/build/bin/quantize ./ggml/f16.v2.gguf ./ggml/q8_0.v2.gguf q8_0

git add .
git commit -m "add ggml model v2"
git lfs push origin
git push origin
popd

echo "Success!"
rm -rf hf_model
}

set -x
prepare_llama_cpp || true

# update_model TabbyML/StarCoder-1B
# update_model TabbyML/StarCoder-3B
update_model TabbyML/StarCoder-7B
update_model TabbyML/CodeLlama-7B
update_model TabbyML/CodeLlama-13B
update_model TabbyML/Mistral-7B
update_model TabbyML/WizardCoder-3B

0 comments on commit d6c1324

Please sign in to comment.