ThomasSimonini HF staff commited on
Commit
d199475
·
verified ·
1 Parent(s): 2a3e8ee

Upload moondream.py

Browse files
Files changed (1) hide show
  1. 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
- return tokenizer.batch_decode(output_ids, skip_special_tokens=True)
 
 
 
 
 
 
 
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