Commit 31833bf8 authored by Baber's avatar Baber
Browse files

remove whitespaces from anthropic stop sequences

parent 867413f8
...@@ -322,6 +322,10 @@ class AnthropicChat(LocalCompletionsAPI): ...@@ -322,6 +322,10 @@ class AnthropicChat(LocalCompletionsAPI):
max_tokens = gen_kwargs.pop("max_gen_toks", self._max_gen_toks) max_tokens = gen_kwargs.pop("max_gen_toks", self._max_gen_toks)
temperature = gen_kwargs.pop("temperature", 0) temperature = gen_kwargs.pop("temperature", 0)
stop = gen_kwargs.pop("until", ["\n\nHuman:"]) stop = gen_kwargs.pop("until", ["\n\nHuman:"])
# anthropic doesn't allow whitespace stop sequences
stop = [x for x in stop if not x.isspace()]
if not stop:
stop = ["\n\nHuman:"]
if not isinstance(stop, list): if not isinstance(stop, list):
stop = [stop] stop = [stop]
out = { out = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment