mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-26 09:40:20 +01:00
Fix an error
Fixes "UnboundLocalError: local variable 'substring_found' referenced before assignment" when loading non-pygmalion models in cai chat mode.
This commit is contained in:
parent
5b0bbfa6e8
commit
a85bb5e9a2
@ -373,6 +373,8 @@ if args.chat or args.cai_chat:
|
|||||||
else:
|
else:
|
||||||
reply = reply[idx + 1 + len(f"{current}:"):]
|
reply = reply[idx + 1 + len(f"{current}:"):]
|
||||||
|
|
||||||
|
substring_found = False
|
||||||
|
|
||||||
if check:
|
if check:
|
||||||
reply = reply.split('\n')[0].strip()
|
reply = reply.split('\n')[0].strip()
|
||||||
else:
|
else:
|
||||||
@ -385,7 +387,6 @@ if args.chat or args.cai_chat:
|
|||||||
# Detect if something like "\nYo" is generated just before
|
# Detect if something like "\nYo" is generated just before
|
||||||
# "\nYou:" is completed
|
# "\nYou:" is completed
|
||||||
tmp = f"\n{other}:"
|
tmp = f"\n{other}:"
|
||||||
substring_found = False
|
|
||||||
for j in range(1, len(tmp)):
|
for j in range(1, len(tmp)):
|
||||||
if reply[-j:] == tmp[:j]:
|
if reply[-j:] == tmp[:j]:
|
||||||
substring_found = True
|
substring_found = True
|
||||||
|
Loading…
Reference in New Issue
Block a user