Spaces:
Build error
Build error
Update app.py
Browse files42 unmodified lines434445464746474849505152535455565758596061536263646523 unmodified lines89909183929394953 unmodified lines99100101931021031041059 unmodified lines11511611710911811912012142 unmodified linesmodel = model.eval()
@spaces.GPU()def stream_chat(message: str, history: list, temperature: float, max_new_tokens: int, top_p: float, top_k: int, penalty: float):
def stream_chat( message: str, history: list, temperature: float = 0.8, max_new_tokens: int = 1024, top_p: float = 1.0, top_k: int = 20, penalty: float = 1.2): print(f'message: {message}') print(f'history: {history}') for resp, history in model.stream_chat( tokenizer, query = message, history = history, max_new_tokens = max_new_tokens, do_sample = True if temperature == 0 else False, do_sample = False if temperature == 0 else True, top_p = top_p, top_k = top_k, temperature = temperature,23 unmodified lines ), gr.Slider( minimum=128, maximum=2048, maximum=8192, step=1, value=1024, label="Max New Tokens",3 unmodified lines minimum=0.0, maximum=1.0, step=0.1, value=0.8, value=1.0, label="top_p", render=False, ),9 unmodified lines minimum=0.0, maximum=2.0, step=0.1, value=1.0, value=1.2, label="Repetition penalty", render=False, ),app.py+15-6