@@ -401,7 +401,7 @@ def bring_terminal_to_foreground():
401
401
session_kudos_earned = 0
402
402
session_jobs = 0
403
403
session_starttime = None
404
- exitcounter = 0
404
+ exitcounter = - 1
405
405
punishcounter = 0 #causes a timeout if too many errors
406
406
rewardcounter = 0 #reduces error counts for successful jobs
407
407
totalgens = 0
@@ -708,7 +708,7 @@ def noscript_webui(self):
708
708
self .wfile .write (finalhtml )
709
709
710
710
def do_GET (self ):
711
- global maxctx , maxhordelen , friendlymodelname , KcppVersion , totalgens , preloaded_story
711
+ global maxctx , maxhordelen , friendlymodelname , KcppVersion , totalgens , preloaded_story , exitcounter
712
712
self .path = self .path .rstrip ('/' )
713
713
response_body = None
714
714
content_type = 'application/json'
@@ -754,7 +754,7 @@ def do_GET(self):
754
754
lastc = handle .get_last_token_count ()
755
755
totalgens = handle .get_total_gens ()
756
756
stopreason = handle .get_last_stop_reason ()
757
- response_body = (json .dumps ({"last_process" :lastp ,"last_eval" :laste ,"last_token_count" :lastc , "total_gens" :totalgens , "stop_reason" :stopreason , "queue" :requestsinqueue , "idle" :(0 if modelbusy .locked () else 1 )}).encode ())
757
+ response_body = (json .dumps ({"last_process" :lastp ,"last_eval" :laste ,"last_token_count" :lastc , "total_gens" :totalgens , "stop_reason" :stopreason , "queue" :requestsinqueue , "idle" :(0 if modelbusy .locked () else 1 ), "hordeexitcounter" : exitcounter }).encode ())
758
758
759
759
elif self .path .endswith ('/api/extra/generate/check' ):
760
760
pendtxtStr = ""
@@ -1893,7 +1893,7 @@ def submit_completed_generation(url, jobid, sessionstart, submit_dict):
1893
1893
rewardcounter += 1
1894
1894
if rewardcounter > 50 :
1895
1895
rewardcounter = 0
1896
- if exitcounter >= 1 :
1896
+ if exitcounter > 1 :
1897
1897
exitcounter -= 1
1898
1898
1899
1899
def make_url_request_horde (url , data , method = 'POST' ):
@@ -1908,6 +1908,7 @@ def make_url_request_horde(url, data, method='POST'):
1908
1908
current_generation = None
1909
1909
session_starttime = datetime .now ()
1910
1910
sleepy_counter = 0 #if this exceeds a value, worker becomes sleepy (slower)
1911
+ exitcounter = 0
1911
1912
print (f"===\n Embedded Horde Worker '{ worker_name } ' Starting...\n (To use your own KAI Bridge/Scribe worker instead, don't set your API key)" )
1912
1913
BRIDGE_AGENT = f"KoboldCppEmbedWorker:2:https://github.com/LostRuins/koboldcpp"
1913
1914
cluster = "https://horde.koboldai.net"
@@ -1931,7 +1932,7 @@ def make_url_request_horde(url, data, method='POST'):
1931
1932
print_with_time (f"Caution: Too many failed jobs may lead to entering maintenance mode." )
1932
1933
time .sleep (60 * penaltytime )
1933
1934
else :
1934
- print_with_time (f"Exit limit reached, too many errors." )
1935
+ print_with_time (f"Horde Worker Exit limit reached, too many errors." )
1935
1936
1936
1937
#first, make sure we are not generating
1937
1938
if modelbusy .locked ():
0 commit comments