Skip to content

Commit e2cf3b7

Browse files
henk717root
and
root
authored
koboldcpp.sh - The Mamba Multitool (LostRuins#554)
* .sh script V1 * koboldcpp.sh polish * koboldcpp.sh dist generator * Include html's in dist * RWKV in Linux Dist * Lower dependency requirements * Eliminate wget dependency * More distinct binary name I know its technically amd64, but I don't want to cause confusion among nvidia users. * Use System OpenCL Unsure how this will behave in the pyinstaller build, but pocl ended up CPU only. With a bit of luck the pyinstaller uses the one from the actual system if compiled in a system without opencl, while conda now includes it for that specific system. * Add cblas dependency Missing this causes compile failures on some system's * ICD workaround Ideally we find a better solution, but conda forces ICD and needs this for the successful compile. However, pyinstaller then embeds the ICD causing it to be limited to the system it was compiled for. By temporarily removing the ICD pyinstaller can't find it and everything remains functional. Ideally we do this on a pyinstaller level, but I could not find any good options to do so yet. --------- Co-authored-by: root <root@DESKTOP-DQ1QRAG>
1 parent 7a69152 commit e2cf3b7

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,8 @@ hipblas.dll
118118
koboldcpp_hipblas.so
119119
koboldcpp_hipblas.dll
120120

121+
bin/
122+
conda/
123+
121124
# Jetbrains idea folder
122125
.idea/

environment.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: koboldcpp
2+
channels:
3+
- nvidia/label/cuda-11.5.0
4+
- conda-forge
5+
- defaults
6+
dependencies:
7+
- python=3.8
8+
- cuda-nvcc=11.5
9+
- cuda-libraries-dev=11.5
10+
- cxx-compiler
11+
- gxx=10
12+
- pip
13+
- git=2.35.1
14+
- libopenblas
15+
- openblas
16+
- clblast
17+
- ninja
18+
- make
19+
- packaging
20+
- pyinstaller
21+
- libcblas
22+
- ocl-icd-system
23+
- pip:
24+
- customtkinter

koboldcpp.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
if [ ! -f "bin/micromamba" ]; then
3+
curl -Ls https://anaconda.org/conda-forge/micromamba/1.5.3/download/linux-64/micromamba-1.5.3-0.tar.bz2 | tar -xvj bin/micromamba
4+
fi
5+
6+
if [[ ! -f "conda/envs/linux/bin/python" || $1 == "rebuild" ]]; then
7+
bin/micromamba create --no-shortcuts -r conda -n linux -f environment.yaml -y
8+
bin/micromamba create --no-shortcuts -r conda -n linux -f environment.yaml -y
9+
bin/micromamba run -r conda -n linux make clean
10+
fi
11+
12+
bin/micromamba run -r conda -n linux make LLAMA_OPENBLAS=1 LLAMA_CLBLAST=1 LLAMA_CUBLAS=1 LLAMA_PORTABLE=1
13+
14+
if [[ $1 == "rebuild" ]]; then
15+
echo Rebuild complete, you can now try to launch Koboldcpp.
16+
elif [[ $1 == "dist" ]]; then
17+
bin/micromamba remove -r conda -n linux --force ocl-icd -y
18+
bin/micromamba run -r conda -n linux pyinstaller --noconfirm --onefile --collect-all customtkinter --add-data='./koboldcpp_default.so:.' --add-data='./koboldcpp_cublas.so:.' --add-data='./koboldcpp_openblas.so:.' --add-data='./koboldcpp_clblast.so:.' --add-data='./koboldcpp_clblast_noavx2.so:.' --add-data='./klite.embd:.' --add-data='./kcpp_docs.embd:.' --add-data='./rwkv_vocab.embd:.' --add-data='./rwkv_world_vocab.embd:.' --clean --console koboldcpp.py -n "koboldcpp-linux-x64"
19+
bin/micromamba install -r conda -n linux ocl-icd -c conda-forge -y
20+
else
21+
bin/micromamba run -r conda -n linux python koboldcpp.py $*
22+
fi

0 commit comments

Comments
 (0)