qnguyen3 commited on
Commit
b9312e1
1 Parent(s): f54d208

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -58,7 +58,7 @@ def bot_streaming(message, history):
58
  add_generation_prompt=True)
59
  text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
60
  input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
61
- streamer = TextIteratorStreamer(input_ids, **{"skip_special_tokens": True})
62
  image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
63
  generation_kwargs = dict(input_ids, images=image_tensor, streamer=streamer, max_new_tokens=100)
64
  generated_text = ""
 
58
  add_generation_prompt=True)
59
  text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
60
  input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
61
+ streamer = TextIteratorStreamer(tokenizer, **{"skip_special_tokens": True})
62
  image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
63
  generation_kwargs = dict(input_ids, images=image_tensor, streamer=streamer, max_new_tokens=100)
64
  generated_text = ""