added noavx2 model for clblast (+1 squashed commits)

Squashed commits:

[291ecae6] added noavx2 mode for clblast (+1 squashed commits)

Squashed commits:

[562bc872] wip adding noavx2 cl
This commit is contained in:
Concedo 2023-11-02 14:53:01 +08:00
parent 82267e5e69
commit fca7a4c054
8 changed files with 75 additions and 27 deletions

2
.gitignore vendored
View file

@ -96,12 +96,14 @@ tests/test-tokenizer-1-bpe
/koboldcpp_openblas.so /koboldcpp_openblas.so
/koboldcpp_noavx2.so /koboldcpp_noavx2.so
/koboldcpp_clblast.so /koboldcpp_clblast.so
/koboldcpp_clblast_noavx2.so
/koboldcpp_cublas.so /koboldcpp_cublas.so
/koboldcpp_default.dll /koboldcpp_default.dll
/koboldcpp_failsafe.dll /koboldcpp_failsafe.dll
/koboldcpp_openblas.dll /koboldcpp_openblas.dll
/koboldcpp_noavx2.dll /koboldcpp_noavx2.dll
/koboldcpp_clblast.dll /koboldcpp_clblast.dll
/koboldcpp_clblast_noavx2.dll
/koboldcpp_cublas.dll /koboldcpp_cublas.dll
/cublas64_11.dll /cublas64_11.dll
/cublasLt64_11.dll /cublasLt64_11.dll

View file

@ -1,4 +1,4 @@
default: koboldcpp_default koboldcpp_failsafe koboldcpp_openblas koboldcpp_noavx2 koboldcpp_clblast koboldcpp_cublas koboldcpp_hipblas default: koboldcpp_default koboldcpp_failsafe koboldcpp_openblas koboldcpp_noavx2 koboldcpp_clblast koboldcpp_clblast_noavx2 koboldcpp_cublas koboldcpp_hipblas
tools: quantize_gpt2 quantize_gptj quantize_llama quantize_neox quantize_mpt tools: quantize_gpt2 quantize_gptj quantize_llama quantize_neox quantize_mpt
dev: koboldcpp_openblas dev: koboldcpp_openblas
dev2: koboldcpp_clblast dev2: koboldcpp_clblast
@ -347,6 +347,8 @@ ggml_clblast.o: ggml.c ggml.h ggml-cuda.h
$(CC) $(CFLAGS) $(FULLCFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(FULLCFLAGS) $(CLBLAST_FLAGS) -c $< -o $@
ggml_cublas.o: ggml.c ggml.h ggml-cuda.h ggml_cublas.o: ggml.c ggml.h ggml-cuda.h
$(CC) $(CFLAGS) $(FULLCFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(FULLCFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@
ggml_clblast_noavx2.o: ggml.c ggml.h ggml-cuda.h
$(CC) $(CFLAGS) $(SIMPLECFLAGS) $(CLBLAST_FLAGS) -c $< -o $@
#quants #quants
ggml-quants.o: ggml-quants.c ggml.h ggml-quants.h ggml-cuda.h ggml-quants.o: ggml-quants.c ggml.h ggml-quants.h ggml-cuda.h
@ -376,6 +378,8 @@ ggml_v2_clblast.o: otherarch/ggml_v2.c otherarch/ggml_v2.h
$(CC) $(CFLAGS) $(FULLCFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(FULLCFLAGS) $(CLBLAST_FLAGS) -c $< -o $@
ggml_v2_cublas.o: otherarch/ggml_v2.c otherarch/ggml_v2.h ggml_v2_cublas.o: otherarch/ggml_v2.c otherarch/ggml_v2.h
$(CC) $(CFLAGS) $(FULLCFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(FULLCFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@
ggml_v2_clblast_noavx2.o: otherarch/ggml_v2.c otherarch/ggml_v2.h
$(CC) $(CFLAGS) $(SIMPLECFLAGS) $(CLBLAST_FLAGS) -c $< -o $@
#extreme old version compat #extreme old version compat
ggml_v1.o: otherarch/ggml_v1.c otherarch/ggml_v1.h ggml_v1.o: otherarch/ggml_v1.c otherarch/ggml_v1.h
@ -413,9 +417,11 @@ gpttype_adapter_clblast.o: $(GPTTYPE_ADAPTER)
$(CXX) $(CXXFLAGS) $(CLBLAST_FLAGS) -c $< -o $@ $(CXX) $(CXXFLAGS) $(CLBLAST_FLAGS) -c $< -o $@
gpttype_adapter_cublas.o: $(GPTTYPE_ADAPTER) gpttype_adapter_cublas.o: $(GPTTYPE_ADAPTER)
$(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@ $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@
gpttype_adapter_clblast_noavx2.o: $(GPTTYPE_ADAPTER)
$(CXX) $(CXXFLAGS) $(FAILSAFE_FLAGS) $(CLBLAST_FLAGS) -c $< -o $@
clean: clean:
rm -vf *.o main quantize_llama quantize_gpt2 quantize_gptj quantize_neox quantize_mpt quantize-stats perplexity embedding benchmark-matmult save-load-state gguf gguf.exe main.exe quantize_llama.exe quantize_gptj.exe quantize_gpt2.exe quantize_neox.exe quantize_mpt.exe koboldcpp_default.dll koboldcpp_openblas.dll koboldcpp_failsafe.dll koboldcpp_noavx2.dll koboldcpp_clblast.dll koboldcpp_cublas.dll koboldcpp_hipblas.dll koboldcpp_default.so koboldcpp_openblas.so koboldcpp_failsafe.so koboldcpp_noavx2.so koboldcpp_clblast.so koboldcpp_cublas.so koboldcpp_hipblas.so rm -vf *.o main quantize_llama quantize_gpt2 quantize_gptj quantize_neox quantize_mpt quantize-stats perplexity embedding benchmark-matmult save-load-state gguf gguf.exe main.exe quantize_llama.exe quantize_gptj.exe quantize_gpt2.exe quantize_neox.exe quantize_mpt.exe koboldcpp_default.dll koboldcpp_openblas.dll koboldcpp_failsafe.dll koboldcpp_noavx2.dll koboldcpp_clblast.dll koboldcpp_clblast_noavx2.dll koboldcpp_cublas.dll koboldcpp_hipblas.dll koboldcpp_default.so koboldcpp_openblas.so koboldcpp_failsafe.so koboldcpp_noavx2.so koboldcpp_clblast.so koboldcpp_clblast_noavx2.so koboldcpp_cublas.so koboldcpp_hipblas.so
main: examples/main/main.cpp common/sampling.cpp build-info.h ggml.o ggml-quants.o ggml-alloc.o ggml-backend.o llama.o common.o console.o grammar-parser.o $(OBJS) main: examples/main/main.cpp common/sampling.cpp build-info.h ggml.o ggml-quants.o ggml-alloc.o ggml-backend.o llama.o common.o console.o grammar-parser.o $(OBJS)
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
@ -458,9 +464,13 @@ endif
ifdef CLBLAST_BUILD ifdef CLBLAST_BUILD
koboldcpp_clblast: ggml_clblast.o ggml_v2_clblast.o ggml_v1.o expose.o common.o gpttype_adapter_clblast.o ggml-opencl.o ggml_v2-opencl.o ggml_v2-opencl-legacy.o ggml-quants.o ggml-alloc.o ggml-backend.o grammar-parser.o $(OBJS) koboldcpp_clblast: ggml_clblast.o ggml_v2_clblast.o ggml_v1.o expose.o common.o gpttype_adapter_clblast.o ggml-opencl.o ggml_v2-opencl.o ggml_v2-opencl-legacy.o ggml-quants.o ggml-alloc.o ggml-backend.o grammar-parser.o $(OBJS)
$(CLBLAST_BUILD) $(CLBLAST_BUILD)
koboldcpp_clblast_noavx2: ggml_clblast_noavx2.o ggml_v2_clblast_noavx2.o ggml_v1_failsafe.o expose.o common.o gpttype_adapter_clblast_noavx2.o ggml-opencl.o ggml_v2-opencl.o ggml_v2-opencl-legacy.o ggml-quants_noavx2.o ggml-alloc.o ggml-backend.o grammar-parser.o $(OBJS)
$(CLBLAST_BUILD)
else else
koboldcpp_clblast: koboldcpp_clblast:
$(DONOTHING) $(DONOTHING)
koboldcpp_clblast_noavx2:
$(DONOTHING)
endif endif
ifdef CUBLAS_BUILD ifdef CUBLAS_BUILD

View file

@ -108,13 +108,14 @@ lib_failsafe = pick_existant_file("koboldcpp_failsafe.dll","koboldcpp_failsafe.s
lib_openblas = pick_existant_file("koboldcpp_openblas.dll","koboldcpp_openblas.so") lib_openblas = pick_existant_file("koboldcpp_openblas.dll","koboldcpp_openblas.so")
lib_noavx2 = pick_existant_file("koboldcpp_noavx2.dll","koboldcpp_noavx2.so") lib_noavx2 = pick_existant_file("koboldcpp_noavx2.dll","koboldcpp_noavx2.so")
lib_clblast = pick_existant_file("koboldcpp_clblast.dll","koboldcpp_clblast.so") lib_clblast = pick_existant_file("koboldcpp_clblast.dll","koboldcpp_clblast.so")
lib_clblast_noavx2 = pick_existant_file("koboldcpp_clblast_noavx2.dll","koboldcpp_clblast_noavx2.so")
lib_cublas = pick_existant_file("koboldcpp_cublas.dll","koboldcpp_cublas.so") lib_cublas = pick_existant_file("koboldcpp_cublas.dll","koboldcpp_cublas.so")
lib_hipblas = pick_existant_file("koboldcpp_hipblas.dll","koboldcpp_hipblas.so") lib_hipblas = pick_existant_file("koboldcpp_hipblas.dll","koboldcpp_hipblas.so")
def init_library(): def init_library():
global handle, args global handle, args
global lib_default,lib_failsafe,lib_openblas,lib_noavx2,lib_clblast,lib_cublas global lib_default,lib_failsafe,lib_openblas,lib_noavx2,lib_clblast,lib_clblast_noavx2,lib_cublas,lib_hipblas
libname = "" libname = ""
use_openblas = False # if true, uses OpenBLAS for acceleration. libopenblas.dll must exist in the same dir. use_openblas = False # if true, uses OpenBLAS for acceleration. libopenblas.dll must exist in the same dir.
@ -125,13 +126,20 @@ def init_library():
use_failsafe = False #uses no intrinsics, failsafe mode use_failsafe = False #uses no intrinsics, failsafe mode
if args.noavx2: if args.noavx2:
use_noavx2 = True use_noavx2 = True
if not file_exists(lib_noavx2): if args.useclblast:
print("Warning: NoAVX2 library file not found. Failsafe library will be used.") if not file_exists(lib_clblast_noavx2) or (os.name=='nt' and not file_exists("clblast.dll")):
elif (args.noblas and args.nommap): print("Warning: NoAVX2 CLBlast library file not found. Non-BLAS library will be used.")
use_failsafe = True else:
print("!!! Attempting to use FAILSAFE MODE !!!") print("Attempting to use NoAVX2 CLBlast library for faster prompt ingestion. A compatible clblast will be required.")
use_clblast = True
else: else:
print("Attempting to use non-avx2 compatibility library.") if not file_exists(lib_noavx2):
print("Warning: NoAVX2 library file not found. Failsafe library will be used.")
elif (args.noblas and args.nommap):
use_failsafe = True
print("!!! Attempting to use FAILSAFE MODE !!!")
else:
print("Attempting to use non-avx2 compatibility library.")
elif args.useclblast: elif args.useclblast:
if not file_exists(lib_clblast) or (os.name=='nt' and not file_exists("clblast.dll")): if not file_exists(lib_clblast) or (os.name=='nt' and not file_exists("clblast.dll")):
print("Warning: CLBlast library file not found. Non-BLAS library will be used.") print("Warning: CLBlast library file not found. Non-BLAS library will be used.")
@ -163,6 +171,8 @@ def init_library():
if use_noavx2: if use_noavx2:
if use_failsafe: if use_failsafe:
libname = lib_failsafe libname = lib_failsafe
elif use_clblast:
libname = lib_clblast_noavx2
else: else:
libname = lib_noavx2 libname = lib_noavx2
else: else:
@ -871,6 +881,7 @@ def RunServerMultiThreaded(addr, port, embedded_kailite = None, embedded_kcpp_do
try: try:
time.sleep(10) time.sleep(10)
except KeyboardInterrupt: except KeyboardInterrupt:
global exitcounter
exitcounter = 999 exitcounter = 999
for i in range(numThreads): for i in range(numThreads):
threadArr[i].stop() threadArr[i].stop()
@ -891,6 +902,8 @@ def show_new_gui():
if args.model_param and args.model_param!="" and args.model_param.lower().endswith('.kcpps'): if args.model_param and args.model_param!="" and args.model_param.lower().endswith('.kcpps'):
loadconfigfile(args.model_param) loadconfigfile(args.model_param)
if not args.model_param: if not args.model_param:
global exitcounter
exitcounter = 999
print("\nNo ggml model or kcpps file was selected. Exiting.") print("\nNo ggml model or kcpps file was selected. Exiting.")
time.sleep(3) time.sleep(3)
sys.exit(2) sys.exit(2)
@ -931,9 +944,10 @@ def show_new_gui():
(lib_cublas, "Use CuBLAS"), (lib_cublas, "Use CuBLAS"),
(lib_hipblas, "Use hipBLAS (ROCm)"), (lib_hipblas, "Use hipBLAS (ROCm)"),
(lib_default, "Use No BLAS"), (lib_default, "Use No BLAS"),
(lib_clblast_noavx2, "CLBlast NoAVX2 (Old CPU)"),
(lib_noavx2, "NoAVX2 Mode (Old CPU)"), (lib_noavx2, "NoAVX2 Mode (Old CPU)"),
(lib_failsafe, "Failsafe Mode (Old CPU)")] (lib_failsafe, "Failsafe Mode (Old CPU)")]
openblas_option, clblast_option, cublas_option, hipblas_option, default_option, noavx2_option, failsafe_option = (opt if file_exists(lib) or (os.name == 'nt' and file_exists(opt + ".dll")) else None for lib, opt in lib_option_pairs) openblas_option, clblast_option, cublas_option, hipblas_option, default_option, clblast_noavx2_option, noavx2_option, failsafe_option = (opt if file_exists(lib) or (os.name == 'nt' and file_exists(opt + ".dll")) else None for lib, opt in lib_option_pairs)
# slider data # slider data
blasbatchsize_values = ["-1", "32", "64", "128", "256", "512", "1024", "2048"] blasbatchsize_values = ["-1", "32", "64", "128", "256", "512", "1024", "2048"]
blasbatchsize_text = ["Don't Batch BLAS","32","64","128","256","512","1024","2048"] blasbatchsize_text = ["Don't Batch BLAS","32","64","128","256","512","1024","2048"]
@ -943,7 +957,9 @@ def show_new_gui():
if os.name != 'nt': if os.name != 'nt':
antirunopts.remove("NoAVX2 Mode (Old CPU)") antirunopts.remove("NoAVX2 Mode (Old CPU)")
antirunopts.remove("Failsafe Mode (Old CPU)") antirunopts.remove("Failsafe Mode (Old CPU)")
antirunopts.remove("CLBlast NoAVX2 (Old CPU)")
if not any(runopts): if not any(runopts):
exitcounter = 999
show_gui_msgbox("No Backends Available!","KoboldCPP couldn't locate any backends to use (i.e Default, OpenBLAS, CLBlast, CuBLAS).\n\nTo use the program, please run the 'make' command from the directory.") show_gui_msgbox("No Backends Available!","KoboldCPP couldn't locate any backends to use (i.e Default, OpenBLAS, CLBlast, CuBLAS).\n\nTo use the program, please run the 'make' command from the directory.")
time.sleep(3) time.sleep(3)
sys.exit(2) sys.exit(2)
@ -1149,18 +1165,23 @@ def show_new_gui():
tooltip.withdraw() tooltip.withdraw()
def setup_backend_tooltip(parent): def setup_backend_tooltip(parent):
num_backends_built = makelabel(parent, str(len(runopts)) + f"/{6 if os.name == 'nt' else 4}", 5, 2) num_backends_built = makelabel(parent, str(len(runopts)) + f"/{7 if os.name == 'nt' else 4}", 5, 2)
num_backends_built.grid(row=1, column=1, padx=195, pady=0) num_backends_built.grid(row=1, column=1, padx=195, pady=0)
num_backends_built.configure(text_color="#00ff00") num_backends_built.configure(text_color="#00ff00")
# Bind the backend count label with the tooltip function # Bind the backend count label with the tooltip function
num_backends_built.bind("<Enter>", lambda event: show_tooltip(event, f"This is the number of backends you have built and available." + (f"\nMissing: {', '.join(antirunopts)}" if len(runopts) != 6 else ""))) nl = '\n'
num_backends_built.bind("<Enter>", lambda event: show_tooltip(event, f"Number of backends you have built and available." + (f"\n\nMissing Backends: \n\n{nl.join(antirunopts)}" if len(runopts) != 6 else "")))
num_backends_built.bind("<Leave>", hide_tooltip) num_backends_built.bind("<Leave>", hide_tooltip)
def changed_gpu_choice_var(*args): def changed_gpu_choice_var(*args):
global exitcounter
if exitcounter > 100:
return
if gpu_choice_var.get()!="All": if gpu_choice_var.get()!="All":
try: try:
s = int(gpu_choice_var.get())-1 s = int(gpu_choice_var.get())-1
if runopts_var.get() == "Use CLBlast": v = runopts_var.get()
if v == "Use CLBlast" or v == "CLBlast NoAVX2 (Old CPU)":
quick_gpuname_label.configure(text=CLDevicesNames[s]) quick_gpuname_label.configure(text=CLDevicesNames[s])
gpuname_label.configure(text=CLDevicesNames[s]) gpuname_label.configure(text=CLDevicesNames[s])
else: else:
@ -1176,12 +1197,12 @@ def show_new_gui():
def changerunmode(a,b,c): def changerunmode(a,b,c):
index = runopts_var.get() index = runopts_var.get()
if index == "Use CLBlast" or index == "Use CuBLAS" or index == "Use hipBLAS (ROCm)": if index == "Use CLBlast" or index == "CLBlast NoAVX2 (Old CPU)" or index == "Use CuBLAS" or index == "Use hipBLAS (ROCm)":
quick_gpuname_label.grid(row=3, column=1, padx=75, sticky="W") quick_gpuname_label.grid(row=3, column=1, padx=75, sticky="W")
gpuname_label.grid(row=3, column=1, padx=75, sticky="W") gpuname_label.grid(row=3, column=1, padx=75, sticky="W")
gpu_selector_label.grid(row=3, column=0, padx = 8, pady=1, stick="nw") gpu_selector_label.grid(row=3, column=0, padx = 8, pady=1, stick="nw")
quick_gpu_selector_label.grid(row=3, column=0, padx = 8, pady=1, stick="nw") quick_gpu_selector_label.grid(row=3, column=0, padx = 8, pady=1, stick="nw")
if index == "Use CLBlast": if index == "Use CLBlast" or index == "CLBlast NoAVX2 (Old CPU)":
gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw")
quick_gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") quick_gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw")
if gpu_choice_var.get()=="All": if gpu_choice_var.get()=="All":
@ -1214,7 +1235,7 @@ def show_new_gui():
tensor_split_label.grid_forget() tensor_split_label.grid_forget()
tensor_split_entry.grid_forget() tensor_split_entry.grid_forget()
if index == "Use CLBlast" or index == "Use CuBLAS" or index == "Use hipBLAS (ROCm)": if index == "Use CLBlast" or index == "CLBlast NoAVX2 (Old CPU)" or index == "Use CuBLAS" or index == "Use hipBLAS (ROCm)":
gpu_layers_label.grid(row=5, column=0, padx = 8, pady=1, stick="nw") gpu_layers_label.grid(row=5, column=0, padx = 8, pady=1, stick="nw")
gpu_layers_entry.grid(row=5, column=1, padx=8, pady=1, stick="nw") gpu_layers_entry.grid(row=5, column=1, padx=8, pady=1, stick="nw")
quick_gpu_layers_label.grid(row=5, column=0, padx = 8, pady=1, stick="nw") quick_gpu_layers_label.grid(row=5, column=0, padx = 8, pady=1, stick="nw")
@ -1397,7 +1418,7 @@ def show_new_gui():
gpuchoiceidx = 0 gpuchoiceidx = 0
if gpu_choice_var.get()!="All": if gpu_choice_var.get()!="All":
gpuchoiceidx = int(gpu_choice_var.get())-1 gpuchoiceidx = int(gpu_choice_var.get())-1
if runopts_var.get() == "Use CLBlast": if runopts_var.get() == "Use CLBlast" or runopts_var.get() == "CLBlast NoAVX2 (Old CPU)":
args.useclblast = [[0,0], [1,0], [0,1], [1,1]][gpuchoiceidx] args.useclblast = [[0,0], [1,0], [0,1], [1,1]][gpuchoiceidx]
if runopts_var.get() == "Use CuBLAS" or runopts_var.get() == "Use hipBLAS (ROCm)": if runopts_var.get() == "Use CuBLAS" or runopts_var.get() == "Use hipBLAS (ROCm)":
if gpu_choice_var.get()=="All": if gpu_choice_var.get()=="All":
@ -1459,9 +1480,14 @@ def show_new_gui():
remotetunnel.set(1 if "remotetunnel" in dict and dict["remotetunnel"] else 0) remotetunnel.set(1 if "remotetunnel" in dict and dict["remotetunnel"] else 0)
keepforeground.set(1 if "foreground" in dict and dict["foreground"] else 0) keepforeground.set(1 if "foreground" in dict and dict["foreground"] else 0)
if "useclblast" in dict and dict["useclblast"]: if "useclblast" in dict and dict["useclblast"]:
if clblast_option is not None: if "noavx2" in dict and dict["noavx2"]:
runopts_var.set(clblast_option) if clblast_noavx2_option is not None:
gpu_choice_var.set(str(["0 0", "1 0", "0 1", "1 1"].index(str(dict["useclblast"][0]) + " " + str(dict["useclblast"][1])) + 1)) runopts_var.set(clblast_noavx2_option)
gpu_choice_var.set(str(["0 0", "1 0", "0 1", "1 1"].index(str(dict["useclblast"][0]) + " " + str(dict["useclblast"][1])) + 1))
else:
if clblast_option is not None:
runopts_var.set(clblast_option)
gpu_choice_var.set(str(["0 0", "1 0", "0 1", "1 1"].index(str(dict["useclblast"][0]) + " " + str(dict["useclblast"][1])) + 1))
elif "usecublas" in dict and dict["usecublas"]: elif "usecublas" in dict and dict["usecublas"]:
if cublas_option is not None or hipblas_option is not None: if cublas_option is not None or hipblas_option is not None:
if cublas_option: if cublas_option:
@ -1585,14 +1611,16 @@ def show_new_gui():
root.mainloop() root.mainloop()
if nextstate==0: if nextstate==0:
exitcounter = 999
print("Exiting by user request.") print("Exiting by user request.")
time.sleep(3) time.sleep(3)
sys.exit() sys.exit(0)
else: else:
# processing vars # processing vars
export_vars() export_vars()
if not args.model_param: if not args.model_param:
exitcounter = 999
print("\nNo ggml model file was selected. Exiting.") print("\nNo ggml model file was selected. Exiting.")
time.sleep(3) time.sleep(3)
sys.exit(2) sys.exit(2)
@ -1766,10 +1794,10 @@ def run_horde_worker(args, api_key, worker_name):
if exitcounter<100: if exitcounter<100:
print_with_time(f"Horde Worker Shutdown - Too many errors.") print_with_time(f"Horde Worker Shutdown - Too many errors.")
time.sleep(3)
else: else:
print_with_time(f"Horde Worker Shutdown - Server Closing.") print_with_time(f"Horde Worker Shutdown - Server Closing.")
time.sleep(3) exitcounter = 999
time.sleep(3)
sys.exit(2) sys.exit(2)
def setuptunnel(): def setuptunnel():
@ -1901,6 +1929,8 @@ def main(launch_args,start_server=True):
if isinstance(args.config[0], str) and os.path.exists(args.config[0]): if isinstance(args.config[0], str) and os.path.exists(args.config[0]):
loadconfigfile(args.config[0]) loadconfigfile(args.config[0])
else: else:
global exitcounter
exitcounter = 999
print("Specified kcpp config file invalid or not found.") print("Specified kcpp config file invalid or not found.")
time.sleep(3) time.sleep(3)
sys.exit(2) sys.exit(2)
@ -1919,6 +1949,7 @@ def main(launch_args,start_server=True):
try: try:
show_new_gui() show_new_gui()
except Exception as ex: except Exception as ex:
exitcounter = 999
ermsg = "Reason: " + str(ex) + "\nFile selection GUI unsupported.\ncustomtkinter python module required!\nPlease check command line: script.py --help" ermsg = "Reason: " + str(ex) + "\nFile selection GUI unsupported.\ncustomtkinter python module required!\nPlease check command line: script.py --help"
show_gui_msgbox("Warning, GUI failed to start",ermsg) show_gui_msgbox("Warning, GUI failed to start",ermsg)
time.sleep(3) time.sleep(3)
@ -1974,12 +2005,14 @@ def main(launch_args,start_server=True):
print("==========") print("==========")
time.sleep(1) time.sleep(1)
if not os.path.exists(args.model_param): if not os.path.exists(args.model_param):
exitcounter = 999
print(f"Cannot find model file: {args.model_param}") print(f"Cannot find model file: {args.model_param}")
time.sleep(3) time.sleep(3)
sys.exit(2) sys.exit(2)
if args.lora and args.lora[0]!="": if args.lora and args.lora[0]!="":
if not os.path.exists(args.lora[0]): if not os.path.exists(args.lora[0]):
exitcounter = 999
print(f"Cannot find lora file: {args.lora[0]}") print(f"Cannot find lora file: {args.lora[0]}")
time.sleep(3) time.sleep(3)
sys.exit(2) sys.exit(2)
@ -1987,6 +2020,7 @@ def main(launch_args,start_server=True):
args.lora[0] = os.path.abspath(args.lora[0]) args.lora[0] = os.path.abspath(args.lora[0])
if len(args.lora) > 1: if len(args.lora) > 1:
if not os.path.exists(args.lora[1]): if not os.path.exists(args.lora[1]):
exitcounter = 999
print(f"Cannot find lora base: {args.lora[1]}") print(f"Cannot find lora base: {args.lora[1]}")
time.sleep(3) time.sleep(3)
sys.exit(2) sys.exit(2)
@ -2003,6 +2037,7 @@ def main(launch_args,start_server=True):
print("Load Model OK: " + str(loadok)) print("Load Model OK: " + str(loadok))
if not loadok: if not loadok:
exitcounter = 999
print("Could not load model: " + modelname) print("Could not load model: " + modelname)
time.sleep(3) time.sleep(3)
sys.exit(3) sys.exit(3)

View file

@ -1,4 +1,4 @@
echo This file is only for my own usage, please do not use it. I am lazy. echo This file is only for my own usage, please do not use it. I am lazy.
set PATH=d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python;d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python\\Scripts;%PATH% set PATH=d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python;d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python\\Scripts;%PATH%
PyInstaller --noconfirm --onefile --clean --console --collect-all customtkinter --icon "./niko.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./clblast.dll;." --add-data "./rwkv_vocab.embd;." --add-data "./rwkv_world_vocab.embd;." "./koboldcpp.py" -n "koboldcpp_nocuda.exe" PyInstaller --noconfirm --onefile --clean --console --collect-all customtkinter --icon "./niko.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./koboldcpp_clblast_noavx2.dll;." --add-data "./clblast.dll;." --add-data "./rwkv_vocab.embd;." --add-data "./rwkv_world_vocab.embd;." "./koboldcpp.py" -n "koboldcpp_nocuda.exe"

View file

@ -1,4 +1,4 @@
echo This file is only for my own usage, please do not use it. I am lazy. echo This file is only for my own usage, please do not use it. I am lazy.
set PATH=d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python;d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python\\Scripts;%PATH% set PATH=d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python;d:\\MainApplications\\KoboldAIGPT\\KoboldAI-Horde-Bridge\\python\\Scripts;%PATH%
PyInstaller --noconfirm --onefile --clean --console --collect-all customtkinter --icon "./nikogreen.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./clblast.dll;." --add-data "./koboldcpp_cublas.dll;." --add-data "./cublas64_11.dll;." --add-data "./cublasLt64_11.dll;." --add-data "./cudart64_110.dll;." --add-data "./msvcp140.dll;." --add-data "./vcruntime140.dll;." --add-data "./vcruntime140_1.dll;." --add-data "./rwkv_vocab.embd;." --add-data "./rwkv_world_vocab.embd;." "./koboldcpp.py" -n "koboldcpp.exe" PyInstaller --noconfirm --onefile --clean --console --collect-all customtkinter --icon "./nikogreen.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./koboldcpp_clblast_noavx2.dll;." --add-data "./clblast.dll;." --add-data "./koboldcpp_cublas.dll;." --add-data "./cublas64_11.dll;." --add-data "./cublasLt64_11.dll;." --add-data "./cudart64_110.dll;." --add-data "./msvcp140.dll;." --add-data "./vcruntime140.dll;." --add-data "./vcruntime140_1.dll;." --add-data "./rwkv_vocab.embd;." --add-data "./rwkv_world_vocab.embd;." "./koboldcpp.py" -n "koboldcpp.exe"

View file

@ -1 +1 @@
PyInstaller --noconfirm --onefile --clean --console --collect-all customtkinter --icon "./niko.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./clblast.dll;." --add-data "./rwkv_vocab.embd;." --add-data "./rwkv_world_vocab.embd;." "./koboldcpp.py" -n "koboldcpp.exe" PyInstaller --noconfirm --onefile --clean --console --collect-all customtkinter --icon "./niko.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./koboldcpp_clblast_noavx2.dll;." --add-data "./clblast.dll;." --add-data "./rwkv_vocab.embd;." --add-data "./rwkv_world_vocab.embd;." "./koboldcpp.py" -n "koboldcpp.exe"

View file

@ -8,6 +8,7 @@ pyinstaller --noconfirm --onefile --clean --console --collect-all customtkinter
--add-data "./koboldcpp_failsafe.so:." \ --add-data "./koboldcpp_failsafe.so:." \
--add-data "./koboldcpp_noavx2.so:." \ --add-data "./koboldcpp_noavx2.so:." \
--add-data "./koboldcpp_clblast.so:." \ --add-data "./koboldcpp_clblast.so:." \
--add-data "./koboldcpp_clblast_noavx2.so:." \
--add-data "./rwkv_vocab.embd:." \ --add-data "./rwkv_vocab.embd:." \
--add-data "./rwkv_world_vocab.embd:." \ --add-data "./rwkv_world_vocab.embd:." \
"./koboldcpp.py" -n "koboldcpp" "./koboldcpp.py" -n "koboldcpp"

View file

@ -2,4 +2,4 @@ cd /d "%~dp0"
copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\cudart64_110.dll" .\ /Y copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\cudart64_110.dll" .\ /Y
copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\cublasLt64_11.dll" .\ /Y copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\cublasLt64_11.dll" .\ /Y
copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\cublas64_11.dll" .\ /Y copy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin\cublas64_11.dll" .\ /Y
PyInstaller --noconfirm --onefile --collect-all customtkinter --clean --console --icon ".\niko.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./clblast.dll;." --add-data "./koboldcpp_cublas.dll;." --add-data "./cudart64_110.dll;." --add-data "./cublasLt64_11.dll;." --add-data "./cublas64_11.dll;." --add-data "./rwkv_vocab.embd;." --add-data "C:/Windows/System32/msvcp140.dll;." --add-data "C:/Windows/System32/vcruntime140_1.dll;." "./koboldcpp.py" -n "koboldcpp.exe" PyInstaller --noconfirm --onefile --collect-all customtkinter --clean --console --icon ".\niko.ico" --add-data "./winclinfo.exe;." --add-data "./klite.embd;." --add-data "./kcpp_docs.embd;." --add-data "./koboldcpp_default.dll;." --add-data "./koboldcpp_openblas.dll;." --add-data "./koboldcpp_failsafe.dll;." --add-data "./koboldcpp_noavx2.dll;." --add-data "./libopenblas.dll;." --add-data "./koboldcpp_clblast.dll;." --add-data "./koboldcpp_clblast_noavx2.dll;." --add-data "./clblast.dll;." --add-data "./koboldcpp_cublas.dll;." --add-data "./cudart64_110.dll;." --add-data "./cublasLt64_11.dll;." --add-data "./cublas64_11.dll;." --add-data "./rwkv_vocab.embd;." --add-data "C:/Windows/System32/msvcp140.dll;." --add-data "C:/Windows/System32/vcruntime140_1.dll;." "./koboldcpp.py" -n "koboldcpp.exe"