Skip to content

Commit 8386546

Browse files
committed
Switched VS2019 for revert cu12.1 build, hopefully solves dll issues
try change order (+3 squashed commit) Squashed commit: [457f025] try newer jimver [64af288] windows pyinstaller shim. the final loader will be moved into the packed directory later. [0272ecf] try alternative way of getting cuda toolkit 12.4 since jimver wont work, also fix rocm try again (+3 squashed commit) Squashed commit: [133e816] try without pwsh [4d99cef] try without pwsh [bdfa91e] try alternative way of getting cuda toolkit 12.4, also fix rocm
1 parent 28b35ca commit 8386546

File tree

5 files changed

+60
-13
lines changed

5 files changed

+60
-13
lines changed

.github/workflows/kcpp-build-release-win.yaml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,40 @@ jobs:
4040
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -products * -format json
4141
shell: pwsh
4242

43+
- name: Visual Studio 2019 Reinstall
44+
shell: cmd
45+
run: |
46+
@echo off
47+
echo Preparing setup
48+
curl -fLO https://download.visualstudio.microsoft.com/download/pr/1fbe074b-8ae1-4e9b-8e83-d1ce4200c9d1/61098e228df7ba3a6a8b4e920a415ad8878d386de6dd0f23f194fe1a55db189a/vs_Enterprise.exe
49+
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
50+
echo Waiting for VS2019 setup
51+
set "ProcessName=setup.exe"
52+
:CheckProcess
53+
tasklist /FI "IMAGENAME eq %ProcessName%" | find /I "%ProcessName%" >nul
54+
if %errorlevel%==0 (
55+
ping 127.0.0.1 /n 5 >nul
56+
goto CheckProcess
57+
)
58+
echo VS2019 Setup completed
59+
exit /b 0
60+
61+
- uses: Jimver/[email protected]
62+
id: cuda-toolkit
63+
with:
64+
cuda: '12.1.0'
65+
use-github-cache: false
66+
67+
- name: Disable Visual Studio 2022 by Renaming
68+
run: |
69+
Rename-Item "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" "Enterprise_DISABLED"
70+
shell: pwsh
71+
72+
- name: Display full Visual Studio info After
73+
run: |
74+
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -products * -format json
75+
shell: pwsh
76+
4377
- name: Download and install win64devkit
4478
run: |
4579
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:
6397
run: |
6498
make LLAMA_CLBLAST=1 LLAMA_VULKAN=1 LLAMA_PORTABLE=1 -j ${env:NUMBER_OF_PROCESSORS}
6599
66-
- uses: Jimver/[email protected]
67-
id: cuda-toolkit
68-
with:
69-
cuda: '12.4.0'
70-
use-github-cache: false
71-
72100
- name: Build CUDA
73101
id: cmake_build
74102
run: |
@@ -86,8 +114,8 @@ jobs:
86114
# ls
87115
- name: Copy CuBLAS Libraries
88116
run: |
89-
copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\cublasLt64_12.dll" .
90-
copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\cublas64_12.dll" .
117+
copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\cublasLt64_12.dll" .
118+
copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\cublas64_12.dll" .
91119
ls
92120
93121
- name: Package PyInstallers

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ endif
252252
HCXX := $(ROCM_PATH)/bin/hipcc
253253
else
254254
ROCM_PATH ?= /opt/rocm
255+
ifdef LLAMA_PORTABLE
255256
GPU_TARGETS ?= gfx803 gfx900 gfx906 gfx908 gfx90a gfx942 gfx1010 gfx1030 gfx1031 gfx1032 gfx1100 gfx1101 gfx1102 gfx1200 gfx1201 $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch)
257+
else
258+
GPU_TARGETS ?= $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch)
259+
endif
256260
HCC := $(ROCM_PATH)/llvm/bin/clang
257261
HCXX := $(ROCM_PATH)/llvm/bin/clang++
258262
endif

koboldcpp.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,15 +660,19 @@ def unpack_to_dir(destpath = ""):
660660
print(f"KoboldCpp will be extracted to {destpath}\nThis process may take several seconds to complete.")
661661
else:
662662
messagebox.showinfo("Unpack Starting", f"KoboldCpp will be extracted to {destpath}\nThis process may take several seconds to complete.")
663+
pyds_dir = os.path.join(destpath, 'pyds')
664+
os.makedirs(pyds_dir, exist_ok=True)
663665
for item in os.listdir(srcpath):
664666
s = os.path.join(srcpath, item)
665667
d = os.path.join(destpath, item)
666-
if item.endswith('.pyd'): # Skip .pyd files
667-
continue
668-
if os.path.isdir(s):
669-
shutil.copytree(s, d, False, None)
670-
else:
668+
if item.endswith('.pyd'): # relocate pyds files to subdirectory
669+
d = os.path.join(pyds_dir, item)
671670
shutil.copy2(s, d)
671+
else:
672+
if os.path.isdir(s):
673+
shutil.copytree(s, d, False, None)
674+
else:
675+
shutil.copy2(s, d)
672676
if cliunpack:
673677
print(f"KoboldCpp successfully extracted to {destpath}")
674678
else:

make_pyinstaller_shim.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PyInstaller --onedir --noconfirm --clean --console --runtime-hook "./tools/kcpplauncherhook.py" --icon "./niko.ico" --version-file "./version.txt" "./koboldcpp.py" -n "koboldcpp-loader.exe"

tools/kcpplauncherhook.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import os
2+
import sys
3+
4+
# Determine the folder where the .pyd files will be located
5+
pyd_subdir = os.path.join(sys._MEIPASS, 'pyds')
6+
7+
# Add the subfolder to sys.path so Python can find the .pyd modules
8+
print("Augmenting PYD directory...")
9+
if os.path.isdir(pyd_subdir):
10+
sys.path.insert(0, pyd_subdir)

0 commit comments

Comments
 (0)