Spaces:
Runtime error
Runtime error
Stop generation at \nHuman and \n---- in Chat mode
#15
by loubnabnl HF Staff - opened
88 unmodified lines89909192939419 unmodified lines11411511611711811912012112212312488 unmodified linesdo_sample=True,seed=42,)if chat_mode and FIM_INDICATOR in prompt:raise ValueError("Chat mode and FIM are mutually exclusive. Choose one or the other.")19 unmodified lineselse:output = promptfor response in stream:if fim_mode and response.token.text =="<|endoftext|>":output += (suffix + "\n" + response.token.text)else:output += response.token.textyield outputreturn output88 unmodified lines899091929394959619 unmodified lines11611711811912012112212312412512612712812913088 unmodified linesdo_sample=True,seed=42,)if chat_mode:generate_kwargs.update({"stop_sequences": ["\nHuman", "\n-----"]})if chat_mode and FIM_INDICATOR in prompt:raise ValueError("Chat mode and FIM are mutually exclusive. Choose one or the other.")19 unmodified lineselse:output = promptprevious_token = ""for response in stream:if fim_mode and response.token.text =="<|endoftext|>":output += (suffix + "\n" + response.token.text)elif chat_mode and response.token.text in ["Human", "-----"] and previous_token=="\n":return outputelse:output += response.token.textprevious_token = response.token.textyield outputreturn output
app.py+6