Fix some regexes
This commit is contained in:
parent
e61138bdad
commit
11c3214981
2 changed files with 4 additions and 3 deletions
|
|
@ -256,9 +256,10 @@ if args.chat or args.cai_chat:
|
|||
for reply in generate_reply(question, tokens, inference_settings, selected_model, eos_token=eos_token):
|
||||
next_character_found = False
|
||||
|
||||
previous_idx = [m.start() for m in re.finditer(f"\n{name2}:", question)]
|
||||
previous_idx = [m.start() for m in re.finditer(f"(^|\n){name2}:", question)]
|
||||
idx = [m.start() for m in re.finditer(f"(^|\n){name2}:", reply)]
|
||||
idx = idx[len(previous_idx)-1]
|
||||
|
||||
reply = reply[idx + len(f"\n{name2}:"):]
|
||||
|
||||
if check:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue