mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
add more perf stats
This commit is contained in:
parent
e500968f92
commit
eb1809c105
6 changed files with 39 additions and 15 deletions
16
expose.cpp
16
expose.cpp
|
@ -274,6 +274,14 @@ extern "C"
|
||||||
{
|
{
|
||||||
return last_seed;
|
return last_seed;
|
||||||
}
|
}
|
||||||
|
int get_last_draft_success()
|
||||||
|
{
|
||||||
|
return last_draft_success;
|
||||||
|
}
|
||||||
|
int get_last_draft_failed()
|
||||||
|
{
|
||||||
|
return last_draft_failed;
|
||||||
|
}
|
||||||
int get_total_gens() {
|
int get_total_gens() {
|
||||||
return total_gens;
|
return total_gens;
|
||||||
}
|
}
|
||||||
|
@ -281,6 +289,14 @@ extern "C"
|
||||||
{
|
{
|
||||||
return total_img_gens;
|
return total_img_gens;
|
||||||
}
|
}
|
||||||
|
int get_total_tts_gens()
|
||||||
|
{
|
||||||
|
return total_tts_gens;
|
||||||
|
}
|
||||||
|
int get_total_transcribe_gens()
|
||||||
|
{
|
||||||
|
return total_transcribe_gens;
|
||||||
|
}
|
||||||
int get_last_stop_reason() {
|
int get_last_stop_reason() {
|
||||||
return (int)last_stop_reason;
|
return (int)last_stop_reason;
|
||||||
}
|
}
|
||||||
|
|
4
expose.h
4
expose.h
|
@ -245,4 +245,8 @@ 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 int total_img_gens;
|
||||||
|
extern int total_tts_gens;
|
||||||
|
extern int total_transcribe_gens;
|
||||||
|
extern int last_draft_success;
|
||||||
|
extern int last_draft_failed;
|
||||||
extern stop_reason last_stop_reason;
|
extern stop_reason last_stop_reason;
|
||||||
|
|
|
@ -62,6 +62,8 @@ float last_eval_time = 0;
|
||||||
int last_token_count = 0;
|
int last_token_count = 0;
|
||||||
int last_seed = -1;
|
int last_seed = -1;
|
||||||
int total_gens = 0;
|
int total_gens = 0;
|
||||||
|
int last_draft_success = 0;
|
||||||
|
int last_draft_failed = 0;
|
||||||
stop_reason last_stop_reason = stop_reason::INVALID;
|
stop_reason last_stop_reason = stop_reason::INVALID;
|
||||||
std::vector<std::string> generated_tokens;
|
std::vector<std::string> generated_tokens;
|
||||||
|
|
||||||
|
@ -4002,6 +4004,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
|
||||||
last_process_time = pt1;
|
last_process_time = pt1;
|
||||||
last_token_count = realnpredict;
|
last_token_count = realnpredict;
|
||||||
last_seed = kcpp_data->seed;
|
last_seed = kcpp_data->seed;
|
||||||
|
last_draft_failed = draft_failures;
|
||||||
|
last_draft_success = draft_successes;
|
||||||
total_gens += 1;
|
total_gens += 1;
|
||||||
concat_output_mtx.lock();
|
concat_output_mtx.lock();
|
||||||
concat_output_reader_copy_res = concat_output;
|
concat_output_reader_copy_res = concat_output;
|
||||||
|
|
25
koboldcpp.py
25
koboldcpp.py
|
@ -465,6 +465,11 @@ def init_library():
|
||||||
handle.get_last_process_time.restype = ctypes.c_float
|
handle.get_last_process_time.restype = ctypes.c_float
|
||||||
handle.get_last_token_count.restype = ctypes.c_int
|
handle.get_last_token_count.restype = ctypes.c_int
|
||||||
handle.get_last_seed.restype = ctypes.c_int
|
handle.get_last_seed.restype = ctypes.c_int
|
||||||
|
handle.get_last_draft_success.restype = ctypes.c_int
|
||||||
|
handle.get_last_draft_failed.restype = ctypes.c_int
|
||||||
|
handle.get_total_img_gens.restype = ctypes.c_int
|
||||||
|
handle.get_total_tts_gens.restype = ctypes.c_int
|
||||||
|
handle.get_total_transcribe_gens.restype = ctypes.c_int
|
||||||
handle.get_total_gens.restype = ctypes.c_int
|
handle.get_total_gens.restype = ctypes.c_int
|
||||||
handle.get_last_stop_reason.restype = ctypes.c_int
|
handle.get_last_stop_reason.restype = ctypes.c_int
|
||||||
handle.abort_generate.restype = ctypes.c_bool
|
handle.abort_generate.restype = ctypes.c_bool
|
||||||
|
@ -2422,12 +2427,16 @@ Enter Prompt:<br>
|
||||||
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()
|
totalimggens = handle.get_total_img_gens()
|
||||||
|
totalttsgens = handle.get_total_tts_gens()
|
||||||
|
totaltranscribegens = handle.get_total_transcribe_gens()
|
||||||
stopreason = handle.get_last_stop_reason()
|
stopreason = handle.get_last_stop_reason()
|
||||||
lastseed = handle.get_last_seed()
|
lastseed = handle.get_last_seed()
|
||||||
|
lastdraftsuccess = handle.get_last_draft_success()
|
||||||
|
lastdraftfailed = handle.get_last_draft_failed()
|
||||||
uptime = time.time() - start_time
|
uptime = time.time() - start_time
|
||||||
idletime = time.time() - last_req_time
|
idletime = time.time() - last_req_time
|
||||||
is_quiet = True if (args.quiet and args.debugmode != 1) else False
|
is_quiet = True if (args.quiet and args.debugmode != 1) else False
|
||||||
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, "quiet":is_quiet}).encode())
|
response_body = (json.dumps({"last_process":lastp,"last_eval":laste,"last_token_count":lastc, "last_seed":lastseed, "last_draft_success":lastdraftsuccess, "last_draft_failed":lastdraftfailed, "total_gens":totalgens, "stop_reason":stopreason, "total_img_gens":totalimggens, "total_tts_gens":totalttsgens, "total_transcribe_gens":totaltranscribegens, "queue":requestsinqueue, "idle":(0 if modelbusy.locked() else 1), "hordeexitcounter":exitcounter, "uptime":uptime, "idletime":idletime, "quiet":is_quiet}).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():
|
||||||
|
@ -4860,20 +4869,6 @@ def unload_libs():
|
||||||
if handle and dll_close:
|
if handle and dll_close:
|
||||||
print("Unloading Libraries...")
|
print("Unloading Libraries...")
|
||||||
dll_close(handle._handle)
|
dll_close(handle._handle)
|
||||||
del handle.load_model
|
|
||||||
del handle.generate
|
|
||||||
del handle.new_token
|
|
||||||
del handle.get_stream_count
|
|
||||||
del handle.has_finished
|
|
||||||
del handle.get_last_eval_time
|
|
||||||
del handle.get_last_process_time
|
|
||||||
del handle.get_last_token_count
|
|
||||||
del handle.get_last_seed
|
|
||||||
del handle.get_total_gens
|
|
||||||
del handle.get_last_stop_reason
|
|
||||||
del handle.abort_generate
|
|
||||||
del handle.token_count
|
|
||||||
del handle.get_pending_output
|
|
||||||
del handle
|
del handle
|
||||||
handle = None
|
handle = None
|
||||||
|
|
||||||
|
|
|
@ -480,6 +480,8 @@ static int code_terminate_id = 151670;
|
||||||
static int nthreads = 4;
|
static int nthreads = 4;
|
||||||
static int tts_max_len = 4096;
|
static int tts_max_len = 4096;
|
||||||
|
|
||||||
|
int total_tts_gens = 0;
|
||||||
|
|
||||||
bool ttstype_load_model(const tts_load_model_inputs inputs)
|
bool ttstype_load_model(const tts_load_model_inputs inputs)
|
||||||
{
|
{
|
||||||
tts_is_quiet = inputs.quiet;
|
tts_is_quiet = inputs.quiet;
|
||||||
|
@ -986,6 +988,7 @@ tts_generation_outputs ttstype_generate(const tts_generation_inputs inputs)
|
||||||
last_generation_settings_audio_seed = inputs.audio_seed;
|
last_generation_settings_audio_seed = inputs.audio_seed;
|
||||||
last_generation_settings_speaker_seed = inputs.speaker_seed;
|
last_generation_settings_speaker_seed = inputs.speaker_seed;
|
||||||
last_generation_settings_prompt = std::string(inputs.prompt);
|
last_generation_settings_prompt = std::string(inputs.prompt);
|
||||||
|
total_tts_gens += 1;
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ static bool whisper_is_quiet = false;
|
||||||
static whisper_context * whisper_ctx = nullptr;
|
static whisper_context * whisper_ctx = nullptr;
|
||||||
static std::string whisper_output_text = "";
|
static std::string whisper_output_text = "";
|
||||||
|
|
||||||
|
int total_transcribe_gens = 0;
|
||||||
|
|
||||||
static bool is_wav_buffer(const std::string buf) {
|
static bool is_wav_buffer(const std::string buf) {
|
||||||
// RIFF ref: https://en.wikipedia.org/wiki/Resource_Interchange_File_Format
|
// RIFF ref: https://en.wikipedia.org/wiki/Resource_Interchange_File_Format
|
||||||
|
@ -279,5 +280,6 @@ whisper_generation_outputs whispertype_generate(const whisper_generation_inputs
|
||||||
}
|
}
|
||||||
output.text = whisper_output_text.c_str();
|
output.text = whisper_output_text.c_str();
|
||||||
output.status = 1;
|
output.status = 1;
|
||||||
|
total_transcribe_gens += 1;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue