forked from OpenAgentsInc/workerbee
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-bin.sh
executable file
·56 lines (41 loc) · 1.18 KB
/
build-bin.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash -e
gpu="$1"
arch="$2"
cmake="$3"
opts="--onefile"
if [ -z "$cmake" -o -z "$gpu" ]; then
echo usage build-bin.sh gpu arch "cmake-args"
exit 1
fi
with_torch=""
if [ "$gpu" == "cuda-torch" ]; then
with_torch="--with torch --with onnx"
opts=""
fi
with_onnx=""
if [ "$gpu" == "cuda" ]; then
with_torch="--with onnx"
fi
set -o xtrace
python -mvenv "build-$gpu"
# python is absurd putting these in different places
. build-$gpu/bin/activate 2> /dev/null || . build-$gpu/scripts/activate
pip uninstall -y llama-cpp-python
# windows/linux cache rm (poetry cache control is kinda blunt/broken)
rm -f ~/AppData/Local/pypoetry/Cache/artifacts/*/*/*/*/llama*
rm -f ~/.cache/pypoetry/artifacts/*/*/*/*/llama*
CMAKE_ARGS="$cmake" FORCE_CMAKE=1 poetry install $with_torch
if [ "$gpu" == "cuda-torch" ]; then
# annoying hack because fastembed is probably a bad idea
pip install transformers==4.35.0
opts=""
fi
python build-version.py
./pyinstaller.sh $gpu-$arch $opts
if [ "$gpu" == "cuda-torch" ]; then
pushd dist
tar cvf - gputopia-worker-$gpu-$arch/ | pigz -9 - > gputopia-worker-$gpu-$arch.tar.gz
rm -rf gputopia-worker-$gpu-$arch/
popd
fi
deactivate