forked from modularml/max
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
32 lines (28 loc) · 1.42 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
##===----------------------------------------------------------------------===##
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##===----------------------------------------------------------------------===##
# Usage: source setup.sh
export SCRIPT_PATH="$(readlink -f "${BASH_SOURCE:-$0}")"
export SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
export LOCAL_PATH_REPLIT=$(pwd)/.cache/replit
mkdir -p $LOCAL_PATH_REPLIT
if [ ! -f "$LOCAL_PATH_REPLIT/pytorch_model.bin" ]; then
curl https://huggingface.co/replit/replit-code-v1_5-3b/resolve/main/pytorch_model.bin -L -J -o $LOCAL_PATH_REPLIT/pytorch_model.bin
fi
if [ -z "$(ls -A $LOCAL_PATH_REPLIT/converted)" ]; then
echo Converting $LOCAL_PATH_REPLIT/pytorch_model.bin...
python3 -m pip install -r $SCRIPT_DIR/requirements.txt
python3 $SCRIPT_DIR/weights/convert_pytorch_ckpt.py \
--input $LOCAL_PATH_REPLIT/pytorch_model.bin \
--output_dir $LOCAL_PATH_REPLIT/converted
echo Checkpoint converted and written out to $LOCAL_PATH_REPLIT/converted.
fi