stop seq fix

This commit is contained in:
Concedo
2026-08-12 21:34:31 +08:00
parent f556b13a4e
commit dfab7c1bf0
2 changed files with 4 additions and 5 deletions
+2 -2
View File
@@ -20991,7 +20991,7 @@ Current version indicated by LITEVER below.
let st = get_instruct_starttag(true);
let et = get_instruct_endtag(true);
let me = get_my_multiplayer_chatname();
seqs = [st, et];
seqs = [st]; //don't include the assistant tag, otherwise it breaks some think formats
if(localsettings.separate_end_tags)
{
if(get_instruct_endtag_end(true))
@@ -21013,7 +21013,7 @@ Current version indicated by LITEVER below.
//the model just gets too confused and is likely to repeat the tag.
}
}
//special case for GPT-OSS, never use it as a stop sequence or stuff gets messed
//special case for GPT-OSS and Muse Glimmer, never use it as a stop sequence or stuff gets messed
seqs = seqs.filter(itm => !itm.includes("<|start|>assistant"));
if(!localsettings.includedefaultstops)
{
+2 -3
View File
@@ -4557,7 +4557,7 @@ ws ::= | " " | "\n" [ \t]{0,20}
# openai allows either a string or a list as a stop sequence
if genparams.get('stop',[]) is not None:
if isinstance(genparams.get('stop',[]), list):
genparams["stop_sequence"] = genparams.get('stop', [])
genparams["stop_sequence"] = genparams.get('stop', genparams.get('stop_sequence', []))
else:
genparams["stop_sequence"] = [genparams.get('stop')]
@@ -4769,10 +4769,9 @@ ws ::= | " " | "\n" [ \t]{0,20}
if len(audio_added)>0:
genparams["audio"] = audio_added
if len(genparams.get('stop_sequence', []))==0: #only set stop seq if it wont overwrite existing
genparams["stop_sequence"] = [user_message_start.strip(),assistant_message_start.strip()]
genparams["stop_sequence"] = [user_message_start.strip()]
else:
genparams["stop_sequence"].append(user_message_start.strip())
genparams["stop_sequence"].append(assistant_message_start.strip())
if not used_tool_json and jinjatools and latest_turn_was_tool:
genparams["stop_sequence"].append("(Made a function call") # qol prevent fake toolcalls
genparams["trim_stop"] = True