try using qemu to do the pyinstaller

This commit is contained in:
Concedo 2024-12-07 00:19:13 +08:00
parent e9d2332dd8
commit 58038cddc3
3 changed files with 58 additions and 19 deletions

View file

@ -1,35 +1,53 @@
name: Koboldcpp Linux ARM64 name: Koboldcpp Linux ARM64
on: workflow_dispatch on:
workflow_dispatch
env: env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
NOAVX2: 1
jobs: jobs:
linux-arm: linux-arm:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Clone - name: Clone Repository
id: checkout id: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: ${{ github.head_ref || github.ref_name }} ref: ${{ github.head_ref || github.ref_name }}
- name: Build Dependencies - name: Setup Build Environment
id: depends1 id: setup_environment
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y python3 python3-pip python3-dev build-essential \ sudo apt-get install -y \
libffi-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev \ build-essential \
crossbuild-essential-arm64 qemu qemu-user qemu-user-static \ crossbuild-essential-arm64 \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
python3 \
python3-tk \
python3-pip \
qemu-user-static \
binfmt-support \
qemu-user-binfmt \
libffi-dev:arm64 \
zlib1g-dev:arm64 \
libssl-dev:arm64
sudo update-binfmts --enable qemu-aarch64
- name: Python Dependencies - name: Install ARM64 Python Environment
id: depends2 id: install_arm_python
run: | run: |
pip install customtkinter pyinstaller tk # Install ARM64 Python with QEMU emulation
sudo apt-get install -y python3-arm64 python3-pip-arm64
sudo ln -sf /usr/bin/python3-arm64 /usr/bin/python3-arm
sudo ln -sf /usr/bin/pip3-arm64 /usr/bin/pip3-arm
- name: Build with ARM NEON Support # Install necessary Python packages in ARM64 environment
python3-arm -m pip install --no-cache-dir customtkinter pyinstaller tk psutil
- name: Build for ARM
id: build_binary id: build_binary
run: | run: |
# Enable cross-compilation for ARM # Enable cross-compilation for ARM
@ -40,14 +58,35 @@ jobs:
export UNAME_M=aarch64 export UNAME_M=aarch64
export UNAME_S=Linux export UNAME_S=Linux
# Build any necessary C/C++ components
make LLAMA_PORTABLE=1 make LLAMA_PORTABLE=1
chmod +x './create_ver_file.sh' chmod +x './create_ver_file.sh'
. create_ver_file.sh ./create_ver_file.sh
pyinstaller --noconfirm --onefile --collect-all customtkinter --collect-all psutil --add-data './koboldcpp_default.so:.' --add-data './kcpp_adapters:./kcpp_adapters' --add-data './koboldcpp.py:.' --add-data './klite.embd:.' --add-data './kcpp_docs.embd:.' --add-data './kcpp_sdui.embd:.' --add-data './taesd.embd:.' --add-data './taesd_xl.embd:.' --add-data './rwkv_vocab.embd:.' --add-data './rwkv_world_vocab.embd:.' --version-file './version.txt' --clean --console koboldcpp.py -n "koboldcpp-linux-arm64"
- name: Save artifact # Package with ARM64 PyInstaller
python3-arm -m pyinstaller \
--noconfirm \
--onefile \
--collect-all customtkinter \
--collect-all psutil \
--add-data './koboldcpp_default.so:.' \
--add-data './kcpp_adapters:./kcpp_adapters' \
--add-data './koboldcpp.py:.' \
--add-data './klite.embd:.' \
--add-data './kcpp_docs.embd:.' \
--add-data './kcpp_sdui.embd:.' \
--add-data './taesd.embd:.' \
--add-data './taesd_xl.embd:.' \
--add-data './rwkv_vocab.embd:.' \
--add-data './rwkv_world_vocab.embd:.' \
--version-file './version.txt' \
--clean \
--console \
koboldcpp.py \
-n "koboldcpp-linux-arm64"
- name: Save Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: kcpp_linux_arm64_binary name: kcpp_linux_arm64_binary
path: dist/ path: dist/

View file

@ -395,7 +395,7 @@ else
ifndef LLAMA_HIPBLAS ifndef LLAMA_HIPBLAS
ifndef LLAMA_VULKAN ifndef LLAMA_VULKAN
ifndef LLAMA_METAL ifndef LLAMA_METAL
NOTIFY_MSG = @echo -e '\nYou did a basic CPU build. For faster speeds, install and link a BLAS library. \nSet LLAMA_VULKAN=1 to compile with Vulkan support. This is just a reminder, not an error.' NOTIFY_MSG = @echo -e '\n***\nYou did a basic CPU build. For faster speeds, consider installing and linking a GPU BLAS library. For example, set LLAMA_VULKAN=1 to compile with Vulkan support. Read the KoboldCpp Wiki for more information. This is just a reminder, not an error.\n***\n'
endif endif
endif endif
endif endif

View file

@ -4344,7 +4344,7 @@ def main(launch_args,start_server=True):
show_gui() show_gui()
except Exception as ex: except Exception as ex:
exitcounter = 999 exitcounter = 999
ermsg = "Reason: " + str(ex) + "\nFile selection GUI unsupported.\ncustomtkinter python module required!\n\nPlease check command line options with --help" ermsg = "Reason: " + str(ex) + "\nFile selection GUI unsupported.\ncustomtkinter python module required!\n\nYou must use the command line instead, e.g. python ./koboldcpp.py --help"
show_gui_msgbox("Warning, GUI failed to start",ermsg) show_gui_msgbox("Warning, GUI failed to start",ermsg)
if args.skiplauncher: if args.skiplauncher:
print("Note: In order to use --skiplauncher, you need to specify a model with --model") print("Note: In order to use --skiplauncher, you need to specify a model with --model")