mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
Obtain stopping strings in chat mode
This commit is contained in:
parent
ded6c41cf8
commit
b657be7381
|
|
@ -456,15 +456,17 @@ def get_stopping_strings(state):
|
||||||
]
|
]
|
||||||
|
|
||||||
for text in texts:
|
for text in texts:
|
||||||
text = text.strip()
|
stripped_text = text.strip()
|
||||||
if text.startswith("<") and ">" in text:
|
if stripped_text.startswith("<") and ">" in stripped_text:
|
||||||
stopping_strings.append(text.split(">")[0] + ">")
|
stopping_strings.append(stripped_text.split(">")[0] + ">")
|
||||||
elif text.startswith("[") and "]" in text:
|
elif stripped_text.startswith("[") and "]" in stripped_text:
|
||||||
stopping_strings.append(text.split("]")[0] + "]")
|
stopping_strings.append(stripped_text.split("]")[0] + "]")
|
||||||
elif text.startswith("(") and ")" in text:
|
elif stripped_text.startswith("(") and ")" in stripped_text:
|
||||||
stopping_strings.append(text.split(")")[0] + ")")
|
stopping_strings.append(stripped_text.split(")")[0] + ")")
|
||||||
elif text.startswith("{") and "}" in text:
|
elif stripped_text.startswith("{") and "}" in stripped_text:
|
||||||
stopping_strings.append(text.split("}")[0] + "}")
|
stopping_strings.append(stripped_text.split("}")[0] + "}")
|
||||||
|
elif ":" in text:
|
||||||
|
stopping_strings.append(text.split(":")[0] + ":")
|
||||||
|
|
||||||
if 'stopping_strings' in state and isinstance(state['stopping_strings'], list):
|
if 'stopping_strings' in state and isinstance(state['stopping_strings'], list):
|
||||||
stopping_strings += state.pop('stopping_strings')
|
stopping_strings += state.pop('stopping_strings')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue