Merge remote-tracking branch 'ren/concedo' into concedo_experimental
This commit is contained in:
commit
7222877069
4 changed files with 20 additions and 1 deletions
|
@ -220,6 +220,14 @@ extern "C"
|
|||
return generation_finished;
|
||||
}
|
||||
|
||||
float get_prompt_eval_time() {
|
||||
return prompt_eval_time;
|
||||
}
|
||||
|
||||
float get_prompt_process_time() {
|
||||
return prompt_process_time;
|
||||
}
|
||||
|
||||
const char* get_pending_output() {
|
||||
return gpttype_get_pending_output().c_str();
|
||||
}
|
||||
|
|
2
expose.h
2
expose.h
|
@ -72,3 +72,5 @@ extern std::string lora_filename;
|
|||
extern std::string lora_base;
|
||||
extern std::vector<std::string> generated_tokens;
|
||||
extern bool generation_finished;
|
||||
extern float prompt_eval_time;
|
||||
extern float prompt_process_time;
|
||||
|
|
|
@ -33,6 +33,8 @@ std::string executable_path = "";
|
|||
std::string lora_filename = "";
|
||||
std::string lora_base = "";
|
||||
bool generation_finished;
|
||||
float prompt_process_time;
|
||||
float prompt_eval_time;
|
||||
std::vector<std::string> generated_tokens;
|
||||
|
||||
//return val: 0=fail, 1=(original ggml, alpaca), 2=(ggmf), 3=(ggjt)
|
||||
|
@ -867,6 +869,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs, generation_o
|
|||
bool stream_sse = inputs.stream_sse;
|
||||
|
||||
generation_finished = false; // Set current generation status
|
||||
prompt_eval_time = 0;
|
||||
prompt_process_time = 0;
|
||||
generated_tokens.clear(); // New Generation, new tokens
|
||||
|
||||
if (params.repeat_last_n < 1)
|
||||
|
@ -1445,6 +1449,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs, generation_o
|
|||
fflush(stdout);
|
||||
output.status = 1;
|
||||
generation_finished = true;
|
||||
prompt_eval_time = pt2;
|
||||
prompt_process_time = pt1;
|
||||
snprintf(output.text, sizeof(output.text), "%s", concat_output.c_str());
|
||||
|
||||
return output;
|
||||
|
|
|
@ -161,6 +161,8 @@ def init_library():
|
|||
handle.new_token.argtypes = [ctypes.c_int]
|
||||
handle.get_stream_count.restype = ctypes.c_int
|
||||
handle.has_finished.restype = ctypes.c_bool
|
||||
handle.get_prompt_eval_time.restype = ctypes.c_float
|
||||
handle.get_prompt_process_time.restype = ctypes.c_float
|
||||
handle.abort_generate.restype = ctypes.c_bool
|
||||
handle.get_pending_output.restype = ctypes.c_char_p
|
||||
|
||||
|
@ -530,7 +532,8 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
newprompt = fullprompt
|
||||
|
||||
gen = asyncio.run(self.handle_request(genparams, newprompt, basic_api_flag, kai_sse_stream_flag))
|
||||
|
||||
gen['prompt_process_time'] = handle.get_prompt_process_time()
|
||||
gen['prompt_eval_time'] = handle.get_prompt_eval_time()
|
||||
try:
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue