[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,
|
||||
|
||||
@@ -8,7 +8,7 @@ VLMs tested here:
|
||||
- Qwen VL series (Qwen2-VL-7B, Qwen2.5-VL-7B, Qwen3-VL-30B)
|
||||
- InternVL2 series (InternVL2_5-2B)
|
||||
- MiniCPM series (MiniCPM-v-2_6, MiniCPM-o-2_6)
|
||||
- DeepSeek VL series (deepseek-vl2-small, Janus-Pro-7B)
|
||||
- DeepSeek VL series (deepseek-vl2-small, Janus-Pro-7B, DeepSeek-OCR-2)
|
||||
- Kimi VL (Kimi-VL-A3B-Instruct)
|
||||
- MiMo VL (MiMo-VL-7B-RL)
|
||||
- GLM VL (GLM-4.1V-9B-Thinking)
|
||||
@@ -116,13 +116,28 @@ AMD_VLM_MODELS = [
|
||||
"accuracy_threshold": 0.27,
|
||||
"extra_args": ["--trust-remote-code"],
|
||||
},
|
||||
# DeepSeek-OCR-2 - last to avoid memory pressure on subsequent models
|
||||
{
|
||||
"model_path": "deepseek-ai/DeepSeek-OCR-2",
|
||||
"tp_size": 1,
|
||||
"accuracy_threshold": 0.25,
|
||||
"extra_args": [
|
||||
"--trust-remote-code",
|
||||
"--disable-cuda-graph",
|
||||
"--mem-fraction-static",
|
||||
"0.70",
|
||||
"--max-total-tokens",
|
||||
"16384",
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
# Models that need special handling on AMD (MoE models)
|
||||
# Models that need triton attention on AMD (aiter pa_ragged JIT compilation OOMs)
|
||||
TRITON_ATTENTION_MODELS = {
|
||||
# "deepseek-ai/deepseek-vl2-small",
|
||||
# "Qwen/Qwen3-VL-30B-A3B-Instruct",
|
||||
# "moonshotai/Kimi-VL-A3B-Instruct",
|
||||
"deepseek-ai/DeepSeek-OCR-2",
|
||||
}
|
||||
|
||||
# Models known to fail on AMD - exclude from testing
|
||||
|
||||
Reference in New Issue
Block a user