Upload moondream.py
Browse files- moondream.py +8 -1
moondream.py
CHANGED
@@ -86,7 +86,14 @@ class Moondream(PreTrainedModel):
|
|
86 |
inputs_embeds=inputs_embeds, streamer=streamer, **generate_config
|
87 |
)
|
88 |
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
|
92 |
|
|
|
86 |
inputs_embeds=inputs_embeds, streamer=streamer, **generate_config
|
87 |
)
|
88 |
|
89 |
+
# Pull the generated text from the streamer, and update the model output.
|
90 |
+
model_output = ""
|
91 |
+
for new_text in streamer:
|
92 |
+
model_output += new_text
|
93 |
+
yield new_text
|
94 |
+
return model_output
|
95 |
+
|
96 |
+
#return tokenizer.batch_decode(output_ids, skip_special_tokens=True)
|
97 |
|
98 |
|
99 |
|