Upload Moondream
Browse files- moondream.py +3 -3
moondream.py
CHANGED
@@ -58,7 +58,7 @@ class Moondream(PreTrainedModel):
|
|
58 |
image_embeds,
|
59 |
prompt,
|
60 |
tokenizer,
|
61 |
-
eos_text="
|
62 |
max_new_tokens=128,
|
63 |
**kwargs,
|
64 |
):
|
@@ -89,13 +89,13 @@ class Moondream(PreTrainedModel):
|
|
89 |
result_queue=None,
|
90 |
**kwargs,
|
91 |
):
|
92 |
-
prompt = f"<image>\n\n{chat_history}Question: {question}\n\nAnswer:"
|
93 |
answer = self.generate(
|
94 |
image_embeds,
|
95 |
prompt,
|
96 |
eos_text="<END>",
|
97 |
tokenizer=tokenizer,
|
98 |
-
max_new_tokens=
|
99 |
**kwargs,
|
100 |
)[0]
|
101 |
cleaned_answer = re.sub("<$", "", re.sub("END$", "", answer)).strip()
|
|
|
58 |
image_embeds,
|
59 |
prompt,
|
60 |
tokenizer,
|
61 |
+
eos_text="<END>",
|
62 |
max_new_tokens=128,
|
63 |
**kwargs,
|
64 |
):
|
|
|
89 |
result_queue=None,
|
90 |
**kwargs,
|
91 |
):
|
92 |
+
prompt = f"<image>\n\n{chat_history}Question: {question}\n\nAnswer: "
|
93 |
answer = self.generate(
|
94 |
image_embeds,
|
95 |
prompt,
|
96 |
eos_text="<END>",
|
97 |
tokenizer=tokenizer,
|
98 |
+
max_new_tokens=256,
|
99 |
**kwargs,
|
100 |
)[0]
|
101 |
cleaned_answer = re.sub("<$", "", re.sub("END$", "", answer)).strip()
|