fCola commited on
Commit
bdc2b04
·
verified ·
1 Parent(s): 8ade2ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -47,7 +47,7 @@ class HfModelWrapper:
47
  input_text = self.build_prompt(user_input, history)
48
  input_ids = self.tokenizer.encode(input_text, return_tensors="pt").to("cuda")
49
 
50
- streamer = TextIteratorStreamer(self.tokenizer, skip_prompt=True)
51
 
52
  gen_kwargs = {
53
  "inputs": input_ids,
@@ -509,15 +509,12 @@ def send_message(message, history):
509
  partial = ""
510
  idx = 0
511
  for t in response_generator:
512
- if idx <= 5:
513
  idx += 1
514
  continue
515
  else:
516
- if t != "<|eot_id|>":
517
- partial += t
518
- yield history + [{"role": "assistant", "content": partial}]
519
- else:
520
- continue
521
 
522
 
523
  # Create the dashboard
 
47
  input_text = self.build_prompt(user_input, history)
48
  input_ids = self.tokenizer.encode(input_text, return_tensors="pt").to("cuda")
49
 
50
+ streamer = TextIteratorStreamer(self.tokenizer, skip_prompt=True, skip_special_tokens=True)
51
 
52
  gen_kwargs = {
53
  "inputs": input_ids,
 
509
  partial = ""
510
  idx = 0
511
  for t in response_generator:
512
+ if idx <= 3:
513
  idx += 1
514
  continue
515
  else:
516
+ partial += t
517
+ yield history + [{"role": "assistant", "content": partial}]
 
 
 
518
 
519
 
520
  # Create the dashboard