rphrp1985 commited on
Commit
3bdb799
·
verified ·
1 Parent(s): 95e5ac6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -118,7 +118,7 @@ def respond(
118
 
119
  messages.append({"role": "user", "content": message})
120
  input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(accelerator.device) #.to('cuda')
121
- print(input_ids)
122
  ## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
123
  # with autocast():
124
  gen_tokens = model.generate(
@@ -130,6 +130,7 @@ def respond(
130
 
131
  gen_text = tokenizer.decode(gen_tokens[0])
132
  print(gen_text)
 
133
 
134
  yield gen_text
135
 
 
118
 
119
  messages.append({"role": "user", "content": message})
120
  input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(accelerator.device) #.to('cuda')
121
+ input_str= str(input_ids)
122
  ## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
123
  # with autocast():
124
  gen_tokens = model.generate(
 
130
 
131
  gen_text = tokenizer.decode(gen_tokens[0])
132
  print(gen_text)
133
+ gen_text= gen_text.replace(input_str,'')
134
 
135
  yield gen_text
136