Aratako commited on
Commit
374e460
·
verified ·
1 Parent(s): afff73a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -78,7 +78,7 @@ def chat_llama3_8b(message: str,
78
  print(tokenizer.apply_chat_template(conversation, add_generation_prompt=True, tokenize=False))
79
  print(input_ids)
80
 
81
- streamer = TextIteratorStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=False)
82
 
83
  generate_kwargs = dict(
84
  input_ids= input_ids,
@@ -97,6 +97,10 @@ def chat_llama3_8b(message: str,
97
 
98
  outputs = []
99
  for text in streamer:
 
 
 
 
100
  outputs.append(text)
101
  print("".join(outputs))
102
  yield "".join(outputs)
 
78
  print(tokenizer.apply_chat_template(conversation, add_generation_prompt=True, tokenize=False))
79
  print(input_ids)
80
 
81
+ streamer = TextIteratorStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)
82
 
83
  generate_kwargs = dict(
84
  input_ids= input_ids,
 
97
 
98
  outputs = []
99
  for text in streamer:
100
+ if "<think>" in text:
101
+ text = text.replace("<think>", "").strip()
102
+ if "</think>" in text:
103
+ text = text.replace("</think>", "").strip()
104
  outputs.append(text)
105
  print("".join(outputs))
106
  yield "".join(outputs)