mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-09-19 09:15:18 +02:00
add stop reason for error
This commit is contained in:
+2
-7
@@ -1384,7 +1384,7 @@ Current version indicated by LITEVER below.
|
||||
padding-right: 6px;
|
||||
}
|
||||
#actionmenuitems button.slim,#actionmenuitems2 button.slim {
|
||||
width: 38px;
|
||||
width: 34px;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
@@ -21092,12 +21092,7 @@ Current version indicated by LITEVER below.
|
||||
//something went wrong.
|
||||
clear_poll_flags();
|
||||
render_gametext();
|
||||
if (data.message != "") {
|
||||
msgbox(data.message);
|
||||
}
|
||||
else {
|
||||
msgbox("Unspecified error while submitting prompt");
|
||||
}
|
||||
msgbox("Error Submitting Prompt: " + JSON.stringify(data));
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -21,6 +21,7 @@ enum samplers
|
||||
};
|
||||
enum stop_reason
|
||||
{
|
||||
ERROR_ENCOUNTERED=-2,
|
||||
INVALID=-1,
|
||||
OUT_OF_TOKENS=0,
|
||||
EOS_TOKEN_HIT=1,
|
||||
|
||||
+8
-4
@@ -3396,7 +3396,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
|
||||
output.text = nullptr;
|
||||
output.status = 0;
|
||||
output.prompt_tokens = output.completion_tokens = 0;
|
||||
output.stopreason = stop_reason::INVALID;
|
||||
last_stop_reason = stop_reason::ERROR_ENCOUNTERED;
|
||||
output.stopreason = last_stop_reason;
|
||||
generation_finished = true;
|
||||
return output;
|
||||
}
|
||||
@@ -4482,7 +4483,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
|
||||
output.text = nullptr;
|
||||
output.status = 0;
|
||||
output.prompt_tokens = output.completion_tokens = 0;
|
||||
output.stopreason = stop_reason::INVALID;
|
||||
last_stop_reason = stop_reason::ERROR_ENCOUNTERED;
|
||||
output.stopreason = last_stop_reason;
|
||||
generation_finished = true;
|
||||
return output;
|
||||
}
|
||||
@@ -4944,7 +4946,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
|
||||
output.text = nullptr;
|
||||
output.status = 0;
|
||||
output.prompt_tokens = output.completion_tokens = 0;
|
||||
output.stopreason = stop_reason::INVALID;
|
||||
last_stop_reason = stop_reason::ERROR_ENCOUNTERED;
|
||||
output.stopreason = last_stop_reason;
|
||||
generation_finished = true;
|
||||
return output;
|
||||
}
|
||||
@@ -4974,7 +4977,8 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
|
||||
output.text = nullptr;
|
||||
output.status = 0;
|
||||
output.prompt_tokens = output.completion_tokens = 0;
|
||||
output.stopreason = stop_reason::INVALID;
|
||||
last_stop_reason = stop_reason::ERROR_ENCOUNTERED;
|
||||
output.stopreason = last_stop_reason;
|
||||
generation_finished = true;
|
||||
return output;
|
||||
}
|
||||
|
||||
+3
-3
@@ -67,7 +67,7 @@ dry_seq_break_max = 128
|
||||
extra_images_max = 4 # for kontext/qwen img
|
||||
|
||||
# global vars
|
||||
KcppVersion = "1.107.1"
|
||||
KcppVersion = "1.107.2"
|
||||
showdebug = True
|
||||
kcpp_instance = None #global running instance
|
||||
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":""}
|
||||
@@ -3383,7 +3383,7 @@ class KcppServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
recvtxt = genout['text']
|
||||
prompttokens = genout['prompt_tokens']
|
||||
comptokens = genout['completion_tokens']
|
||||
currfinishreason = ("length" if (genout['stopreason'] != 1) else "stop")
|
||||
currfinishreason = "error" if (genout['stopreason'] == -2) else ("length" if (genout['stopreason'] != 1) else "stop")
|
||||
|
||||
# grab logprobs if not streaming
|
||||
logprobsdict = None
|
||||
@@ -3476,7 +3476,7 @@ class KcppServerRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
streamDone = handle.has_finished() #exit next loop on done
|
||||
if streamDone:
|
||||
sr = handle.get_last_stop_reason()
|
||||
currfinishreason = ("length" if (sr!=1) else "stop")
|
||||
currfinishreason = "error" if sr==-2 else ("length" if (sr!=1) else "stop")
|
||||
tokenStr = ""
|
||||
streamcount = handle.get_stream_count()
|
||||
while current_token < streamcount:
|
||||
|
||||
Reference in New Issue
Block a user