From a531328f7eef0d7e6f4ac85186409ee2320586ee Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 25 Aug 2025 18:41:58 -0700 Subject: [PATCH] Fix the GPT-OSS stopping string --- modules/chat.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/chat.py b/modules/chat.py index 8a9a5a1b..96d36ba5 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -475,6 +475,12 @@ def get_stopping_strings(state): result = [item for item in stopping_strings if not any(item.startswith(other) and item != other for other in stopping_strings)] result = list(set(result)) + # Handle GPT-OSS as a special case + if '<|channel|>final<|message|>' in state['instruction_template_str'] and "<|end|>" in result: + result.remove("<|end|>") + result.append("<|result|>") + result = list(set(result)) + if shared.args.verbose: logger.info("STOPPING_STRINGS=") pprint.PrettyPrinter(indent=4, sort_dicts=False).pprint(result)