Upload Moondream
Browse files- configuration_moondream.py +0 -3
- model.safetensors +1 -1
- moondream.py +2 -2
configuration_moondream.py
CHANGED
|
@@ -1,8 +1,5 @@
|
|
| 1 |
from transformers import PretrainedConfig
|
| 2 |
|
| 3 |
-
from typing import Optional
|
| 4 |
-
import math
|
| 5 |
-
|
| 6 |
|
| 7 |
class PhiConfig(PretrainedConfig):
|
| 8 |
model_type = "phi"
|
|
|
|
| 1 |
from transformers import PretrainedConfig
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
class PhiConfig(PretrainedConfig):
|
| 5 |
model_type = "phi"
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 3715037856
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15daa0c9a135d2084520e47d517ef689e09ee71c63d606bd8b8ff209bacc3e34
|
| 3 |
size 3715037856
|
moondream.py
CHANGED
|
@@ -91,7 +91,7 @@ class Moondream(PreTrainedModel):
|
|
| 91 |
result_queue=None,
|
| 92 |
**kwargs,
|
| 93 |
):
|
| 94 |
-
prompt = f"<image>\n\n{chat_history}Question: {question}\n\nAnswer:
|
| 95 |
answer = self.generate(
|
| 96 |
image_embeds,
|
| 97 |
prompt,
|
|
@@ -120,7 +120,7 @@ class Moondream(PreTrainedModel):
|
|
| 120 |
image_embeds = self.encode_image(images)
|
| 121 |
|
| 122 |
templated_prompts = [
|
| 123 |
-
f"<image>\n\nQuestion: {prompt}\n\nAnswer:
|
| 124 |
]
|
| 125 |
prompt_embs = [
|
| 126 |
self.input_embeds(prompt, image_embed.unsqueeze(0), tokenizer)[0]
|
|
|
|
| 91 |
result_queue=None,
|
| 92 |
**kwargs,
|
| 93 |
):
|
| 94 |
+
prompt = f"<image>\n\n{chat_history}Question: {question}\n\nAnswer:"
|
| 95 |
answer = self.generate(
|
| 96 |
image_embeds,
|
| 97 |
prompt,
|
|
|
|
| 120 |
image_embeds = self.encode_image(images)
|
| 121 |
|
| 122 |
templated_prompts = [
|
| 123 |
+
f"<image>\n\nQuestion: {prompt}\n\nAnswer:" for prompt in prompts
|
| 124 |
]
|
| 125 |
prompt_embs = [
|
| 126 |
self.input_embeds(prompt, image_embed.unsqueeze(0), tokenizer)[0]
|