-
Notifications
You must be signed in to change notification settings - Fork 590
/
Copy pathbuild.sh
executable file
·30 lines (20 loc) · 1000 Bytes
/
build.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
#!/usr/bin/env bash
set -ex
echo "Building llama-cpp-python ${LLAMA_CPP_VERSION}"
cd /opt
git clone --branch=v${LLAMA_CPP_BRANCH} --depth=1 --recursive https://github.com/abetlen/llama-cpp-python ||
git clone --depth=1 --recursive https://github.com/abetlen/llama-cpp-python
CMAKE_ARGS="${LLAMA_CPP_FLAGS} -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}" \
FORCE_CMAKE=1 \
pip3 wheel --wheel-dir=$PIP_WHEEL_DIR --verbose ./llama-cpp-python
pip3 install $PIP_WHEEL_DIR/llama_cpp_python*.whl
pip3 show llama-cpp-python
python3 -c 'import llama_cpp'
python3 -m llama_cpp.server --help
twine upload --verbose $PIP_WHEEL_DIR/llama_cpp_python*.whl || echo "failed to upload wheel to ${TWINE_REPOSITORY_URL}"
# install c++ binaries
cd /opt/llama-cpp-python/vendor/llama.cpp
cmake -B build ${LLAMA_CPP_FLAGS} -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}
cmake --build build --config Release --parallel $(nproc)
cmake --install build
ln -s /opt/llama-cpp-python/vendor/llama.cpp /opt/llama.cpp