Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -232,13 +232,16 @@ def bot(history):
|
|
| 232 |
our_chatbot.conversation.append_message(our_chatbot.conversation.roles[1], None)
|
| 233 |
prompt = our_chatbot.conversation.get_prompt()
|
| 234 |
|
| 235 |
-
input_ids = (
|
| 236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
prompt, our_chatbot.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt"
|
| 238 |
-
)
|
| 239 |
-
.unsqueeze(0)
|
| 240 |
-
.to(our_chatbot.model.device)
|
| 241 |
-
)
|
| 242 |
|
| 243 |
stop_str = (
|
| 244 |
our_chatbot.conversation.sep
|
|
@@ -280,7 +283,7 @@ def bot(history):
|
|
| 280 |
|
| 281 |
# return history
|
| 282 |
generate_kwargs = dict(
|
| 283 |
-
input_ids,
|
| 284 |
streamer=streamer,
|
| 285 |
images=image_tensor,
|
| 286 |
max_new_tokens=1024,
|
|
|
|
| 232 |
our_chatbot.conversation.append_message(our_chatbot.conversation.roles[1], None)
|
| 233 |
prompt = our_chatbot.conversation.get_prompt()
|
| 234 |
|
| 235 |
+
# input_ids = (
|
| 236 |
+
# tokenizer_image_token(
|
| 237 |
+
# prompt, our_chatbot.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt"
|
| 238 |
+
# )
|
| 239 |
+
# .unsqueeze(0)
|
| 240 |
+
# .to(our_chatbot.model.device)
|
| 241 |
+
# )
|
| 242 |
+
input_ids = tokenizer_image_token(
|
| 243 |
prompt, our_chatbot.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt"
|
| 244 |
+
).unsqueeze(0).to(our_chatbot.model.device)
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
stop_str = (
|
| 247 |
our_chatbot.conversation.sep
|
|
|
|
| 283 |
|
| 284 |
# return history
|
| 285 |
generate_kwargs = dict(
|
| 286 |
+
{"input_ids": input_ids},
|
| 287 |
streamer=streamer,
|
| 288 |
images=image_tensor,
|
| 289 |
max_new_tokens=1024,
|