Spaces:
Runtime error
Runtime error
Stop generation at \nHuman and \n---- in Chat mode
#15
by loubnabnl HF Staff - opened
88 unmodified lines899091929394959619 unmodified lines11611711811912012112212312412512612712812913088 unmodified lines do_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 lines else: output = prompt
previous_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 output else: output += response.token.text previous_token = response.token.text yield output return output
app.py+6