Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -54,12 +54,14 @@ def generate_answer_git(processor, model, image, question):
|
|
54 |
# print(generated_ids)
|
55 |
# generated_answer = processor.batch_decode(generated_ids.sequences, skip_special_tokens=True)
|
56 |
# print(generated_answer)
|
57 |
-
inputs = processor(images=image, text=question, add_special_tokens=False, return_tensors="pt"
|
58 |
inputs["max_length"] = 20
|
59 |
inputs["num_beams"] = 1
|
60 |
inputs["do_sample"] = True
|
61 |
inputs["top_k"] = 50
|
62 |
inputs["top_p"] = 0.95
|
|
|
|
|
63 |
|
64 |
out = model.generate(**inputs)
|
65 |
print(out.scores)
|
|
|
54 |
# print(generated_ids)
|
55 |
# generated_answer = processor.batch_decode(generated_ids.sequences, skip_special_tokens=True)
|
56 |
# print(generated_answer)
|
57 |
+
inputs = processor(images=image, text=question, add_special_tokens=False, return_tensors="pt")
|
58 |
inputs["max_length"] = 20
|
59 |
inputs["num_beams"] = 1
|
60 |
inputs["do_sample"] = True
|
61 |
inputs["top_k"] = 50
|
62 |
inputs["top_p"] = 0.95
|
63 |
+
inputs["return_dict_in_generate"] = True
|
64 |
+
inputs["output_scores"] = True
|
65 |
|
66 |
out = model.generate(**inputs)
|
67 |
print(out.scores)
|