Update moondream.py
Browse filesfix: attribute encode_image is missing.
- moondream.py +2 -0
moondream.py
CHANGED
|
@@ -249,6 +249,7 @@ class MoondreamModel(nn.Module):
|
|
| 249 |
|
| 250 |
return self._vis_proj(global_features, reconstructed)
|
| 251 |
|
|
|
|
| 252 |
def encode_image(
|
| 253 |
self,
|
| 254 |
image: Union[Image.Image, EncodedImage],
|
|
@@ -290,6 +291,7 @@ class MoondreamModel(nn.Module):
|
|
| 290 |
)
|
| 291 |
|
| 292 |
|
|
|
|
| 293 |
def _apply_top_p(self, probs: torch.Tensor, top_p: float):
|
| 294 |
probs_sort, probs_idx = torch.sort(probs, dim=-1, descending=True)
|
| 295 |
probs_sum = torch.cumsum(probs_sort, dim=-1)
|
|
|
|
| 249 |
|
| 250 |
return self._vis_proj(global_features, reconstructed)
|
| 251 |
|
| 252 |
+
|
| 253 |
def encode_image(
|
| 254 |
self,
|
| 255 |
image: Union[Image.Image, EncodedImage],
|
|
|
|
| 291 |
)
|
| 292 |
|
| 293 |
|
| 294 |
+
|
| 295 |
def _apply_top_p(self, probs: torch.Tensor, top_p: float):
|
| 296 |
probs_sort, probs_idx = torch.sort(probs, dim=-1, descending=True)
|
| 297 |
probs_sum = torch.cumsum(probs_sort, dim=-1)
|