Skip to content

Commit

Permalink
Fix some type errors in Pixtral-HF
Browse files Browse the repository at this point in the history
Signed-off-by: DarkLight1337 <[email protected]>
  • Loading branch information
DarkLight1337 committed Dec 31, 2024
1 parent 0926717 commit 0fe561d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions vllm/model_executor/models/pixtral.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import math
from dataclasses import dataclass, fields
from functools import cached_property
from typing import Iterable, List, Mapping, Optional, Set, Tuple, Union

import numpy
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down Expand Up @@ -306,7 +306,7 @@ def _parse_and_validate_image_input(
images: Optional[Union[List[List[torch.Tensor]], List[torch.Tensor],
torch.Tensor]] = None,
image_tokens: Optional[torch.Tensor] = None,
) -> Optional[List[torch.Tensor]]:
) -> Tuple[Optional[List[torch.Tensor]], Optional[torch.Tensor]]:
if images is None:
return None, None

Expand Down Expand Up @@ -604,11 +604,11 @@ def max_patches_per_side(self) -> int:
return self.args.image_size // self.args.patch_size

@property
def device(self) -> torch.device:
def device(self) -> torch.types.Device:
return next(self.parameters()).device

@property
def dtype(self) -> torch.device:
def dtype(self) -> torch.dtype:
return next(self.parameters()).dtype

@property
Expand Down Expand Up @@ -741,8 +741,8 @@ def get_pixtral_hf_image_feature_size(hf_config: PixtralVisionConfig,
ratio = max(image_width / max_width, image_height / max_height)

if ratio > 1:
image_width = int(numpy.ceil(image_width / ratio))
image_height = int(numpy.ceil(image_height / ratio))
image_width = int(math.ceil(image_width / ratio))
image_height = int(math.ceil(image_height / ratio))

num_height_tokens, num_width_tokens = _get_pixtral_hf_num_image_tokens(
(image_height, image_width),
Expand Down

0 comments on commit 0fe561d

Please sign in to comment.