diff --git a/expose.cpp b/expose.cpp index b386e3c2c..a9fe0b9e4 100644 --- a/expose.cpp +++ b/expose.cpp @@ -274,6 +274,14 @@ extern "C" { 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() { return total_gens; } @@ -281,6 +289,14 @@ extern "C" { 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() { return (int)last_stop_reason; } diff --git a/expose.h b/expose.h index f346d02fb..f13d786c9 100644 --- a/expose.h +++ b/expose.h @@ -245,4 +245,8 @@ extern int last_token_count; extern int last_seed; extern int total_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; diff --git a/gpttype_adapter.cpp b/gpttype_adapter.cpp index 51526a194..390ed07db 100644 --- a/gpttype_adapter.cpp +++ b/gpttype_adapter.cpp @@ -62,6 +62,8 @@ float last_eval_time = 0; int last_token_count = 0; int last_seed = -1; int total_gens = 0; +int last_draft_success = 0; +int last_draft_failed = 0; stop_reason last_stop_reason = stop_reason::INVALID; std::vector generated_tokens; @@ -4002,6 +4004,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs) last_process_time = pt1; last_token_count = realnpredict; last_seed = kcpp_data->seed; + last_draft_failed = draft_failures; + last_draft_success = draft_successes; total_gens += 1; concat_output_mtx.lock(); concat_output_reader_copy_res = concat_output; diff --git a/koboldcpp.py b/koboldcpp.py index 5a9ec6731..9a4164b12 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -465,6 +465,11 @@ def init_library(): handle.get_last_process_time.restype = ctypes.c_float handle.get_last_token_count.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_last_stop_reason.restype = ctypes.c_int handle.abort_generate.restype = ctypes.c_bool @@ -2422,12 +2427,16 @@ Enter Prompt:
lastc = handle.get_last_token_count() totalgens = handle.get_total_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() lastseed = handle.get_last_seed() + lastdraftsuccess = handle.get_last_draft_success() + lastdraftfailed = handle.get_last_draft_failed() uptime = time.time() - start_time idletime = time.time() - last_req_time 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'): if not self.secure_endpoint(): @@ -4860,20 +4869,6 @@ def unload_libs(): if handle and dll_close: print("Unloading Libraries...") 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 handle = None diff --git a/otherarch/tts_adapter.cpp b/otherarch/tts_adapter.cpp index 451a4a368..65d76a774 100644 --- a/otherarch/tts_adapter.cpp +++ b/otherarch/tts_adapter.cpp @@ -480,6 +480,8 @@ static int code_terminate_id = 151670; static int nthreads = 4; static int tts_max_len = 4096; +int total_tts_gens = 0; + bool ttstype_load_model(const tts_load_model_inputs inputs) { 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_speaker_seed = inputs.speaker_seed; last_generation_settings_prompt = std::string(inputs.prompt); + total_tts_gens += 1; return output; } diff --git a/otherarch/whispercpp/whisper_adapter.cpp b/otherarch/whispercpp/whisper_adapter.cpp index f839576e2..029ea6928 100644 --- a/otherarch/whispercpp/whisper_adapter.cpp +++ b/otherarch/whispercpp/whisper_adapter.cpp @@ -28,6 +28,7 @@ static bool whisper_is_quiet = false; static whisper_context * whisper_ctx = nullptr; static std::string whisper_output_text = ""; +int total_transcribe_gens = 0; static bool is_wav_buffer(const std::string buf) { // 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.status = 1; + total_transcribe_gens += 1; return output; }