[Feature] Support Deepseek-VL2 (#2798)

Co-authored-by: Edenzzzz <wtan45@wisc.edu>
Co-authored-by: Chayenne <zhaochen20@outlook.com>
Co-authored-by: Yi Zhang <1109276519@qq.com>
This commit is contained in:
萝卜菜
2025-03-17 14:07:59 +08:00
committed by GitHub
parent 0212d2e288
commit d6d21640d3
13 changed files with 1259 additions and 2 deletions

View File

@@ -160,8 +160,13 @@ class ImageInputs:
image_grid_thws: List[Tuple[int, int, int]] = None
mrope_position_delta: Optional[torch.Tensor] = None
# deepseek vl2 related
image_seq_mask: Optional[List[torch.Tensor]] = None
image_spatial_crop: Optional[List[torch.Tensor]] = None
# The id of the single-image placeholder token
im_token_id: Optional[torch.Tensor] = None
# All the images in the batch should share the same special image
# bound token ids.
im_start_id: Optional[int] = None
@@ -192,6 +197,8 @@ class ImageInputs:
"aspect_ratio_ids",
"aspect_ratio_mask",
"image_grid_thws",
"image_seq_mask",
"image_spatial_crop",
"im_token_id",
"im_start_id",
"im_end_id",
@@ -228,6 +235,8 @@ class ImageInputs:
"aspect_ratio_ids",
"aspect_ratio_mask",
"image_grid_thws",
"image_seq_mask",
"image_spatial_crop",
]
for arg in optional_args:
if getattr(self, arg, None) is not None: