@@ -304,7 +304,7 @@ def utfprint(str):
304
304
maxhordelen = 256
305
305
modelbusy = threading .Lock ()
306
306
defaultport = 5001
307
- KcppVersion = "1.39 .1"
307
+ KcppVersion = "1.40 .1"
308
308
showdebug = True
309
309
showsamplerwarning = True
310
310
showmaxctxwarning = True
@@ -496,7 +496,7 @@ def do_GET(self):
496
496
laste = handle .get_last_eval_time ()
497
497
lastc = handle .get_last_token_count ()
498
498
stopreason = handle .get_last_stop_reason ()
499
- response_body = (json .dumps ({"last_process" :lastp ,"last_eval" :laste ,"last_token_count" :lastc , "stop_reason" :stopreason }).encode ())
499
+ response_body = (json .dumps ({"last_process" :lastp ,"last_eval" :laste ,"last_token_count" :lastc , "stop_reason" :stopreason , "idle" :( 0 if modelbusy . locked () else 1 ) }).encode ())
500
500
501
501
if response_body is None :
502
502
self .send_response (404 )
@@ -674,7 +674,7 @@ def show_new_gui():
674
674
root .destroy ()
675
675
if not args .model_param :
676
676
print ("\n No ggml model file was selected. Exiting." )
677
- time .sleep (2 )
677
+ time .sleep (3 )
678
678
sys .exit (2 )
679
679
return
680
680
@@ -1306,7 +1306,7 @@ def display_help():
1306
1306
1307
1307
if nextstate == 0 :
1308
1308
print ("Exiting by user request." )
1309
- time .sleep (2 )
1309
+ time .sleep (3 )
1310
1310
sys .exit ()
1311
1311
elif nextstate == 2 :
1312
1312
time .sleep (0.1 )
@@ -1317,7 +1317,7 @@ def display_help():
1317
1317
1318
1318
if not args .model_param :
1319
1319
print ("\n No ggml model file was selected. Exiting." )
1320
- time .sleep (2 )
1320
+ time .sleep (3 )
1321
1321
sys .exit (2 )
1322
1322
1323
1323
def show_gui_warning (issue = None ):
@@ -1329,7 +1329,7 @@ def show_gui_warning(issue=None):
1329
1329
messagebox .showerror (title = "No Backends Available!" , message = "KoboldCPP couldn't locate any backends to use.\n \n To use the program, please run the 'make' command from the directory." )
1330
1330
root .destroy ()
1331
1331
print ("No Backend Available (i.e Default, OpenBLAS, CLBlast, CuBLAS). To use the program, please run the 'make' command from the directory." )
1332
- time .sleep (2 )
1332
+ time .sleep (3 )
1333
1333
sys .exit (2 )
1334
1334
else :
1335
1335
messagebox .showerror (title = "New GUI failed, using Old GUI" , message = "The new GUI failed to load.\n \n To use new GUI, please install the customtkinter python module." )
@@ -1423,7 +1423,7 @@ def onDropdownChange(event):
1423
1423
1424
1424
if launchclicked == False :
1425
1425
print ("Exiting by user request." )
1426
- time .sleep (2 )
1426
+ time .sleep (3 )
1427
1427
sys .exit ()
1428
1428
1429
1429
#load all the vars
@@ -1479,7 +1479,7 @@ def onDropdownChange(event):
1479
1479
root .destroy ()
1480
1480
if not args .model_param :
1481
1481
print ("\n No ggml model file was selected. Exiting." )
1482
- time .sleep (2 )
1482
+ time .sleep (3 )
1483
1483
sys .exit (2 )
1484
1484
1485
1485
else :
@@ -1489,7 +1489,7 @@ def onDropdownChange(event):
1489
1489
root .destroy ()
1490
1490
if not args .model_param :
1491
1491
print ("\n No ggml model file was selected. Exiting." )
1492
- time .sleep (2 )
1492
+ time .sleep (3 )
1493
1493
sys .exit (2 )
1494
1494
1495
1495
#A very simple and stripped down embedded horde worker with no dependencies
@@ -1534,7 +1534,7 @@ def make_url_request(url, data, method='POST'):
1534
1534
BRIDGE_AGENT = f"KoboldCppEmbedWorker:1:https://github.com/LostRuins/koboldcpp"
1535
1535
cluster = "https://horde.koboldai.net"
1536
1536
while exitcounter < 10 :
1537
- time .sleep (2 )
1537
+ time .sleep (3 )
1538
1538
readygo = make_url_request (f'{ epurl } /api/v1/info/version' , None ,'GET' )
1539
1539
if readygo :
1540
1540
print ("Embedded Horde Worker is started." )
@@ -1610,10 +1610,10 @@ def make_url_request(url, data, method='POST'):
1610
1610
time .sleep (1 )
1611
1611
if exitcounter < 100 :
1612
1612
print ("Horde Worker Shutdown - Too many errors." )
1613
- time .sleep (2 )
1613
+ time .sleep (3 )
1614
1614
else :
1615
1615
print ("Horde Worker Shutdown - Server Closing." )
1616
- time .sleep (1 )
1616
+ time .sleep (2 )
1617
1617
sys .exit (2 )
1618
1618
1619
1619
def main (args ):
@@ -1637,7 +1637,7 @@ def main(args):
1637
1637
except Exception as ex2 :
1638
1638
print ("File selection GUI unsupported. Please check command line: script.py --help" )
1639
1639
print ("Reason for no GUI: " + str (ex2 ))
1640
- time .sleep (2 )
1640
+ time .sleep (3 )
1641
1641
sys .exit (2 )
1642
1642
1643
1643
if args .hordeconfig and args .hordeconfig [0 ]!= "" :
@@ -1681,20 +1681,20 @@ def main(args):
1681
1681
time .sleep (1 )
1682
1682
if not os .path .exists (args .model_param ):
1683
1683
print (f"Cannot find model file: { args .model_param } " )
1684
- time .sleep (2 )
1684
+ time .sleep (3 )
1685
1685
sys .exit (2 )
1686
1686
1687
1687
if args .lora and args .lora [0 ]!= "" :
1688
1688
if not os .path .exists (args .lora [0 ]):
1689
1689
print (f"Cannot find lora file: { args .lora [0 ]} " )
1690
- time .sleep (2 )
1690
+ time .sleep (3 )
1691
1691
sys .exit (2 )
1692
1692
else :
1693
1693
args .lora [0 ] = os .path .abspath (args .lora [0 ])
1694
1694
if len (args .lora ) > 1 :
1695
1695
if not os .path .exists (args .lora [1 ]):
1696
1696
print (f"Cannot find lora base: { args .lora [1 ]} " )
1697
- time .sleep (2 )
1697
+ time .sleep (3 )
1698
1698
sys .exit (2 )
1699
1699
else :
1700
1700
args .lora [1 ] = os .path .abspath (args .lora [1 ])
@@ -1715,7 +1715,7 @@ def main(args):
1715
1715
1716
1716
if not loadok :
1717
1717
print ("Could not load model: " + modelname )
1718
- time .sleep (2 )
1718
+ time .sleep (3 )
1719
1719
sys .exit (3 )
1720
1720
try :
1721
1721
basepath = os .path .abspath (os .path .dirname (__file__ ))
@@ -1743,6 +1743,7 @@ def main(args):
1743
1743
1744
1744
if args .hordeconfig and len (args .hordeconfig )> 4 :
1745
1745
horde_thread = threading .Thread (target = run_horde_worker ,args = (args ,args .hordeconfig [3 ],args .hordeconfig [4 ]))
1746
+ horde_thread .daemon = True
1746
1747
horde_thread .start ()
1747
1748
1748
1749
print (f"Please connect to custom endpoint at { epurl } " )
0 commit comments