Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -232,16 +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 |
-
# input_ids = tokenizer_image_token(
|
243 |
# prompt, our_chatbot.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt"
|
244 |
-
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
print("### input_id",input_ids)
|
246 |
stop_str = (
|
247 |
our_chatbot.conversation.sep
|
@@ -283,7 +283,7 @@ def bot(history):
|
|
283 |
|
284 |
# return history
|
285 |
generate_kwargs = dict(
|
286 |
-
|
287 |
streamer=streamer,
|
288 |
images=image_tensor,
|
289 |
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 |
print("### input_id",input_ids)
|
246 |
stop_str = (
|
247 |
our_chatbot.conversation.sep
|
|
|
283 |
|
284 |
# return history
|
285 |
generate_kwargs = dict(
|
286 |
+
inputs=input_ids,
|
287 |
streamer=streamer,
|
288 |
images=image_tensor,
|
289 |
max_new_tokens=1024,
|