diff --git a/.github/workflows/kcpp-build-release-win.yaml b/.github/workflows/kcpp-build-release-win.yaml index a9add9d9f..4eeabeb4f 100644 --- a/.github/workflows/kcpp-build-release-win.yaml +++ b/.github/workflows/kcpp-build-release-win.yaml @@ -40,6 +40,40 @@ jobs: & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -products * -format json shell: pwsh + - name: Visual Studio 2019 Reinstall + shell: cmd + run: | + @echo off + echo Preparing setup + curl -fLO https://download.visualstudio.microsoft.com/download/pr/1fbe074b-8ae1-4e9b-8e83-d1ce4200c9d1/61098e228df7ba3a6a8b4e920a415ad8878d386de6dd0f23f194fe1a55db189a/vs_Enterprise.exe + vs_Enterprise.exe --quiet --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.CLI.Support --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.Workload.UniversalBuildTools --add Microsoft.VisualStudio.Component.VC.CMake.Project + echo Waiting for VS2019 setup + set "ProcessName=setup.exe" + :CheckProcess + tasklist /FI "IMAGENAME eq %ProcessName%" | find /I "%ProcessName%" >nul + if %errorlevel%==0 ( + ping 127.0.0.1 /n 5 >nul + goto CheckProcess + ) + echo VS2019 Setup completed + exit /b 0 + + - uses: Jimver/cuda-toolkit@v0.2.24 + id: cuda-toolkit + with: + cuda: '12.1.0' + use-github-cache: false + + - name: Disable Visual Studio 2022 by Renaming + run: | + Rename-Item "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" "Enterprise_DISABLED" + shell: pwsh + + - name: Display full Visual Studio info After + run: | + & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -products * -format json + shell: pwsh + - name: Download and install win64devkit run: | curl -L https://github.com/skeeto/w64devkit/releases/download/v1.22.0/w64devkit-1.22.0.zip --output w64devkit.zip @@ -63,12 +97,6 @@ jobs: run: | make LLAMA_CLBLAST=1 LLAMA_VULKAN=1 LLAMA_PORTABLE=1 -j ${env:NUMBER_OF_PROCESSORS} - - uses: Jimver/cuda-toolkit@v0.2.15 - id: cuda-toolkit - with: - cuda: '12.4.0' - use-github-cache: false - - name: Build CUDA id: cmake_build run: | @@ -86,8 +114,8 @@ jobs: # ls - name: Copy CuBLAS Libraries run: | - copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\cublasLt64_12.dll" . - copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\cublas64_12.dll" . + copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\cublasLt64_12.dll" . + copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\cublas64_12.dll" . ls - name: Package PyInstallers diff --git a/Makefile b/Makefile index 681720a45..7ac32a87b 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,11 @@ endif HCXX := $(ROCM_PATH)/bin/hipcc else ROCM_PATH ?= /opt/rocm +ifdef LLAMA_PORTABLE GPU_TARGETS ?= gfx803 gfx900 gfx906 gfx908 gfx90a gfx942 gfx1010 gfx1030 gfx1031 gfx1032 gfx1100 gfx1101 gfx1102 gfx1200 gfx1201 $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch) +else + GPU_TARGETS ?= $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch) +endif HCC := $(ROCM_PATH)/llvm/bin/clang HCXX := $(ROCM_PATH)/llvm/bin/clang++ endif diff --git a/koboldcpp.py b/koboldcpp.py index 988d140b4..6daf09386 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -660,15 +660,19 @@ def unpack_to_dir(destpath = ""): print(f"KoboldCpp will be extracted to {destpath}\nThis process may take several seconds to complete.") else: messagebox.showinfo("Unpack Starting", f"KoboldCpp will be extracted to {destpath}\nThis process may take several seconds to complete.") + pyds_dir = os.path.join(destpath, 'pyds') + os.makedirs(pyds_dir, exist_ok=True) for item in os.listdir(srcpath): s = os.path.join(srcpath, item) d = os.path.join(destpath, item) - if item.endswith('.pyd'): # Skip .pyd files - continue - if os.path.isdir(s): - shutil.copytree(s, d, False, None) - else: + if item.endswith('.pyd'): # relocate pyds files to subdirectory + d = os.path.join(pyds_dir, item) shutil.copy2(s, d) + else: + if os.path.isdir(s): + shutil.copytree(s, d, False, None) + else: + shutil.copy2(s, d) if cliunpack: print(f"KoboldCpp successfully extracted to {destpath}") else: diff --git a/make_pyinstaller_shim.bat b/make_pyinstaller_shim.bat new file mode 100644 index 000000000..2b1660ff0 --- /dev/null +++ b/make_pyinstaller_shim.bat @@ -0,0 +1 @@ +PyInstaller --onedir --noconfirm --clean --console --runtime-hook "./tools/kcpplauncherhook.py" --icon "./niko.ico" --version-file "./version.txt" "./koboldcpp.py" -n "koboldcpp-loader.exe" \ No newline at end of file diff --git a/tools/kcpplauncherhook.py b/tools/kcpplauncherhook.py new file mode 100644 index 000000000..9d51b1973 --- /dev/null +++ b/tools/kcpplauncherhook.py @@ -0,0 +1,10 @@ +import os +import sys + +# Determine the folder where the .pyd files will be located +pyd_subdir = os.path.join(sys._MEIPASS, 'pyds') + +# Add the subfolder to sys.path so Python can find the .pyd modules +print("Augmenting PYD directory...") +if os.path.isdir(pyd_subdir): + sys.path.insert(0, pyd_subdir) \ No newline at end of file