mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
added more stats in perf
This commit is contained in:
parent
2ef03c9de6
commit
7968bdebbb
4 changed files with 16 additions and 1 deletions
|
@ -251,6 +251,10 @@ extern "C"
|
||||||
int get_total_gens() {
|
int get_total_gens() {
|
||||||
return total_gens;
|
return total_gens;
|
||||||
}
|
}
|
||||||
|
int get_total_img_gens()
|
||||||
|
{
|
||||||
|
return total_img_gens;
|
||||||
|
}
|
||||||
int get_last_stop_reason() {
|
int get_last_stop_reason() {
|
||||||
return (int)last_stop_reason;
|
return (int)last_stop_reason;
|
||||||
}
|
}
|
||||||
|
|
1
expose.h
1
expose.h
|
@ -142,4 +142,5 @@ extern float last_process_time;
|
||||||
extern int last_token_count;
|
extern int last_token_count;
|
||||||
extern int last_seed;
|
extern int last_seed;
|
||||||
extern int total_gens;
|
extern int total_gens;
|
||||||
|
extern int total_img_gens;
|
||||||
extern stop_reason last_stop_reason;
|
extern stop_reason last_stop_reason;
|
||||||
|
|
|
@ -636,6 +636,7 @@ preloaded_story = None
|
||||||
sslvalid = False
|
sslvalid = False
|
||||||
nocertify = False
|
nocertify = False
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
last_req_time = time.time()
|
||||||
|
|
||||||
class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
sys_version = ""
|
sys_version = ""
|
||||||
|
@ -1047,14 +1048,17 @@ Enter Prompt:<br>
|
||||||
response_body = (json.dumps({"result":"KoboldCpp","version":KcppVersion, "protected":has_password ,"txt2img":has_txt2img,"vision":has_vision}).encode())
|
response_body = (json.dumps({"result":"KoboldCpp","version":KcppVersion, "protected":has_password ,"txt2img":has_txt2img,"vision":has_vision}).encode())
|
||||||
|
|
||||||
elif self.path.endswith(('/api/extra/perf')):
|
elif self.path.endswith(('/api/extra/perf')):
|
||||||
|
global last_req_time, start_time
|
||||||
lastp = handle.get_last_process_time()
|
lastp = handle.get_last_process_time()
|
||||||
laste = handle.get_last_eval_time()
|
laste = handle.get_last_eval_time()
|
||||||
lastc = handle.get_last_token_count()
|
lastc = handle.get_last_token_count()
|
||||||
totalgens = handle.get_total_gens()
|
totalgens = handle.get_total_gens()
|
||||||
|
totalimggens = handle.get_total_img_gens()
|
||||||
stopreason = handle.get_last_stop_reason()
|
stopreason = handle.get_last_stop_reason()
|
||||||
lastseed = handle.get_last_seed()
|
lastseed = handle.get_last_seed()
|
||||||
uptime = time.time() - start_time
|
uptime = time.time() - start_time
|
||||||
response_body = (json.dumps({"last_process":lastp,"last_eval":laste,"last_token_count":lastc, "last_seed":lastseed, "total_gens":totalgens, "stop_reason":stopreason, "queue":requestsinqueue, "idle":(0 if modelbusy.locked() else 1), "hordeexitcounter":exitcounter, "uptime":uptime}).encode())
|
idletime = time.time() - last_req_time
|
||||||
|
response_body = (json.dumps({"last_process":lastp,"last_eval":laste,"last_token_count":lastc, "last_seed":lastseed, "total_gens":totalgens, "stop_reason":stopreason, "total_img_gens":totalimggens, "queue":requestsinqueue, "idle":(0 if modelbusy.locked() else 1), "hordeexitcounter":exitcounter, "uptime":uptime, "idletime":idletime}).encode())
|
||||||
|
|
||||||
elif self.path.endswith('/api/extra/generate/check'):
|
elif self.path.endswith('/api/extra/generate/check'):
|
||||||
if not self.secure_endpoint():
|
if not self.secure_endpoint():
|
||||||
|
@ -1249,6 +1253,8 @@ Enter Prompt:<br>
|
||||||
is_txt2img = True
|
is_txt2img = True
|
||||||
|
|
||||||
if is_txt2img or api_format > 0:
|
if is_txt2img or api_format > 0:
|
||||||
|
global last_req_time
|
||||||
|
last_req_time = time.time()
|
||||||
|
|
||||||
if not is_txt2img and api_format<5:
|
if not is_txt2img and api_format<5:
|
||||||
if not self.secure_endpoint():
|
if not self.secure_endpoint():
|
||||||
|
|
|
@ -111,6 +111,9 @@ struct SDParams {
|
||||||
int upscale_repeats = 1;
|
int upscale_repeats = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//shared
|
||||||
|
int total_img_gens = 0;
|
||||||
|
|
||||||
//global static vars for SD
|
//global static vars for SD
|
||||||
static SDParams * sd_params = nullptr;
|
static SDParams * sd_params = nullptr;
|
||||||
static sd_ctx_t * sd_ctx = nullptr;
|
static sd_ctx_t * sd_ctx = nullptr;
|
||||||
|
@ -388,5 +391,6 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
|
||||||
free(results);
|
free(results);
|
||||||
output.data = recent_data.c_str();
|
output.data = recent_data.c_str();
|
||||||
output.status = 1;
|
output.status = 1;
|
||||||
|
total_img_gens += 1;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue