Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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(
|
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 = ""
|