2023-07-20 05:04:31 -05:00
|
|
|
#!/usr/bin/env bash
|
2023-07-18 22:23:06 +02:00
|
|
|
|
2023-02-24 05:20:46 -08:00
|
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2023-07-18 15:57:25 +00:00
|
|
|
# This software may be used and distributed according to the terms of the Llama 2 Community License Agreement.
|
2023-02-24 05:20:46 -08:00
|
|
|
|
2023-09-01 12:41:43 -04:00
|
|
|
set -e
|
|
|
|
|
|
2023-07-18 15:57:25 +00:00
|
|
|
read -p "Enter the URL from email: " PRESIGNED_URL
|
|
|
|
|
echo ""
|
|
|
|
|
read -p "Enter the list of models to download without spaces (7B,13B,70B,7B-chat,13B-chat,70B-chat), or press Enter for all: " MODEL_SIZE
|
|
|
|
|
TARGET_FOLDER="." # where all files should end up
|
|
|
|
|
mkdir -p ${TARGET_FOLDER}
|
2023-02-24 05:20:46 -08:00
|
|
|
|
2023-07-18 15:57:25 +00:00
|
|
|
if [[ $MODEL_SIZE == "" ]]; then
|
|
|
|
|
MODEL_SIZE="7B,13B,70B,7B-chat,13B-chat,70B-chat"
|
|
|
|
|
fi
|
2023-02-24 05:20:46 -08:00
|
|
|
|
2023-07-18 15:57:25 +00:00
|
|
|
echo "Downloading LICENSE and Acceptable Usage Policy"
|
2023-08-29 09:42:05 -07:00
|
|
|
wget --continue ${PRESIGNED_URL/'*'/"LICENSE"} -O ${TARGET_FOLDER}"/LICENSE"
|
|
|
|
|
wget --continue ${PRESIGNED_URL/'*'/"USE_POLICY.md"} -O ${TARGET_FOLDER}"/USE_POLICY.md"
|
2023-02-24 05:20:46 -08:00
|
|
|
|
|
|
|
|
echo "Downloading tokenizer"
|
2023-08-29 09:42:05 -07:00
|
|
|
wget --continue ${PRESIGNED_URL/'*'/"tokenizer.model"} -O ${TARGET_FOLDER}"/tokenizer.model"
|
|
|
|
|
wget --continue ${PRESIGNED_URL/'*'/"tokenizer_checklist.chk"} -O ${TARGET_FOLDER}"/tokenizer_checklist.chk"
|
2023-08-28 14:21:21 +09:00
|
|
|
CPU_ARCH=$(uname -m)
|
|
|
|
|
if [ "$CPU_ARCH" = "arm64" ]; then
|
|
|
|
|
(cd ${TARGET_FOLDER} && md5 tokenizer_checklist.chk)
|
|
|
|
|
else
|
|
|
|
|
(cd ${TARGET_FOLDER} && md5sum -c tokenizer_checklist.chk)
|
|
|
|
|
fi
|
2023-02-24 05:20:46 -08:00
|
|
|
|
2023-07-18 15:57:25 +00:00
|
|
|
for m in ${MODEL_SIZE//,/ }
|
2023-02-24 05:20:46 -08:00
|
|
|
do
|
2023-07-18 15:57:25 +00:00
|
|
|
if [[ $m == "7B" ]]; then
|
|
|
|
|
SHARD=0
|
|
|
|
|
MODEL_PATH="llama-2-7b"
|
|
|
|
|
elif [[ $m == "7B-chat" ]]; then
|
|
|
|
|
SHARD=0
|
|
|
|
|
MODEL_PATH="llama-2-7b-chat"
|
|
|
|
|
elif [[ $m == "13B" ]]; then
|
|
|
|
|
SHARD=1
|
|
|
|
|
MODEL_PATH="llama-2-13b"
|
|
|
|
|
elif [[ $m == "13B-chat" ]]; then
|
|
|
|
|
SHARD=1
|
|
|
|
|
MODEL_PATH="llama-2-13b-chat"
|
|
|
|
|
elif [[ $m == "70B" ]]; then
|
|
|
|
|
SHARD=7
|
|
|
|
|
MODEL_PATH="llama-2-70b"
|
|
|
|
|
elif [[ $m == "70B-chat" ]]; then
|
|
|
|
|
SHARD=7
|
|
|
|
|
MODEL_PATH="llama-2-70b-chat"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Downloading ${MODEL_PATH}"
|
|
|
|
|
mkdir -p ${TARGET_FOLDER}"/${MODEL_PATH}"
|
|
|
|
|
|
|
|
|
|
for s in $(seq -f "0%g" 0 ${SHARD})
|
2023-02-24 05:20:46 -08:00
|
|
|
do
|
2023-09-23 11:24:39 +10:00
|
|
|
wget --continue ${PRESIGNED_URL/'*'/"${MODEL_PATH}/consolidated.${s}.pth"} -O ${TARGET_FOLDER}"/${MODEL_PATH}/consolidated.${s}.pth"
|
2023-02-24 05:20:46 -08:00
|
|
|
done
|
2023-07-18 15:57:25 +00:00
|
|
|
|
2023-08-29 09:42:05 -07:00
|
|
|
wget --continue ${PRESIGNED_URL/'*'/"${MODEL_PATH}/params.json"} -O ${TARGET_FOLDER}"/${MODEL_PATH}/params.json"
|
|
|
|
|
wget --continue ${PRESIGNED_URL/'*'/"${MODEL_PATH}/checklist.chk"} -O ${TARGET_FOLDER}"/${MODEL_PATH}/checklist.chk"
|
2023-02-24 05:20:46 -08:00
|
|
|
echo "Checking checksums"
|
2024-05-15 12:49:24 +09:00
|
|
|
CPU_ARCH=$(uname -m)
|
|
|
|
|
if [[ "$CPU_ARCH" == "arm64" ]]; then
|
2023-08-28 14:21:21 +09:00
|
|
|
(cd ${TARGET_FOLDER}"/${MODEL_PATH}" && md5 checklist.chk)
|
|
|
|
|
else
|
|
|
|
|
(cd ${TARGET_FOLDER}"/${MODEL_PATH}" && md5sum -c checklist.chk)
|
|
|
|
|
fi
|
2024-05-15 12:49:24 +09:00
|
|
|
done
|