From 58038cddc35737f9866642f89d6d76186a7a0e29 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 7 Dec 2024 00:19:13 +0800 Subject: [PATCH] try using qemu to do the pyinstaller --- .../workflows/kcpp-build-release-arm64.yaml | 73 ++++++++++++++----- Makefile | 2 +- koboldcpp.py | 2 +- 3 files changed, 58 insertions(+), 19 deletions(-) diff --git a/.github/workflows/kcpp-build-release-arm64.yaml b/.github/workflows/kcpp-build-release-arm64.yaml index b412106d2..89adbc3f6 100644 --- a/.github/workflows/kcpp-build-release-arm64.yaml +++ b/.github/workflows/kcpp-build-release-arm64.yaml @@ -1,35 +1,53 @@ name: Koboldcpp Linux ARM64 -on: workflow_dispatch +on: + workflow_dispatch + env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - NOAVX2: 1 jobs: linux-arm: runs-on: ubuntu-latest steps: - - name: Clone + - name: Clone Repository id: checkout uses: actions/checkout@v3 with: ref: ${{ github.head_ref || github.ref_name }} - - name: Build Dependencies - id: depends1 + - name: Setup Build Environment + id: setup_environment run: | sudo apt-get update - sudo apt-get install -y python3 python3-pip python3-dev build-essential \ - libffi-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev \ - crossbuild-essential-arm64 qemu qemu-user qemu-user-static \ - gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + sudo apt-get install -y \ + build-essential \ + crossbuild-essential-arm64 \ + 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 - id: depends2 + - name: Install ARM64 Python Environment + id: install_arm_python 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 run: | # Enable cross-compilation for ARM @@ -40,14 +58,35 @@ jobs: export UNAME_M=aarch64 export UNAME_S=Linux + # Build any necessary C/C++ components make LLAMA_PORTABLE=1 chmod +x './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" + ./create_ver_file.sh - - 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 with: name: kcpp_linux_arm64_binary path: dist/ - diff --git a/Makefile b/Makefile index 6b0d2bc01..a4216ceed 100644 --- a/Makefile +++ b/Makefile @@ -395,7 +395,7 @@ else ifndef LLAMA_HIPBLAS ifndef LLAMA_VULKAN 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 diff --git a/koboldcpp.py b/koboldcpp.py index dae723702..85dc731dc 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -4344,7 +4344,7 @@ def main(launch_args,start_server=True): show_gui() except Exception as ex: 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) if args.skiplauncher: print("Note: In order to use --skiplauncher, you need to specify a model with --model")