baohuynhbk14 commited on
Commit
d84fba9
·
1 Parent(s): 6a6ac31

Remove last entry from history in predict function

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -195,7 +195,7 @@ def predict(message,
195
  repetition_penalty=2.5,
196
  do_sample=False):
197
 
198
- history = state.get_prompt()
199
  logger.info(f"==== History ====\n{history}")
200
 
201
  generation_config = dict(temperature=temperature, max_new_tokens= max_output_tokens, top_p=top_p, do_sample=do_sample, num_beams = 3, repetition_penalty=repetition_penalty)
@@ -211,7 +211,7 @@ def predict(message,
211
  DEFAULT_IMAGE_TOKEN not in first_user_message:
212
  state.messages[index]['content'] = DEFAULT_IMAGE_TOKEN + "\n" + first_user_message
213
 
214
- history = state.get_prompt()
215
  logger.info(f"==== Modified History ====\n{history}")
216
 
217
  logger.info(f"==== Lenght Pixel values ====\n{len(pixel_values)}")
 
195
  repetition_penalty=2.5,
196
  do_sample=False):
197
 
198
+ history = state.get_prompt()[:-1]
199
  logger.info(f"==== History ====\n{history}")
200
 
201
  generation_config = dict(temperature=temperature, max_new_tokens= max_output_tokens, top_p=top_p, do_sample=do_sample, num_beams = 3, repetition_penalty=repetition_penalty)
 
211
  DEFAULT_IMAGE_TOKEN not in first_user_message:
212
  state.messages[index]['content'] = DEFAULT_IMAGE_TOKEN + "\n" + first_user_message
213
 
214
+ history = state.get_prompt()[:-1]
215
  logger.info(f"==== Modified History ====\n{history}")
216
 
217
  logger.info(f"==== Lenght Pixel values ====\n{len(pixel_values)}")