[AMD] [DeepSeek-OCR-2 Day 0] Enable DeepSeek-OCR-2 on AMD GPUs and add nightly test (#19732)
This commit is contained in:
@@ -125,8 +125,9 @@ def isin_list(
|
||||
elements: torch.Tensor,
|
||||
test_elements_list: list[int],
|
||||
) -> torch.Tensor:
|
||||
test_elements = torch.tensor(test_elements_list, pin_memory=True).to(
|
||||
device=elements.device, non_blocking=True
|
||||
use_pin = torch.cuda.is_available() and not getattr(torch.version, "hip", None)
|
||||
test_elements = torch.tensor(test_elements_list, pin_memory=use_pin).to(
|
||||
device=elements.device, non_blocking=use_pin
|
||||
)
|
||||
|
||||
return torch.isin(elements, test_elements)
|
||||
@@ -1685,7 +1686,7 @@ class DeepseekOCRForCausalLM(nn.Module):
|
||||
|
||||
images_crop = (
|
||||
torch.stack([item.images_crop for item in mm_items], dim=0)
|
||||
.type(torch.long)
|
||||
.type(target_dtype)
|
||||
.to(device=pixel_values.device)
|
||||
)
|
||||
images_spatial_crop = (
|
||||
|
||||
@@ -210,6 +210,8 @@ class BaseMultimodalProcessor(ABC):
|
||||
"image_emb_mask": Modality.IMAGE,
|
||||
"images_spatial_crop": Modality.IMAGE,
|
||||
"images_crop": Modality.IMAGE,
|
||||
"has_local_crops": Modality.IMAGE,
|
||||
"has_images": Modality.IMAGE,
|
||||
"tgt_size": Modality.IMAGE,
|
||||
"image_grid_hws": Modality.IMAGE,
|
||||
"aspect_ratio_ids": Modality.IMAGE,
|
||||
|
||||
Reference in New Issue
Block a user