|
9 | 9 | import os
|
10 | 10 | import argparse
|
11 | 11 | import json, sys, http.server, time, asyncio, socket, threading
|
| 12 | +import re |
12 | 13 | from concurrent.futures import ThreadPoolExecutor
|
13 | 14 |
|
14 | 15 | stop_token_max = 10
|
@@ -764,21 +765,27 @@ def getfilename(var, text):
|
764 | 765 | quick_gpu_layers_entry,quick_gpu_layers_label = makelabelentry(quick_tab,"GPU Layers:", gpulayers_var, 4, 50)
|
765 | 766 | quick_gpu_selector_label = makelabel(quick_tab, "GPU ID:", 3)
|
766 | 767 | quick_gpu_selector_box = ctk.CTkComboBox(quick_tab, values=["1","2","3"], width=60, variable=gpu_choice_var, state="readonly")
|
| 768 | + CUDA_quick_gpu_selector_box = ctk.CTkComboBox(quick_tab, values=["1","2","3","All"], width=60, variable=gpu_choice_var, state="readonly") |
767 | 769 | quick_lowvram_box = makecheckbox(quick_tab, "Low VRAM", lowvram_var, 5)
|
768 | 770 |
|
769 |
| - # hides gpu options when CLBlast is not chosen |
770 | 771 | def changerunmode(a,b,c):
|
771 | 772 | index = runopts_var.get()
|
772 | 773 | if index == "Use CLBlast" or index == "Use CuBLAS":
|
773 | 774 | gpu_selector_label.grid(row=3, column=0, padx = 8, pady=1, stick="nw")
|
774 |
| - gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") |
775 | 775 | quick_gpu_selector_label.grid(row=3, column=0, padx = 8, pady=1, stick="nw")
|
776 |
| - quick_gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") |
| 776 | + if index == "Use CLBlast": |
| 777 | + gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") |
| 778 | + quick_gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") |
| 779 | + elif index == "Use CuBLAS": |
| 780 | + CUDA_gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") |
| 781 | + CUDA_quick_gpu_selector_box.grid(row=3, column=1, padx=8, pady=1, stick="nw") |
777 | 782 | else:
|
778 | 783 | gpu_selector_label.grid_forget()
|
779 | 784 | gpu_selector_box.grid_forget()
|
| 785 | + CUDA_gpu_selector_box.grid_forget() |
780 | 786 | quick_gpu_selector_label.grid_forget()
|
781 | 787 | quick_gpu_selector_box.grid_forget()
|
| 788 | + CUDA_quick_gpu_selector_box.grid_forget() |
782 | 789 |
|
783 | 790 | if index == "Use CuBLAS":
|
784 | 791 | lowvram_box.grid(row=4, column=0, padx=8, pady=1, stick="nw")
|
@@ -829,6 +836,7 @@ def changerunmode(a,b,c):
|
829 | 836 | gpu_layers_entry,gpu_layers_label = makelabelentry(hardware_tab,"GPU Layers:", gpulayers_var, 4, 50)
|
830 | 837 | gpu_selector_label = makelabel(hardware_tab, "GPU ID:", 3)
|
831 | 838 | gpu_selector_box = ctk.CTkComboBox(hardware_tab, values=["1","2","3"], width=60, variable=gpu_choice_var, state="readonly")
|
| 839 | + CUDA_gpu_selector_box = ctk.CTkComboBox(hardware_tab, values=["1","2","3", "All"], width=60, variable=gpu_choice_var, state="readonly") |
832 | 840 | lowvram_box = makecheckbox(hardware_tab, "Low VRAM", lowvram_var, 5)
|
833 | 841 |
|
834 | 842 | # presets selector
|
@@ -958,12 +966,18 @@ def switch_old_gui():
|
958 | 966 | args.stream = stream.get()==1
|
959 | 967 | args.smartcontext = smartcontext.get()==1
|
960 | 968 | args.unbantokens = unbantokens.get()==1
|
| 969 | + gpu_choice_str = gpu_choice_var.get() |
| 970 | + if gpu_choice_str.isdigit(): |
| 971 | + gpuchoiceidx = int(gpu_choice_var.get())-1 |
961 | 972 |
|
962 |
| - gpuchoiceidx = int(gpu_choice_var.get())-1 |
963 | 973 | if runopts_var.get() == runopts[1]:
|
964 | 974 | args.useclblast = [[0,0], [1,0], [0,1]][gpuchoiceidx]
|
965 | 975 | if runopts_var.get() == runopts[2]:
|
966 |
| - args.usecublas = ["lowvram",str(gpuchoiceidx)] if lowvram_var.get() == 1 else ["normal",str(gpuchoiceidx)] |
| 976 | + if gpu_choice_str.lower() == "all": |
| 977 | + args.usecublas = ["lowvram"] if lowvram_var.get() == 1 else ["normal"] |
| 978 | + else: |
| 979 | + args.usecublas = ["lowvram",str(gpuchoiceidx)] if lowvram_var.get() == 1 else ["normal",str(gpuchoiceidx)] |
| 980 | + |
967 | 981 | if gpulayers_var.get():
|
968 | 982 | args.gpulayers = int(gpulayers_var.get())
|
969 | 983 | if runopts_var.get()==runopts[3]:
|
@@ -1329,7 +1343,7 @@ def main(args):
|
1329 | 1343 | compatgroup = parser.add_mutually_exclusive_group()
|
1330 | 1344 | compatgroup.add_argument("--noblas", help="Do not use OpenBLAS for accelerated prompt ingestion", action='store_true')
|
1331 | 1345 | compatgroup.add_argument("--useclblast", help="Use CLBlast for GPU Acceleration. Must specify exactly 2 arguments, platform ID and device ID (e.g. --useclblast 1 0).", type=int, choices=range(0,9), nargs=2)
|
1332 |
| - compatgroup.add_argument("--usecublas", help="Use CuBLAS for GPU Acceleration. Requires Nvidia GPU. Select lowvram to not allocate VRAM scratch buffer. Enter a number after to select a different main GPU.", nargs='*',metavar=('[lowvram|normal] [main GPU ID]'), choices=['normal', 'lowvram', '0', '1', '2']) |
| 1346 | + compatgroup.add_argument("--usecublas", help="Use CuBLAS for GPU Acceleration. Requires CUDA. Select lowvram to not allocate VRAM scratch buffer. Enter a number afterwards to select and use 1 GPU. Leaving no number will use all GPUs.", nargs='*',metavar=('[lowvram|normal] [main GPU ID]'), choices=['normal', 'lowvram', '0', '1', '2']) |
1333 | 1347 | parser.add_argument("--gpulayers", help="Set number of layers to offload to GPU when using GPU. Requires GPU.",metavar=('[GPU layers]'), type=int, default=0)
|
1334 | 1348 | args = parser.parse_args()
|
1335 | 1349 | main(args)
|
0 commit comments